Found 871 Articles for Automation Testing

How to include and exclude test methods from a set of test cases inCucumber?

Debomita Bhattacharjee
Updated on 11-Jun-2020 13:12:05

458 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
Updated on 11-Jun-2020 13:10:21

4K+ 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
Updated on 11-Jun-2020 13:07:55

4K+ 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 do you mean by Scenario Outline in Cucumber?

Debomita Bhattacharjee
Updated on 11-Jun-2020 13:06:11

430 Views

We use the Scenario Outline keyword in the feature file in Cucumber. If a particular scenario needs to be executed with more than a set of data in multiple combinations, then we use the Scenario Outline.The multiple data sets are represented in form of a table separated by (||) symbol under Examples keyword. Each row represents a group of data.ExampleFeature file.Feature: Login Verification Feature Scenario Outline: Login Verification Given User lands on the home page When Page title is Tutorialspoint Then User keys in "" and "" Examples: | username | password | | Selenium | t123 ... Read More

What are the main file components in Cucumber?

Debomita Bhattacharjee
Updated on 11-Jun-2020 13:04:56

728 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
Updated on 11-Jun-2020 13:01:11

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

Explain modular automation framework.

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:22:24

2K+ Views

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 More

How to verify the color and background color of a web element in Selenium?

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:12:43

10K+ Views

We can verify the color and background color of a web element in Selenium with the help of getCSSValue() method.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class CssColorValue {    public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";       driver.get(url);       driver.manage().window().maximize();       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);       //getting color attribute with getCssValue()       String colr = driver.findElement(By.xpath("//*[text()=’GATE Exams’]")) ... Read More

List down the differences between Selenium and UTP.

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:09:22

115 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 verify if an element is displayed on screen in Selenium?

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:07:49

9K+ Views

We can verify the visibility of web elements like edit box, checkbox, radio buttons and so on with the help of method listed bels −isDisplayed()This method checks if a webelement is present on the screen.Syntax −Boolean result = driver.findElement(By.xpath("//span[text()=’Coding Ground’]")).isDispayed();isSelected()This method checks the status of the radio button, check box and options in the static dropdown.Syntax −Boolean btnresult = driver.findElement(By.xpath("//xpath[contains(@class, ’gsc-search-button’)]")).isSelected();isEnabled()Syntax −Boolean btnresult = driver.findElement(By.xpath("//xpath[contains(@class, ’gsc-search-button’)]")).isEnabled();This method if an element is enabled or not.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class ElementStatus{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       ... Read More

Advertisements