Cannot get my features files recognized by aws dev

2019-08-30 07:12发布

I am having an issue running my cucumber project with device farm. I am getting this error:

[TestNG] Caused by: java.lang.IllegalArgumentException: Not a file or directory: /tmp/scratchheDEgq.scratch/test-packagex5ZhYf/src/test/java/cucumber/features

I understand from this message that there is an issue with the path of the features directory in my project but locally it works.

This is how I put it in my code:

@CucumberOptions(features = "src/test/java/cucumber/features", glue = "cucumber.steps")

Should I provide a different path to device farm? What am I missing here?

Thanks

1条回答
Melony?
2楼-- · 2019-08-30 07:51

By default the src/test/java/cucmber directory(if it exists in the project) is not included the *-test.jar file. Try putting the feature files in the src/test/resources directory as shown in the Device Farm sample project.

https://github.com/aws-samples/aws-device-farm-appium-cucumber-tests-for-sample-app/tree/master/src/test/resources/LoginTest

Alternatively, you can implement the testResources tags in the pom.xml to explicitly reference another directory besides src/test/resources assuming that we're using maven:

<testResources>
     <testResource>
        <directory>${project.basedir}/src/test/YOUR_DIRECTORY_HERE</directory>
     </testResource>
</testResources>

Check out this link for more info on the testResources tag https://maven.apache.org/pom.html#Resources

testResources: The testResources element block contains testResource elements. Their definitions are similar to resource elements, but are naturally used during test phases. The one difference is that the default (Super POM defined) test resource directory for a project is ${basedir}/src/test/resources. Test resources are not deployed.

HTH

-James

查看更多
登录 后发表回答