Cucumber + Java
Introduction to Cucumber Installation of CucumberAdding Cucumber dependency to Java project Writing first cucumber test Executing Cucumber tests using Cucumber class Cucumber options Tagging the scenarios Using name option Passing parameters to steps Key – Value pair Datatable Multiple column datatable in Cucumber Scenario Background Scenario outline Running multiple feature files in Cucumber Sharing selenium Webdriver instance using PicoContainer Embedding the screenshot Writing to Cucumber HTML reports Cucumber dependency for using Lambda expressions in Java 8 Cucumber test using Lambda expressionsCucumber options
When executing the cucumber scenarios, we can pass various options as mentioned below.- features – path of the features files
- glue – path of the step definition classes
- dry run – used to check that all step definitions are desinged
- monochrome – true/false It controls the readability of the output
- strict – false means that undefined steps are skipped. Test does not fail
- name – used to filter the features and scenarios
- plugin – json, html, junit, pretty
- snippets – Snippet style can be Camel case or Underscore
package org.softpost;
import cucumber.api.CucumberOptions;
import cucumber.api.SnippetType;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "classpath:abc.feature",
glue = "classpath:org.softpost",
tags = "~@blocked",
plugin = "html:target/selenium-reports",
dryRun = false,
monochrome = true,
strict = true,
snippets = SnippetType.CAMELCASE
)
public class MyTests {
}
Web development and Automation testing
solutions delivered!!