Static Nested Inner class in Java|Interview Question| Selenium WebDriver



Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are called static nested classes. Non-static nested classes are called inner classes.Inner Class in JAVA is a class embedded inside a another Class which is called as outer class. It is also called as Nested Class. Inner class is not accessible from outer class. It is required to create an object of the inner class in outer class.
Advantage:
The inner class can access the methods and variables of the outer class without creating objects of outer class.


Static Inner Class in JAVA:
An inner class can be declared as static, in which we can access the inner class from outer class without creating an object of the outer class.

Advantage:
The purpose of the static inner class makes the code more readable and easily under-stable.

ById is an static nested inner class in By Class

Conclusion:
static nested inner classes are mainly useful for more readability.

Modular Driven Framework in Selenium WebDriver | Real Time Examples |Step by Step Explanation



Modular Driven Framework is the approach where all the test cases are first analyzed to find out the reusable flows. Then while scripting, all these reusable flows are created as functions and stored in external files and called in the test scripts wherever required.

Advantages:
Modular division of scripts leads to easier maintenance and also the scalability of the automated test Scripts are independent to write.

Disadvantages:
Since data is still hard-coded in the script, the same test case cannot be run for multiple data values without changing data after each run.
Additional time is spent in analyzing the test cases to identify with reusable flows.
Good programming knowledge is required to create and maintain function libraries.

Real Time Examples:
Scenario 1 :
Verify the Service Type is available in the HTML table
1. Access the URL and enter Admin/Admin123 as credentials
2. Select the ‘Inpatient Ward’.
3. click on Login.
4. Navigate to Appointment Scheduling->Manage Service Types.
5. verify the Service Type ‘Urology’ available in the html table.
6. Logout

Scenario 2 :
Delete the Service Type from the HTML Table and Verify the Service Type is not available in the HTML Table
1. Access the url and enter Admin/Admin123 as credentials
2. Select the ‘Inpatient Ward’.
3. click on Login.
4. Navigate to Appointment Scheduling->Manage Service Types.
5. Click on Delete icon to perform deletion of Service Type.
6. Verify the Service Type is not available in the HTML Table
7 . Logout

ModularDrivenFramework

ModularDrivenFramework



Conclusion:
Using the Logic mentioned above helps to implement the Modular Driven Framework successfully in your projects.
Let us know if you have any queries in implementing this framework.
Drop an email to totalqa9@gmail.com

Thanks for the @Guest Author :
Nithya Kalyani
Email ID : Nithyakalyanigovindarajan@gmail.com

Selenium WebDriver, Keyword Driven Framework Design Architecture ,XLSX,Reflection API



In this tutorial we are going to discuss about the implementation of Keyword Driven Framework. In Keyword Driven framework, you can create various keywords and associate function with each of these keywords. Then you create a Function Library that contains the logic to read the keywords and call the associated action.
Advantages:
The keyword and function libraries are completely generic and thus can be reused easily for different applications
All the complexity is added in the function libraries. Once the libraries are ready, it becomes very easy to write the actual test script steps in excel sheets.
Disadvantages:
Lot of time and effort needs to be spent initially to create the function libraries.
The benefits of the keyword driven framework are realized only after it has been used for longer periods of time.
Lets get into the implementation of the framework.
This framework is mainly implemented using the Reflection API where the method name is invoked based on the keyword passed in the XLSX file.
Pre-Requisites
Dependencies:

  • Selenium WebDriver
  • TestNG
  • Apache POI

KeywordDrivenFramework

KeywordDrivenFramework




Logic :DriverScript.java

Logic :ActionClass.java

Logic :ExcelUtils.java

Logic : testng.xml

Logic :inputData.xlsx
Github Link for xlsx file:
https://github.com/totalqa9/KeywordDrivenFwk.git

Conclusion:
Using the Logic mentioned above helps to implement the Keyword Driven Framework successfully in your projects.
Let us know if you have any queries in implementing this framework.
Drop an email to totalqa9@gmail.com

How to explain ExplicitWait in interviews?? Selenium WebDriver



Synchronization,Thread.sleep(time in millis),ImplicitWait
https://youtu.be/vtltAlKpyjs
ExplicitWait is mainly useful to apply wait on a single element.Synchronizing the state between the browser and its DOM, and your WebDriver script.This means that for as long as the condition returns a falsy value, it will keep trying and waiting.In order to achieve the ExplicitWait, we have to use a java class called WebDriverWait.

  • alert is present
  • element exists
  • element is visible
  • title contains
  • title is
  • visible text

File Upload Using Robot Class :

File upload in Selenium,Java,Robot Class


Video Link : https://youtu.be/UKUe0wpAN2k

Scenario 1:
Upload the TextFile and convert into PDF:C:\\SeleniumArtifacts\\ConvertTxttoPDF.txt
wait for visible Text

Scenario 2:
Upload the TextFile and convert into PDF : C:\\SeleniumArtifacts\\ConvertTxttoPDF.txt
Initial Title of the page : Zamzar – video converter, audio converter, image converter, eBook converter

wait for title is : Zamzar – File conversion progress

Scenario 3:
Upload the JarFile : C:\\SeleniumArtifacts\\SeleniumLatestVersion\\selenium-java-3.141.59\\client-combined-3.141.59.jar
wait for alert is Present

Scenario 4:
Upload the TextFile and Convert into PDF: C:\\SeleniumArtifacts\\ConvertTxttoPDF.txt
wait for element is visible :Download

Conclusion:
All the 4 Scenario’s will help to learn ExplicitWait.
We can use ExplicitWait in the programs to wait for a particular Element.

Interview Question Identify the Duplicate Items in the Listbox|HashMap|Selenium WebDriver



In Selenium WebDriver selecting a values from the Listbox is important based on the required input. In few scenario’s we need to validate the Listbox contains duplicate items are getting displayed as per the requirements. And also in interviews the mostly asked question is how to identify the duplicate values in the Listbox.
In order to automate this scenario, i have created a HTML webpage using the following html source code. Create a new File and copy the below contents of the html source into notepad and save the script in a file named ListboxEx.html. Access the HTML file and open in an browser to view the contents of the html page.

HTML SOURCE CODE

SELENIUM WEBDRIVER LOGIC:

CONCLUSION:
Using HashMap we can identify the duplicate option values in the Listbox
OUTPUT:
The size of the list is :: 5
Duplicate value in the List SELENIUM
The size of the hMAP :: 4
FAILED: validateDuplicateItemsInList
validate the list does not contain any duplicates
java.lang.AssertionError: expected [4] but found [5]

Allure Reporting | Selenium WebDriver Framework| Page Object Model | TestNG | Maven- MAC,WINDOWS



As a tester we are mainly interested in generating very good html reports to get to know the Test cases passed and failed. TestNG which is a java framework helps us in generation of index.html and emailable-report.html contains the information about the Test case Status. Even though it generates the status of the testcases we are mainly interested in taking screenshots,generation of PIE charts,LINE charts. In this tutorial we are doing to discuss on usage of Allure Framework to generate reports for different languages : JAVA,PYTHON,JAVASCRIPT,RUBY,GROOVY,PHP,DOT NET and SCALA.

GENERATE ALLURE REPORTING:
Create a Maven project

Subscribe to our YOUTUBE channel for more updates on automation videos


Project Source Tree Directory Structure:
The standard layout for Maven projects (the application sources reside in ${basedir}/src/main/java and test sources reside in ${basedir}/src/test/java, where ${basedir} represents the directory containing pom.xml).

MavenDirectoryStructure-Allure configuration

MavenDirectoryStructure-Allure configuration

Configuration for Allure: pom.xml




Add the allure.properties under src/test/resources

TestExecutionListener.java

OpenMRSTests.java

OpenMRSPage.java

TestBase.java

ProjectConfiguration.java

totalqa.xml

Right Click on the project and select Run configuration

AllureConfiguration

AllureConfiguration


Maven Goals as ‘site’

maven goals site

View the Reports in Firefox Brower only.

allure-maven.html

allure-maven.html

Finally, we are able to capture the allure reports as shown below:

allure-maven.html

allure selenium report

History of Test Execution Results

AllureReportHistory

AllureReportHistory

Duration and Retries Trend

AllureGraphs

AllureGraphs

Refer to the below Links for Practice
Collections in Java
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz

VALIDATE MULTIPLE LINES OF TEXT IN SELENIUM WEBDRIVER



FILE HANDLING SCENARIO’S IN SELENIUM WEBDRIVER:
1. Read the text displayed in the WEBSITE: Actual
Automate Coronavirus COVID19 REST API POST METHOD Tutorial Part2
2. Maintain this text in a txt file : Expected
Automate Coronavirus COVID19 REST API POST METHOD Tutorial Part2
3. Compare the values from STEP 1 and STEP 2.
4. Mark the TESTCASE as PASS/ FAIL.

JAVA API FOR READING THE CONTENTS OF THE TEXT FILE:
Following are the java classes useful in reading the text from the file.

  • import java.io.BufferedReader;
  • import java.io.File;
  • import java.io.FileReader;
  • import java.io.IOException;


Java Logic

Conclusion:
File Contents:: Automate Coronavirus COVID19 REST API POST METHOD Tutorial Part2
PASSED: validateTextfromWebPage

Automate Coronavirus COVID19 REST API POST METHOD Tutorial Part2




REST API Automation Testing Tutorial Part 2:In this tutorial we are going to focus on testing the HTTP POST method using REST ASSURED API. To know more details about the REST and REST ASSURED API and testing HTTP GET method. Please refer to this link.
1. Understanding Post Request
REST Endpoint URL : https://api.covid19api.com/auth/access_token
AUTHORIZATION: Basic Auth
Username:go-corona-admin
Password:5577YvzU4bK63a1WIQ3Z043H
Body:
{“Email”:”test1@covid19api.com”, “Subscription”:”basic”}
Response:
{ ‘result’ : ‘success’ }
Response Code:
200
Response Headers:
Server: nginx/1.14.0 (Ubuntu)
Date: Sun, 22 Mar 2020 08:07:30 GMT
Content-Type: application/json
Content-Length: 24
Connection: keep-alive
Vary: Origin

2. Design Test Cases

REST ASSURED REST API HTTP POST TESTCASES

REST ASSURED REST API HTTP POST TESTCASES

3. Pre-requisites
io.restassured
maven dependency
add the dependency in the pom.xml

4. Post Method Example

  • Validate Response Code
  • Validate Response Headers
  • Validate Response Body
  • Validate 401 unauthorized response


Java Logic

Conclusion:
Validated Response Code
Validated Response Headers
Validated Response Body
Validated 401 unauthorized response

REST ASSURED HTTP POST METHOD RESULTS

REST ASSURED HTTP POST METHOD RESULTS

Automate Coronavirus COVID19 REST API GET METHOD Tutorial Part1




1. Understanding REST & REST Assured API

REST stands for Representational State Transfer mainly uses the http protocol to exchange messages
between client and server using different methods such as GET,POST,PUT,DELETE.

Example :
COVID19 API Website Details
COVID19 API Details

Request Details::

  • REST API EndPoint: https://api.covid19api.com/
  • Method Type: GET
  • Request Headers:
    authority: api.covid19api.com
  • Query Params:

    https://getAllEmployees&empID=1

Response Details::

  • Response Code:200
  • Response Headers:content-type: application/json; charset=UTF-8
  • Response Body:{“allRoute”:{“Name”:”Get All Data”}}

2. Design Test-cases

Rest API Testcases

3. Pre-requisites for Automation REST Services:

com.jayway is a older version
io.restassured is the latest version
Eclipse
Maven project
pom.xml
io.restassured dependency
groupId: io.rest-assured
artifactId: rest-assured
version: 4.3.0

TESTNG – validate the test results

4. Get Method example
RestAssured

  • Response Code Validation
  • Response Headers Validation
  • Response Body Validation

Java Logic

Conclusion:
Validated Response Code
Validated Response Headers
Validated Response Body

REST API Results

COVID19 REST API Results

HTML Examples

      No Comments on HTML Examples


Sign In to view your account details.

SELENIUM
QTP
LOAD RUNNER
JMETER

Listbox Example



JAVA BASICS

SELENIUM BASICS AND ADVANCED TOPICS
SAMPLE QUIZZES