I have a simple question as I am just getting into Test Automation.

I want to develop Cucumber smoke tests and acceptance tests as they would be easy to read and understand for my colleagues. Unfortunately, I am using TestNG and Cucumber is in Junit.

I am not interested in using Junit in my testing overall but I am okay with using for Cucumber acceptance/smoke tests but I don't have any practical experience with this. Would it be convoluted or difficult to use Junit just with Cucumber tests and TestNG with all of my other lower level tests ?


3 Answers 3


Cucumber is not really driven by JUnit. JUnit Runner is an easy way to integrate running cucumber into an existing testing infrastructure (like mvn verify).

That one single empty JUnit Runner class should not give you much pain against TestNG. The only thing important for you is to plug it into a proper build lifecycle phase, we often use it on integration-test instead of the test phase instead of the maven.

Technically you could use something else instead of the JUnit to start cucumber tests, for example their CLI runner either from command line or programmatically.


You can use Cucumber with either JUnit or TestNG, if you want to run it from a test framework. You can also run it directly from the command line, from your IDE or from a build tool like Maven or Gradle.

For an example using TestNG, have a look at: https://github.com/cucumber/cucumber-jvm/tree/master/examples/java-calculator-testng


Cucumber-jvm is object oriented while TestNG is class oriented. The two don't mesh well. That being said, take a look at the following:




The best option appears to be one TestNG test runner per feature file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.