We have a bunch of Cucumber tests that we currently run through the IDE by selecting "Run As > JUnit Test". Doing it this way everything works and runs fine.
We however need to be able to kick these tests off from within a Java application. Looking
here I found a couple ways to run Junit tests from within java such as:
JUnitCore junit = new JUnitCore();
Result result = junit.run(testClasses);
or
public static void main(String args[]) {
org.junit.runner.JUnitCore.main("junitfaq.SimpleTest");
}
Doing it this way however does not work. Our tests start to run and then we are shown "
You can implement missing steps with the snippets below:"
I can not understand why when I manually kick off the tests to run as a Junit everything works, but when I do the same from within a Java application the step definition are not found. It finds the feature files but can't find the step methods to match them.
For testing purposes I have the main with the code to start the Junit test in the same .java file I select "Run As > JUnit Test" from.
Any thoughts? Thanks in advance!