Software Testing Articles

Page 27 of 31

How to run precondition and postcondition test methods in Cucumber?

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

We can run precondition and postcondition test methods with the help of @Before and @After hooks in Cucumber.ExampleFeature file.Feature: Transaction Table Scenario: Verify the monthly transactions Given User is on the Payment PageStep Definition has methods with hooks @Before and @After. The test method with hook @Before will be executed as a precondition then the test method (naviagteToPayment() method) will run and finally the test method with hook @After which is the postcondition will execute.Example@Before public void method1(){    System.out.println("The precondition executed successfully"); } @After public void method2(){    System.out.println("The postcondition executed successfully "); } @Given ("^User is on payment ...

Read More

How to include and exclude test methods from a set of test cases in\\nCucumber?

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

We can include and exclude test methods from a set of test cases in Cucumber by tagging scenarios in the feature file.ExampleFeature file.@Tutorialspoint Testing Feature: Login Feature Testing @Smoke Scenario: Home Page Testing Given User is in home page @CodingModule Scenario: Coding Module Testing Given User is in Coding Module PageThe test runner file has tags Smoke to be excluded and CodingModule to be included in the execution.Exampleimport org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @RunWith(Cucumber.class) @CucumberOptions(    features = “src/test/java/features”,    glue = “stepDefiniations”    tags = {“~@Smoke”, “@CodingModule”} )

Read More

How to skip a particular test method from execution in Cucumber?

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

We can skip a particular test method from execution in Cucumber with the help of tagging of scenarios in the feature file.Examplefeature file.@Regression Feature: Invoice Testing @Smoke Scenario: Login Verification Given User is in Home Page @Payment Scenario: Payment Testing Given User is in Payment PageFeature file with scenarios having tags Smoke and Payment.Exampleimport org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @RunWith(Cucumber.class) @CucumberOptions(    features = “src/test/java/features”,    glue = “stepDefiniations”    tags = { “~@Payment”} )To skip the scenarios with @Payment , ~ is placed before the @Payment tag in Test Runner file.

Read More

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 does the execution of a particular test method depend on other test\\nmethods in TestNG?

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

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 More

List down the differences between Selenium and UTP.

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

The differences between Selenium and UTP are listed down below.sl.no.SeleniumUTP1It is open source and can be used free.It is a licensed tool and is commercialized for use.2It supports the majority of browsers like Chrome, Firefox, Internet Explorer, Safari and so on.It supports Chrome, Firefox and Internet Explorer.3It only tests web based applications.It tests both windows and web based applications.4There is no in built object Repository.By default, object repositories are available and maintained.5It can be developed on multiple languages like Java, C#, Javascript, Python and so on.It can be developed only on VB scripts.6There is no external support for vendors for ...

Read More

How to deal with reusable components in Selenium Java?

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

We can deal with reusable components in Selenium Java with the help of inheritance concept. It is a parent child relationship where the child class inherits the properties and methods of the parent class.ExampleFor Parent class.import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Baseclass {    public void login() throws IOException {       Properties prop = new Properties();       //Reading values from property file       FileInputStream ips = new FileInputStream(       "C:\Users\ghs6kor\eclipse- workspace\Inheritance\config.properties");       prop.load(ips);       System.setProperty("webdriver.gecko.driver",       ...

Read More

How to handle proxy in Selenium in Java?

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

We can handle proxy in Selenium in Java with the help of PROXY class.import java.io.IOException; import org.openqa.selenium.Proxy; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; public class ProxySelJav {    public static void main(String[] args) {       // TODO Auto-generated method stub       WebDriver driver;       String prox = "localhost:8080";       // set browser settings with Desired Capabilities       Proxy p = new Proxy(); p.setHttpProxy(prox).setFtpProxy(prox).setSslProxy(prox)       .setSocksProxy(prox);       DesiredCapabilities c = new DesiredCapabilities();       c.setCapability(CapabilityType.PROXY, p);       // utilize capabilities on launching ...

Read More
Showing 261–270 of 309 articles
« Prev 1 25 26 27 28 29 31 Next »
Advertisements