Xpath Merged
Xpath Merged
It’s one of the locators in Webdriver tool, which is used to navigate to entire html
document & identify the object based on web element attribute & visible text [inner
text]
Xpath Symbols:
@ → attribute symbol
Xpath Keywords:
Xpath Functions:
Text ()
Contains ()
Normalize-space ()
Last ()
Xpath Axes:
- //*[@attribute='value']/parent::tag
- //*[@attribute='value']/child::tag
- //*[@attribute='value']/descendant::tag
- //*[@attribute='value']/following::tag
- //*[@attribute='value']/following-sibling::tag
- //*[@attribute='value']/preceding::tag
- //*[@attribute='value']/preceding-sibling::tag
Types of Xpath:
1. Absolute xpath
2. Relative Xpath
✓ when object not able to find the element using one attribute, we can go for
multiple attributes using and keyword.
✓ Syntax: //htmlTag [@attribute1=’value’ and @attribute2=’value’].
✓ Example: //input [@name='ck' and @type='checkbox'].
✓ If the text is written between start & end Tag is called Visible Text.
✓ text() is used to identify the object using visible text of the element.
✓ text() cannot identify dynamic text(the text which is changing dynamically).
✓ text() cannot identify the object using part of the string , because its complete
string matching function.
✓ it cannot ignore the space before & after the string.
✓ text() function navigate to html document & try to identify expected visible
text.
✓ in GUI, & return true if expected completely matches with UI text
✓ Syntax: //htmltag[text()='ExpectedValue']
//htmltag[.='ExpectedValue']
✓ Example: //h1[text()='Welcome']
✓ using normalize-space function we can ignore the space before & after the
String or attribute.
✓ Syntax: //htmlTag[normalize-space(text()/@attribute) = ‘expected
value’]
✓ Example: //h1[normalize-space(text())=’we have product’]
✓ When object not able to identify using multiple attributes, in such cases will
take reference of parent / grandparent htmlTag to identify the object
uniquely.
✓ Syntax: //parentHTmlTag[@att=’value’]/childHtmlTag[@att=’value’]
✓ Example: //div[@class='samsung']/input[@value='Add to cart']
/descendant::span[@class='a-price']/span[@class='a-offscreen']
✓ Svg elements are vector elements like graphical elements - circle, chrome
symbol firefox symbol where normal xpath format will not work
✓ Synatx for writing <svg> tags
//*[local-name()='svg']
//*[local-name()='svg']/ancestor::li[@class='sc-twitter']
JDBC:
1. What are the steps to connect to database?
2. Explain JDBC architecture/Class diagram of JDBC?
3. What is real time usage of Finally block?
4. What are the advantages of JDBC?
JDBC helps to connect any database from java program
JDBC helps to automate preconditions
JDBC helps to automate end to end scenarios
JDBC helps for partial backend automation
JDBC helps for database related validations
5. Why JDBC is required for Developers?
Any Application should have its physical database to store the data
Developers use JDBC to communicate with the database
If java program has to connect with dB, then JDBC is like a bridge.
6. What is the use of JDBC for automation testers?
JDBC is required to automate the pre conditions
Scenario: Test Scenario says we have to transfer 10000 rupees from account A
to account B. Pre-condition for above scenario is 10000 rupees should be preset in
account A.
If we know JDBC, we can connect to database via program and automate the
pre-condition also, this increases the number of automatable test cases.
JDBC is required to automate End to end Scenarios.
Scenario: Test scenario says we have to add the product to the cart and verify if
the product is successfully added in the cart table of database. If we know JDBC,
we can connect to database via program and execute a select query and validate if
the data is present or not. This increases number of automatable scenarios.
MySqlDBcommands
Scenario 1:
Login to App
Navigate to Organizations
Create new Organization with mandatory details
Save and logout
Scenario 2:
Login to App
Navigate to Contacts
Create new contact with mandatory details
Save and logout
Scenario 3:
Login to Vtiger App
Navigate to Organizations link
Create organization with mandatory fields
Choose Healthcare in the Industry dropdown
save and logout.
Scenario 4:
Login to App
Navigate to Organizations
Create Organization with mandatory fields
Choose Electronics in industry drop down
Choose Investor in Type drop down
save and logout
Scenario 5:
Login to App
Navigate to Contacts
Create Contact with mandatory fields
Choose any existing organization
save and logout
Data Driven Testing: Automation rule says never hard code any data Store the
required data in any external resources and read that in the test script.
Common Data: data which is common to all the test scripts like URL, username,
password, browser name.
Property File is more preferred
Property File is light weight
property file stores the data in key value pair
Easy to read the data
Disadvantage: Not organized hence its preferred only for small amount of data
Test Data: data which is specific to only to the test case like
Create Organization -- Organization name
Create Contact -- Contact name
Create Contact with Organization -- Contact Name and Organization name
To store test data, we prefer Excel sheet.
excel sheet stores data in the form of rows and columns.
Data is stored in a well-organized way so that data retrieval becomes easy.
Data maintenance is easy.
Disadvantage is Excel sheet is slow compared to property File.
Generic Library/Generic Utility/Generic Utils
✓ Automation rule says never hardcode and web element and its locator,
instead fetch it from an external resource.
✓ Object repository is a dedicated place to store all the web elements and their
locators.
✓ Object Repository can be designed with excel sheet, property file, Json File
and POM Class.
✓ Most preferred way of developing object Repository is POM Classes.
✓ Object Repository is stored in src/main/java.
What is POM?
Why POM?
✓ It’s a Java design pattern, Java classes are created and utilized, hence no
external libraries are required.
✓ elements are directly available with the objects.
✓ POM is a perfect fit for Agile.
✓ POM will handle staleElementReference Exception.
Rules of creating POM Class
✓ Create a separate java class for a web page- class name should be same as
page name.
✓ Identify all the web elements present in a particular page with @FindBy,
@FindAll and @FindBys, and make it as private web element (Element
declaration)
✓ Initialize these web elements with a constructor and use
PageFactory.initElemnts(driver, this);(Element initialization)
✓ Provide getters to access these Elements - Encapsulation (Element
utilization)
✓ Provide business library to optimize the test script.
✓ POM will identify the web elements with annotations like @findby,
@findBys and @findAll instead of driver. FindElement ()/driver.
findElements ().
✓ And all the web elements identified will be initialized to driver current
reference with pagefactory. initElemnts(driver, this) or this.driver =
driver.
@Findby:
@FindAll
Auto healing means: whenever the selenium fails to identify a particular element
with one locator, it will automatically retry the identification with other loactors.
hence @FindAll will provide Autohealing for test scripts.
@FindBys
Advantages of POM
6. Code reusability.
What? - reading the data from any external resources or using data provider is
called as data driven Framework. In Data driven framework, Data is the driving
factor.
Why? Automation rule says never hardcode the data, read it from external
resources.
When? whenever the test data is huge compared to test scenarios, we prefer
data driven framework.
When? Whenever the application is very huge and has lot of modules, maintaining
all the modules together will be difficult, hence we prefer modular driven
framework.
When? Whenever the application contains more repeated functionalities like too
many dropdowns too many frames, more windows, we prefer to write generic
method and use them multiple times.
What? Creating a keyword library and utilizing these keywords to develop the
test script is called as keyword driven framework, here keywords are the driving
factors for framework.
Why? Some applications will have huge Data and also more number modules, so
we have combined feature of two framework to make the Framework user friendly.
When? - Whenever the application demands to use more than one framework we
use Hybrid by Combining the features of multiple frameworks.
Examples - All long Term projects like Ecommerce, CRM, ERP, SCM .
Advantages of Framework:
Disadvantages of Framework:
Choice of Framework: In this Phase is based on CRS, technical leads, BA, PO,
automation Consultants will decide which type of framework should be chosen
then that framework design phase will start.
Framework design: In this phase framework developer will design the framework
which contain common utility like generic libraries, test data template, POM
classes with partial elements. This phase is executed in Sprint-1 or Release-1.
Questions:
1. Explain Framework
TestNg
JUnit - Java
NUnit - .Net
PyTest/PyDev - Python
Rspsc - ruby
Jasmine/mocha - Javascript
Developers use TestNG as a Unit Testing Tool, where a test script is written to
test the source code of the application.
Automation Testers use TestNG as a Unit Testing Framework for developing the
test scripts from manual test cases and executing them.
@Test
@BeforeMethod
@AfterMethod
@BeforeClass
@AfterClass
@BeforeSuite
@AfterSuite
@BeforeTest
@AfterTest
@DataProvider
@Listnener
@Parameters
Annotation:
java template
@
meta data/ information to JVM
No need to call
@Test:
It’s a basic TestNG annotation which is responsible for all the executions.
@Test acts like a main method for the JVM to start the execution.
The return type of @Test annotation method is always void and access
specifier is always public.
@Test
We can have any number of @Test annotations inside a single Test class.
Every @Test annotation is individual test script.
Test class which consists of @Test annotations should be always written in
src/test/java in any package.
Test class name should be always module name ending with Test.
Test Method name should always be manual test case name with Test.
In general, a Test class contains 15+ @Test annotations/Test Method.
Default execution order of all the @Test annotations in a test class is
alphabetical/ASCII.
To Change the order of execution manually: Priority
To run the same test script more than one Time: InvocationCount
//Assert.fail();
System.out.println("customer created");//passed
} //failed
//Assert.fail();
System.out.println("customer modified");
Assert.fail();
System.out.println("customer deleted");
Data provider is an annotation which will load multiple data for every
execution.
Total number of test runs = Total number of data present in Data
provider.
Test class can have multiple @DataProviders but @Test can read only one
dataprovider at once.
return type of @dataProvider annotation method is always Object [][].
@Test (dataProvider = "phoneData") //-- read the data of data provider in test
script
public void addPhonesToCartTest (String name, int price)// store the data
in variables
@DataProvider (name = "phoneData") //--- create data provider and load the
values
data[0][1] = 12000;
data[1][0] ="Iphone";
data[1][1] =5000;
data[2][0] = "Vivo";
data[2][1] = 1000;
return data;
data[0][1] = 12000;
data[1][0] ="Iphone";
data[1][1] =5000;
data[2][0] = "Vivo";
data[2][1] = 1000;
return data;
1.Add products into the cart - scenario is adding the product to the cart but we’ll
have Thousands of products to be added, here we have to execute this scenario as
many times as we have products. Hence data provider is a good option.
@Test: Acts like a main method, which is identified by JVM to start the execution.
@BeforeSuite:
@AfterSuite:
It is executed after the closing of suite tag </suite> in suite xml file.
It is executed only once per execution as there will be only one </suite>.
It is used for closing database connection.
@BeforeTest:
@AfterTest:
It is executed after the closing of test tag </Test> in suite xml file.
The number of times it will execute depends on number </Test> tags.
This is mostly used for parallel executions as it creates multiple threads.
@BeforeClass:
It will execute before opening of every class <class> in suite xml file or
simply we can tell before every test class.
The number of times it will execute depends on the number of <Class> or
Test class.
It is used for launching browser.
@AfterClass:
It will execute after closing of every class </Class> in suite xml file or
simply we can tell after every test class.
The number of times it will execute depends on the number of </Class> or
Test class.
It is used for closing browser.
@BeforeMethod:
BaseClass:
Advantages of BaseClass:
Code re usability.
Test script is optimized.
No need to invest time on unwanted actions.
Test script development is faster.
Code maintenance and modification is easy.
Debugging process is easy.
TestNG Executions
Execution: Once the test scripts are developed, they have to be executed to check
NOTE: For every new feature/build, we will execute the recent/old Framework
to check the regression issues.
Batch Execution:
packageName.Classname<classname="vtiger.ContactsTests.CreateContactWit
hOrgTest"/>
Group Execution:
Executing the similar kind of test script under a group ex: smokeSuite,
RegressionSuite.
All type test script belongs either to smoke suite or to Regression suite
To achieve group execution, Every @Test should be included in the group
1. @Test
2. Base Class
<Suite>
<groups>
<run>
<include name="SmokeSuite"></include>
</run>
</groups>
<classes>
<classname="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
</classes>
Smoke Suite:
Smoke suite consists of all the test scripts which are identified as smoke
scenarios/test script related to critical features.
<groups>
<run>
<include name="SmokeSuite"></include>
</run>
</groups>
Regression Suite:
All the test scripts which are considered as impacted scenarios are grouped under
Regression suite. This will be updated for every build dependending on impacted
areas. Usually, Developers will tell the areas which are impacted.
<groups>
<run>
<include name="RegressionSuite"></include>
</run>
</groups>
<suite name="Suite">
<classes>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest">
<methods>
<include name="demoRegregression"></include>
</methods>
</class>
</classes>
Parallel executions
<classes>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
</classes>
<classes>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
</classes>
@BeforeTest and @AfterTest can be used to launch the browser and close
the browser.
Instead of @BeforeClass and @AfterClass if launching browser action is
needed at <test> in the suite xml file like:
@BeforeTest
//@BeforeClass(groups = {"SmokeSuite","RegressionSuite"})
Cross browser execution means executing the same set of test scripts in
multiple browsers to ensure they are compatible.
In cross browser execution, same set of test scripts are executed over
different browsers in different threads.
Different Threads - Different Browsers - same set of Test scripts.
Since during run time we have to choose the browser for execution, we have
provide browser name from suite xml file instead of property file.
<Parameter> is used to set the name and value which will pass this data to
@Parameter annotation in base class.
<classes>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
</classes>
<classes>
<class name="vtiger.ContactsTests.CreateContactWithOrgTest"/>
<class name="vtiger.ContactsTests.CreateContactWithMandatoryFieldsTest"/>
</classes>
In BaseClass:
@Parameters("BROWSER")
@BeforeTest
//@BeforeClass(groups = {"SmokeSuite","RegressionSuite"})
if(BROWSER.equalsIgnoreCase("CHROME"))
WebDriverManager.chromedriver().setup();
How do you read data from suite xml file to your test script?
Assertions
So, no failure will occur and since in any case either If or Else is getting
executed, further lines in the test script will be executed. Hence this
validation is not recommended.
Hard Assert:
Assert.assertTrue();
Assert.assertFalse();
Assert.assertEquals();
Assert.assertNotEquals();
Assert.assertNull();
Assert.assertNotNull();
Assert.fail(): These are the few methods present in Assert Class.
Hard assert will stop the execution of further lines if the assertion is failed.
Whenever hard assert test script fail, hard assert will generate Assertion
Error Exception along with line number of failure and error message and it
will stop the current test script execution and continue other test scripts in
the same test class.
Whole test script gets failed if one hard assert is failed.
Hence Hard assert is used to validate mandatory fields in the test script.
Soft Assert:
Class name is SoftAssert.
All the methods present here are non-static methods hence accessed by
creating object.
Soft assert will not stop the execution of further lines if the assertion is
failed.
Whenever soft assert test script fail, soft assert will generate AssertionError
Exeception along with line number of failure and error message and it will
continue the current test script execution.
assertAll () is a special method which will sum up the status of all soft
asserts used in the entire test script and provide it in console at the end.
if assertAll () is not used at the end of all soft assert statements, no failures
will be logged.
Hence Soft assert is used to validate non mandatory fields in the test script.
Interfaces in TestNG
ITestListener:
ITestListener has abstract methods which will capture all the run time events
of a test script like Pass, fail, Skip.
As per the rule Listener Implementation class should implements ITestListener
Interface and should override all the abstract methods present.
@Listeners(vtiger.GenericUtility.ListenerImplementation.class) - will
communicate with ListenerImplementation class and monitor the test script.
ITestResult:
It is an interface available in TestNG and it is used as an argument for every
abstract method in Listener implementation class which will capture the pass/fail
status of the current test script during run time.
IRetryAnalyser
Its an interface present in TestNG, which will help us re run the failed test
script.
For these kind of situation we will manually analyse it, make sure there is no
script issue or its not a bug, then we try to rerun for couple of times, if passed
only then for the next execution we will implement retry anaylser.
@Test(retryAnalyzer = vtiger.GenericUtility.RetryAnalyserImplementation.class)
Questions:
Yes. we have to provide listeners for every class because each class should be
monitored
@Listeners(vtiger.GenericUtility.ListenerImplementation.class)
<listeners>
<listener class-
name="vtiger.GenericUtility.ListenerImplementation"></listener>
</listeners>
2. Should we provide retry analyser for every @Test?
No. we have to first analyse the failed test scripts, if we found they are passed
after couple runs, we should decide retry count and only for those test scripts we
will implement retry analyser.
@Test(retryAnalyzer = vtiger.GenericUtility.RetryAnalyserImplementation.class)
3. Why Listeners?
Listeners is a feature in TestNG used to monitor the run time every of a test script
and based on the events, we can perform necessary actions with abstract methods
of ITestListerner interface.
1. We can capture run time events
Screen shots act as a proof to the developer for rising the defect/bug.
It can be shared across with developer and other tester for easy
communication of the issue.
5. Out of 1000 test script, 200 test scripts got failed. How do you re run only
the failed test scripts?
This suite xml file will consists of failed test scripts in the current execution and it
is auto updated. if we run this suite xml file, all the failed script in current
execution will run.
6. Out of 1000 test script, 200 test scripts got failed. What is your approach?
re run the failed test scripts to analyse the issue like wat is the exception line
no.
put break point and run the individual test script in debug mode.
Reports are a very important part of Framework because they act like proof for
all the execution done by automation tester.
Usually after every execution reports will be sent to high offs like product
Owner,Automation Leads, Technical consultants and customers.
High Level Reports: TestNG supports HTML report which provides basic
information like
Low Level Reports: These specify the log level analysis,In TestNg we have
"Reporter.log();"
- WARNING - warning
- ERROR - issue
- FATAL - issue
Non customisable.
ExtentReports: its a main class which will set system information to the report
Its also called as Build management Tool, Build testing Tool, Build Dependency
Tool,Maven is Tool used which has become popular for the build management
instead ANT and GRADLE.
Various Maven commands are used for these build related actions like
Build Creation process: Process of converting the source code into any
executable format “mvn package” is the maven command used.
When Multiple automation testers are working with same framework, there
might be chances that the changes made by one Automation engineering might
affect the entire framework, in order to over come this issue we run the Maven
life cycle for every build mvn clean, mvn validate, mvn compile, mvn test
are the maven command used.
Softwares in Maven:
Maven Eclipse Plugin: This is inbuilt plugin available when in eclipse. It helps to
create Maven project and provides folder structure as
src/main/java
GenericUtilities
ObjectRepository
src/main/resources
ChromeDriver.exe
FirefoxDriver.exe
IEDriver.exe
src/test/java
autodesk.OrganizationsTests
autodesk.ContactsTests
src/test/resources
commonData.properties
TestData.xlsx
pom.xml
Dependencies
plugins
pom.xml:
If pom.xml is corrupted, then we have to discard the entire project and create
another.
Dependencies in Maven
Dependency is advance feature in maven which is used to get all the required
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
This is a Maven software which helps us to run the maven project without
eclipse.
we have to download Maven to local system and set the environment variables.
mvn clean:Its a maven command used to clean all the old reports from target
folder.
mvn validate:Its a maven command used to check if all the necessary jar are
downloaded for all the dependencies added, if not it will automatically download.
mvn compile: Its maven command to will check the compilation issues in the
framework.
mvn test: Its a maven command which will identify all the test classes whose
class name end with "test" and execute them.
1. Go to the current project location where pom.xml file is present in your local
system.
D:\MavenProjects\Com.ERP.Resource>
mvn test:
At class level, if no testNg.xml file is there,All the classes in the project whose
name end with "test" will get executed
D:\MavenProjects\Com.ERP.Resource>mvn test
At Suite Level,
D:\MavenProjects\Com.ERP.Resource>mvn test
It will navigate to project location compare all the test class name with the
name given in the command if its matching it will execute.
Here -D stands for data , if we want pass any data through maven command
we use -D.
-Dtest=OrganizationTest,ContactTest
when a test class consists of multiple test methods/@Test and we have run
particular test method then we make use of # and specify the method name
-Dtest=ClassName#methodName.
When we get a situation to provide run time parameters, then we have to use
Maven parameters as -Dkey=value format.
ex: we can pass the browser name and url through cmd line as
-Dbrowser=Chrome -Durl=http://localhost:8888
Using maven parameters we can pass any data during the run time.
When ever we want to provide run time parameters through eclipse we use vm
arguments in run configurations.
Right click on test script -> run As -> Run configurations -> Arguments -> VM
arguments type the below command.
-Dbrowser=Chrome -Durl=http://localhost:8888
Through cmd line we can provide runtime parameters using below cmd:
D:\MavenProjects\Com.ERP.Resource>mvn-Dbrowser=Chrome
Durl=http://testEnv.com-Dusername=admin-
Dtest=ReadDataFromCmdLineTest test.
Question:
1. How do you read data from cmd line to your test script?
what ever data we want to provide like browser name, username, password
url etc
Sometimes we can get a situation where the customer would want to execute
the test script with different browser, or in different environment or with
different credentials, so since customer cannot go and make changes in the
framework, we provide an option in the framework to accept run time
parameters so that we can pass the data using maven parameters through
cmd Line.
To run any TestNG.xml file (suite xml file) through pom.xml: Surefire Plugin.
In reality we will be having various suite xml files for every execution type like
So we cannot run the test scripts class wise, we have to run the test script
based on suite xml files.
Also by mistake if any class name is not ending with "test", then maven will
not identify it as a test class and do not include it in "mvn test".
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<suiteXmlFile>testng_SmokeSuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
To run specific suite xml file when there are multiple suite xml file: Maven
Profiling
Hence we will create a separate profile for every suite xml file in pom.xml and
in maven cmd we will call the specific profile by its profile id.
maven cmd is :
Sample profiles:
<profiles>
<profile>
<id>Smoke</id> <!-- This is profile id -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng_SmokeSuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>Fail</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng-failed.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Maven command to run Smoke profile
NOTE: A separate profile for testNg-Failed.xml file will also be created to run only
Advantages of MAVEN
Check the integration & compilation issue between the framework component
whenever multiple engineer working with same framework, their might be
possibilities one engineer modification, addition & deletion Might affect the
entire build.
Create framework configuration quick setup for new engineers (because all the
required dependencies jar. Versions declared in POM.xml, you just to get the
framework from the GIT & save the POM file.
Maven also support Profiling (we can have multiple testing.xml file in one
Project,
Questions:
8. Write maven command to execute only one test class through cmd Line.
9. Write maven command to execute only one test method inside a test class
through cmd Line
10. How do you execute suite xml file through cmd line?
11. I have 5 different suite xml files for 5 different execution, i want to decide
which suite file to be executed during runtime, what is your approach.
Questions:
1. Why GitHub?
2. What are different git commands
3. What is branching in GitHub
4. What is difference between git and GitHub?
5. What is pull request?
6. What is difference between merge and rebase?
7. can v pull without import?
8. can v push without commit?
9. Explain GitHub architecture
JENKINS
Jenkins is a CI/CD Tool used by Developers, DevOps and Automation Testers.
Continuous development: continuous monitor the git source code repository &
create a new build if any changes happened in the git source code.
Continuous deployment: get the latest build from git location & deploy the build
in to testing environment.
Continuous Delivery: get the latest build from git location & deploy the build in to
Continuous Integration means checking the integration issues between the old
build and the new feature by executing the old framework. if the test scripts get
failed, then with the failure we will get to know the impact of new feature on the
old build. Hence, we can analyze the failure, debug the failed test scripts, if any
product issues/bugs are found we will rise the defect in Jira, if it’s a test script
issue we will correct it update the framework and re run the framework.
Jenkins Configuration
Login to Jenkins
Dashboard -> Manage Jenkins -> Global Tool Configuration
Set path for jdk, git, Maven.
Login to Jenkins
New Item -> Name of the job -> Choose Maven Project
Provide the git location where the project is stored
Provide schedule to trigger the execution of the job
Root Pom -> specify the pom.xml location inside the project
Goal -> default goal for tester is test.
test -P SmokeSuite
-Dbrowser=Chrome -Dusername=Chaitra test
Provide any post build actions if needed.
Save the job.
Parameters in Jenkins:
Sometimes customer might want to execute the job with different browser or in
different environment, since customer cannot make changes in framework, we
provide choice parameters so that it gives a drop down of different choices given
like different browser names, different environment, customer can easily choose
from drop down and execute the job. No coding knowledge needed to run the job.
scheduling Job in Jenkins:
On Demand
On schedule
Poll SCM
1. On Demand scheduling:
2. On Schedule scheduling:
Specifying the exact time duration of when the execution should start is
called on schedule scheduling.
While configuring the job only we have to provide "build periodically" in
Build Triggers.
Jenkins follow a specific scheduling format.
H 12 * * * -> Here "H" means hash -> specifies "any", "*" specifies
"every"
H/15 * * * *
H (0-29)/10 * * * *
45 9-16/2 * * 1-5
# Once a day on the 1st and 15th of every month except December
H H 1,15 1-11 *
On Schedule does not bother if the framework is updated or not, it will start
the execution immediately in the specified time schedule.
3. Poll SCM:
Poll SCM will detect the changes made in specified git location (SCM- Source
Code management) and it will start the execution on the scheduled time.
Here the schedule will be usually H * * * *
Whenever any changes are detected like new push /commit it will trigger
the job.
When we make any changes in the framework, it has to pushed into git
master repo or if it’s pushed into any branches then it has to be reviewed
and merged into the master.
Usually, Master repo of the framework will be configured with Jenkins and
if any new commit is recognized, Jenkins will start the execution based on
schedule.
Pipelining in Jenkins:
Even though we create pipelining for jobs during job configuration, we have to
check the individual jobs to make sure whether they are executing or not as there
is no view to showcase all the jobs running in pipeline. Hence, we use "Build
Pipeline Plugin" to see pipeline view, where all the jobs which are in pipeline are
visible at once.
Advantages of Jenkins:
b. Email Notification:
- Jenkins sends out an execution Report via email, once execution is completed
- Jenkins also Send Build broken Email, when Compilation issue between the
framework component.
Questions:
3. Schedule a job in Jenkins to run every 4th day of the month at 2pm.
5. Even we want pass run time data in Jenkins, what is your approach.
c. Hybrid Cloud:
It’s a combination of public cloud and private cloud.
examples: Federal agencies
2. Services model:
Defines the type of services which are provided by cloud vendors to the customers.
Types of service Models
a. IAAS (Infrastructure as a Service):
It is a computing infrastructure managed over the internet. The main
advantage of using IaaS is that it helps users to avoid the cost and
complexity of purchasing and managing the physical servers.
Examples: Digital Ocean, Linode, Amazon Web Services (AWS), Microsoft
Azure.
Used By: IT Admins.
SELENIUM GRID:
Selenium grid is a collection of libraries from Selenium RC + Selenium
Webdriver +Selenium Grid Server.
Selenium Grid: It’s an open source available in Selenium community and it
acts like a server for remote execution and Compatibility testing.
Selenium grid is used to perform
• Remote Execution
1. REMOTE EXECUTION: executing the test script in any remote devices like
cloud machines, other computers in the same network, mobile devices like android
or IOS with the help of selenium grid is called as Remote Execution.