Hi Joe,
I don't know exactly why the class loader fails for you, so here is a detailed look at my environment.
Good luck,
Richard
project Behavior structure:
Behavior/
target/ <--- folder excluded in IntelliJ used as output
src/
main/
java/ <--- folder marked as source code in IntelliJ
com/company/bdd/ <--- location of java classes which interact with the system
test/
java/ <--- folder marked as test source code in IntelliJ
com/company/bdd/ <--- location of the TestRunner.java
steps/ <--- location of step classes used in the stories, which use the classes in com.company.bdd to access the system
resources/ <--- folder marked as test resource folder in IntelliJ
stories/ <--- location of all my *.stories files (I think you named them *.feature).
capability/feature/story.story <--- standard hierarcy of story files, all placed under the stories folder.
-----------------------------------------------
The compile output of the project is redirected.
output path: Behavior/target/classes
test output path: Behavior/target/test-classes
-----------------------------------------------
In IntelliJ there is a project file (Behavior.iml), in which the folder assignment is kept.
If the order of the folders in this file gets changed then stories are not found properly.
Here is an excerpt of the project file:
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
-----------------------------------------------------------
I run TestRunner as a jUnit test configuration with a work folder set to Behavior and a command line paramenter: -Dstories=<stories file without extension>
TestRunner class:
public class TestRunner extends ThucydidesJUnitStories
{
protected String getStoriesFile()
{
String storiesFile = System.getProperty("stories");
String parentFolder = System.getProperty("user.dir");
String storiesPath = "\\src\\test\\resources\\stories\\";
return parentFolder + storiesPath + storiesFile + ".stories";
}
@Override
public List<String> storyPaths()
{
try
{
File file = new File(getStoriesFile());
try (FileReader reader = new FileReader(file))
{
char[] buffer = new char[(int) file.length()];
reader.read(buffer);
String[] lines = new String(buffer).split("\n");
List<String> storiesList = new ArrayList<>(lines.length);
for (String line : lines)
{
if (!line.startsWith("#"))
{
storiesList.add(line.trim());
}
}
return storiesList;
}
}
catch (Throwable e)
{
System.out.println(StringUtil.exceptionToString("failed to load stories list", e));
throw new RuntimeException(e);