Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 55 of 59

How to set the order of execution for test methods in Cucumber?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 5K+ Views

We can set the order of execution for test methods in Cucumber with the help of order keyword. Test methods are assigned with order in the step definition file.The test method with lower order executes first followed by the methods with higher orders.ExampleStep definition file.@Before (order = 1) public void login(){    System.out.println("login is successful"); } @Before (order = 2) public void payment(){    System.out.println("payment is successful"); } @Given ("^Land in repayment page$") public void repay(){    System.out.println ("Actual Scenario of repayment"); }The test method with lower order (login() set to 1) will be executed first. Then payment () test ...

Read More

What are the main file components in Cucumber?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 1K+ Views

The main file components in Cucumber are listed below −Feature file − This file has an extension of .feature. It comprises single or multiple test scenarios in plain text. All the scenarios are written with the keywords like Then, Given, When, And, But, Feature, Background and so on.ExampleFeature file.Feature: Login Test Scenario: Tutorialspoint login validation Given: Launch the “https://www.tutorialspoint.com/index.htm”Step Definition File - This file has an extension of .java. It provides mapping of the test scenarios to the test script logic.ExampleStep Definition file based on the above feature file.@Given (“^Launch the "([^"]*)"$”) public void launch_application(String url){    System.out.println("The url is ...

Read More

What are the advantages of using Cucumber?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 2K+ Views

Some of the advantages of using Cucumber are listed below −Cucumber is an open source tool and does not require licensing.Cucumber can be easily configured with IDEs like Eclipse.Cucumber bridges the understanding and communication gaps among developers, testers, business analysts, customers and product owners.Cucumber enables the participation of business stakeholders who do not have technical knowhow.Cucumber gives plain text representation which enables easy understanding for non-technical members in the team.Cucumber is easy to maintain and is scalable.Cucumber increases the reusability of important steps.Cucumber promotes teamwork since each individual in the team can contribute.Cucumber uses the Gherkin tool which is simple ...

Read More

How to combine multiple groups to single Test in TestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 2K+ Views

We can combine multiple groups to single Test in TestNG with the help of test group feature.ExampleTestng xml files with groups.                                                                                                           To run a group of test cases from the collection of test cases, we have to define in the testng xml file. Here the testNG xml contains multiple groups QuestionAnswer and Jobs to be associated to a single Test.Example@Test(groups={"QuestionAnswer"},{"Jobs"}) public void preparation(){    System.out.println("Preparation module is verified"); }In the Java class file the test methods with group as QuestionAnswer and Jobs are associated with the test method preparation().

Read More

What do you mean by Listeners in TestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 768 Views

TestNG Listeners have the capacity to listen to a specific incident. It is basically an interface that changes the nature of the system. TestNG Listeners are used for logging purposes and creating reports.There are two Listeners in Selenium. They are listed below −TestNG Listeners.WebDriver Listeners.TestNG can be configured with the Listeners which can change the default behavior of the TestNG. TestNG Listeners are known as iTestListener (a TestNG interface). A java class implements the iTestListeners and at the same time overrides its methods. Each of these methods trigger an event.The functions of TestNG listeners are listed below.iSuiteListener − This consists ...

Read More

What do you mean by timeOut in TestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 3K+ Views

The timeOut is a helper attribute in TestNG that can put an end to the execution of a test method if that method takes time beyond the timeOut duration. A timeOut time is set in milliseconds, after that the test method will be marked Failed.Example@Test public void ContactVerify(){    System.out.println("Contact validation is successful”); } @Test(timeOut = 1000) public void LandingPage(){    System.out.println("Landing page verification is successful”); } @Test public void LoanContact(){    System.out.println("Loan contact details verification is successful”); }After 1000ms, if LandingPage() execution continues , that test method will be considered as failed. The rest of the test methods will ...

Read More

How to incorporate and remove test methods from execution from ancollection of test cases in TestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 416 Views

We can incorporate and remove test methods from execution with the help of tags in testng xml file.ExampleTestng xml file.                                                                                       The testNG xml has groups Smoke to be included and CodingModule to be excluded from the execution.Example@Test(groups={"Smoke"}) public void ContactDetails(){    System.out.println(“Contact details verification is successful”); } @Test(groups={"CodingModule"}) ...

Read More

How to execute a particular test method multiple times (say 5 times) innTestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 625 Views

We can execute a particular test method multiple times (say 5 times) with the help of the invocationCount helper attribute.Example@Test public void PaymentDetails(){    System.out.println("Payment details validation is successful”); } @Test(invocationCount=5) public void LoginAdmin(){    System.out.println("Login in admin is successful”); } @Test public void LeaseDetails(){    System.out.println("Lease details verification is successful”); }In the Java class file, the LoginAdmin() method with invocationCount set to 5 will result in Login in admin is a successful message to be printed five times on the console.

Read More

How will you run a prerequisite method and post condition method fornevery test in TestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 380 Views

We can run a prerequisite method and post condition method for every test in TestNG with the help of @BeforeMethod and @AfterMethod annotations.Example@BeforeMethod public void prerequisite(){    System.out.println("Run before every tests"); } @AfterMethod public void postcondition(){    System.out.println("Run after every tests "); } @Test public void loanPay(){    System.out.println("Loan pay is successful"); }In the Java class file, the prerequisite() method with @BeforeMethod will be executed which is known as the precondition for every test method. Then loanPay() will be executed and finally the postcondition() method with @AfterMethod will run.

Read More

How to use regular expressions with TestNG?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 1K+ Views

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 More
Showing 541–550 of 590 articles
« Prev 1 53 54 55 56 57 59 Next »
Advertisements