Junit TestRunner Install & Run Program with JUNIT / TestNG

 




Run with JUNIT




package testRunner;

import org.junit.runner.RunWith;


import io.cucumber.junit.Cucumber;

import io.cucumber.junit.CucumberOptions;


@RunWith(Cucumber.class)

@CucumberOptions(features="features", glue ="Steps", monochrome=true)

public class TestRunner {


}


Output:

Navigating to credit card payment page...

Filling in details and selecting payment option: <Payment Option>

Clicking on button: Pay

Verifying confirmation page..



Run with TestNG Runner






package testRunner;


import io.cucumber.testng.AbstractTestNGCucumberTests;

import io.cucumber.testng.CucumberOptions;


@CucumberOptions(

features = "src/test/java/features",

glue = "Steps",

monochrome = true

)

public class TestRunner extends AbstractTestNGCucumberTests {

}


Output:


Navigating to credit card payment page...
Filling in details and selecting payment option: <Payment Option>
Clicking on button: Pay
Verifying confirmation page...
PASSED: io.cucumber.testng.AbstractTestNGCucumberTests.runScenario("Make a payment with different options", "Credit Card Payment")
Runs Cucumber Scenarios
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 0
===============================================

===============================================
Default suite
Total tests run: 1, Passes: 1, Failures: 0, Skips: 0
===============================================