Cucumber — Note, Reports, and Pretty Format | Code Factory

Code Factory
1 min readNov 27, 2020

--

Donate : Link

WordPress Blog : Link

Applications… : Link

Cucumber Tutorial Index Page: Link

Note:

  • Each phrase start with “^” so that cucumber understand the start of the step, Similarly each step ends with “$”.
  • We can use regular exprssion to pass different test data. Regular expression take data from the feature steps and pass to step definition.

Reports:

  • Cucumber generates it’s own html format, however better reporting can be done by using Jenkins, Bamboo tools.
  • Cucumber can report results in different formats, using formatter plugins. The available formatter plugins are: Pretty, HTML, Json, progress, usage, Junit.

Pretty Format:

  • Pretty format generates the cucumber test report in html format, i.e. an html file.
  • It is the most reliable report format.
  • It generates the reports in the same way as it is a feature file, so tracing is also very easy.
  • We can specify the location where we want this report to be placed after test execution. It can be
  • — Local directory
  • — Server directory
  • Example
@Runwith(cucumber.class)
@CucumberOptions(format={"pretty", "html:target/Destination"})
  • Specifying pretty as a format option that ensure html report will be generated.
  • When we specify html:target/Destination it will generate html report inside the “Destination” folder in “Target” folder of the maven project.

--

--