Cucumber integration with TestNG and Maven
Latest commit 8fe783f Apr 26, 2016 @igorvsd igorvsd write stacktrace on retry


If you ever dreamt about running cucumber test with testng look into this project :).


You need to put configuration file in your project like:

src/test/resources/ with content:

# java package with steps classes in your project

To check you didn't forget to implement TestNG @Test add such additional test:

public class StateTest {

    @Test(priority = -1)
    public void testState() {
        // setup

        // act
        String result = CucumberTestsStateUtil.checkTests();

        // verify
        Assert.assertNull(result, result);

Then for each feature scenario you need to create TestNG test. Feature Name shoud be same as feature file name Scenario name should be same as feature scenario name in cucumber


public class LoginTest extends AbstractCucumberTest {

    @Scenario("Login with guest account")
    public void loginWithGuestAccount() {


Feature: Login

  Scenario: Login with guest account
    Given Prepared user with username <"SuccessfulUsername"> and password <"12345">
    Then Open login page
    Then Fill login form with user <"SuccessfulUsername"> and password <"12345"> and click login
    Then Check we logged in with username <"SuccessfulUsername">



  • [+] CucumberTestsStateUtil. Added check tests names are unique because cucumber starts tests using regexp instead check name for equal (so one test name shouldn't start with another test name)


  • [+] Feature. Retry run failed test support added. Need to be added java property at runtime -Dretry.tests=3 to rerun this test max 3 times more if it failed at first run. 0 by default.