Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to use regular expressions with TestNG?
We use regular expressions in TestNG to work with a group of test methods that are named with a certain pattern.ExampleTestng xml file. All the test methods with starting name Payment will be excluded from the regression suite.Example@Test public void PaymentHistory(){ System.out.println("Payment history validation is successful”); } @Test public void Login(){ System.out.println("Login is successful”); } @Test public void PaymentDefault(){ System.out.println("Payment default verification is successful”); }Login() will be executed, but all the methods starting with name Payment will be excluded from execution. This is achieved using regular expression(Payment.*).
Read MoreHow to set priority to the test cases in TestNG?
We can set priority for test cases in order of their execution, by giving priority to each test method. A test method having lower priority runs first then the test methods with higher priority are executed.Example@Test (priority = 1) public void verifyTravel(){ System.out.println("Travel history successful "); } @Test (priority = 2) public verifyIncome(){ System.out.println ("Income history successful"); }In the Java class file, verifyTravel() will run first followed by verifyIncome().
Read MoreHow can a particular group of test cases get executed in TestNG?
We can run a particular set of test cases by including a group of test cases in the execution.ExampleTestng xml files with groups. To run a group of test cases from the set of test cases, we have to define in the testng xml file. Here the testNG xml contains group Smoke to be included in execution.Example@Test(groups={"Smoke"}) public void Payment(){ System.out.println(“Payment is successful”); }In the Java class file only the test method with group as Smoke will be run out of the entire regression suite.
Read MoreHow to overlook a particular test method from execution in TestNG?
To overlook a particular test method from execution in TestNG enabled helper attribute is used. This attribute has to be set to false to overlook a test method from execution.ExampleJava class file.@Test(enabled=false) public void verifyRepay(){ System.out.println("Repayment successful"); } @Test public void Login(){ System.out.println("Login is successful "); } @Test public verifyHistory(){ System.out.println ("History verification is successful"); }Here the verifyRepay() method shall be overlooked during execution.
Read MoreHow does the execution of a particular test method depend on other test\\nmethods in TestNG?
The execution of a particular test method can be made dependent on another test method with the help of dependsOnMethods helper attribute.Example@Test(dependsOnMethods={"Payment"}) public void verifyLoan(){ System.out.println("Loan payment successful"); } @Test public void Payment(){ System.out.println("Payment successful "); } @Test public verifyTransaction(){ System.out.println ("Transaction verification"); }Here in the Java class file, verifyLoan() method will only be executed after the Payment() method is run successfully. But verifyTransaction() method runs independently without having a precondition test method to be executed.
Read MoreWhat is the purpose of the testng.xml file?
The testng.xml file has the numerous uses as listed below −Test cases are executed in groups.Test methods can be included or excluded in the execution.The execution of multiple test cases from multiple java class files can be triggered.Comprises names of the folder, class, method.Capable of triggering parallel execution.Test methods belonging to groups can be included or excluded in the execution.ExampleTestNG.xml file Here as per the xml file, ...
Read MoreExplain modular automation framework.
In a modular automation framework, test scripts are developed on the basis of modules or clusters by dividing the entire application into several small and self-sufficient blocks. Thus individual test scripts belonging to a particular module or cluster are created.These scripts belonging to these isolated modules can be integrated and can be driven by a master driver script to perform integration testing among the modules. All these are achieved with the help of common function libraries (containing essential methods and procedures) which are used while developing scripts for the modules.Modular automation framework follows the concept of Abstraction. Here in this ...
Read MoreExplain Behavior Driven Framework.
Behavior driven framework takes the inputs from all the stakeholders in the project like the developers, testers, product owners, managers, customers and business analysts. The idea is to bring each of the members of the project in the same understanding.Behavior driven framework works on collaboration and coordination among everyone in the team. Technical coding knowledge is not necessary since the functional requirements or specifications are described in non – technical, common language.This specification can be used as a standard template for the testers while designing the test cases by both automation and manual testers. Test coverage for each business scenario ...
Read MoreState differences between Data Driven and Keyword Driven Framework.
The differences between Data Driven and Keyword Driven framework are described below.In data driven testing, we can run our tests on multiple data in multiple combinations with the help of parameterization. Here the data is treated as an input to the test script logic. Each data set can be treated as a separate test case.In keyword driven testing, the keywords that are developed represent an action. A list of keywords maintained in sequence form a test case. Thus a keyword once developed can be used in multiple test scripts.The data driven framework revolves around the data (maintained in excel, csv ...
Read MoreExplain Keyword driven framework.
Keyword driven framework is also known as table driven framework. Here we have a table where we describe the keywords or actions for the methods that have to be executed.Automation test scripts are developed based on the keywords or actions mentioned in excel. The automation testers need to extend the framework capabilities by updating or building newer keywords.People working on manual testing with lesser programming knowledge can use this framework. The main idea is to identify the keywords or actions and utilize them in excel maintained for that particular test scenario. Often this excel sheet becomes a substitute for a ...
Read More