Cucumber — JUnit Runner | Code Factory

Cucumber Tutorial Index Page: Link

  • JUnit is a opensource unit testing framework for Java programming language.
  • The reason we are discussing about JUnit in Cucumber framework is, one hand, Cucumber is providing a way of non-technical person to define test cases for a product, and on the other hand, our expectation is smooth & timely execution of such test cases.
  • JUnit acts as a bridge b/w these two. So the flow of execution look likes as follows.
  • — Stakeholders will write down feature files.
  • — Step definition will be created accordingly.
  • — Specify JUnitRunner class to run the series of test cases.
  • — Once we run the JUnitRunner class.
  • — — It will parse the Gherkin feature file.
  • — — It will execute the functions written in step definition file according to feature file statements.
  • — — JUnit will combine test case result.
  • — — It will build the test report in the specified format (HTML/Json)
  • To run specific feature file Cucumber uses standard JUnit runner and specify the tags @CucumberOptions.
  • Multiple tags can be given by comma separate.
  • We can specify the path of the report & type of the report we want to generate.
  • Example
@Runwith(cucumber.class)
@CucumberOptions(format={"samplehtmlreport:report/smoketestreport.html"}, tags={@smokeTest})
public class JunitRunner {

}

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ruby on Rails: Is it Worth it?

To SQL, or not to SQL

EKS-Task

Two Years of Elixir at Podium: Thoughts

Running Neo4j on Google Cloud

Is Coding Interesting or Difficult?

Git and GitHub

GitHub gif

Tests for AWS CDK code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Factory

Code Factory

More from Medium

`GraalVM` We put their name to the test !

Source  : https://www.graalvm.org/docs/img/graalvm_architecture_community.png

Mutation testing

Starting and Stopping the JMS message listener in spring integration.

Interfaces and Polymorphism