prashant-ramcharan / courgette-jvm

Multiprocess | Parallel Cucumber-JVM | Parallelize your Java Cucumber tests on a feature level or on a scenario level.
MIT License
132 stars 38 forks source link

java.lang.IllegalArgumentException: path must exist #252

Closed anas-baadshah closed 3 years ago

anas-baadshah commented 3 years ago

When setting the path to feature file on cucumberOptions it throws an error says java.lang.IllegalArgumentException: path must exist:

i am using an AndroidJUnitRunner with Gradle.

@RunWith(Courgette.class) @CourgetteOptions( threads = 10, runLevel = CourgetteRunLevel.SCENARIO, rerunFailedScenarios = true, showTestOutput = true, reportTargetDir = "build", cucumberOptions = @CucumberOptions( features = "/src/androidTest/assets/features/firstlevel", glue = "com.comapany.test", tags = {BuildConfig.CUCUMBER_TEST_TAG}, publish = true, plugin = { "pretty", "json:build/cucumber-report/cucumber.json", "html:build/cucumber-report/cucumber.html", "junit:build/cucumber-report/cucumber.xml", "message:build/cucumber-report/cucumber.ndjson"} )) public class CucumberInstrumentationRunner extends AndroidJUnitRunner { @CourgetteBeforeAll public static void setUp() { System.out.println("I will run before any tests execute"); }

@CourgetteAfterAll
public static void tearDown() {
    System.out.println("I will run after all of the tests execute");
}

} Throws the following error while running Initialization Error

java.lang.IllegalArgumentException: path must exist: /src/androidTest/assets/features/firstlevel at io.cucumber.core.resource.PathScanner.findResourcesForPath(PathScanner.java:44) at io.cucumber.core.resource.PathScanner.findResourcesForUri(PathScanner.java:28) at io.cucumber.core.resource.ResourceScanner.findResourcesForUri(ResourceScanner.java:61) at io.cucumber.core.resource.ResourceScanner.scanForResourcesUri(ResourceScanner.java:134) at io.cucumber.core.runtime.FeaturePathFeatureSupplier.loadFeatures(FeaturePathFeatureSupplier.java:62) at io.cucumber.core.runtime.FeaturePathFeatureSupplier.get(FeaturePathFeatureSupplier.java:45) at courgette.runtime.CourgetteLoader.(CourgetteLoader.java:37) at courgette.api.junit.Courgette.(Courgette.java:33) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at androidx.test.internal.runner.junit4.AndroidAnnotatedBuilder.runnerForClass(AndroidAnnotatedBuilder.java:63) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37) at androidx.test.internal.runner.AndroidRunnerBuilder.runnerForClass(AndroidRunnerBuilder.java:153) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70) at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:73) at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104) at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:793) at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:547) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:390) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

Can you help me here please?

prashant-ramcharan commented 3 years ago

Hi,

Can you confirm / share the full path to your Cucumber feature files?

Also, did you try removing the first / to just use: src/androidTest/assets/features/firstlevel

anas-baadshah commented 3 years ago

This is the absolute path, I tried with this also/Users/Work/Android/talabat/src/androidTest/assets/features/firstlevel. this firstlevel folder contains multiple feature files.

I tried removing slash before src and it also didn't work. any idea??

prashant-ramcharan commented 3 years ago

This would suggest your feature files are not available on the classpath.

The error being thrown is from Cucumber io.cucumber.core.resource.PathScanner.findResourcesForPath failing to find your features. You will get the same error if you try using a Cucumber runner too.

Can you ensure your feature files is copied to the classpath or perhaps move it to a resources folder ?

src/test/resources/features

anas-baadshah commented 3 years ago

Previously, I was usingcucumber-android where the tests were working fine with the configuration. For re-run and parallel mechanism implementation, I choose courgette-JVM. I will try to move the feature files to the resources folder. Thank you man for the quick reply

prashant-ramcharan commented 3 years ago

Ah okay.

Courgette does not support cucumber-android so maybe this is why the features are not being picked up.

anas-baadshah commented 3 years ago

We cannot use this for android tests then? Can you advise here?

prashant-ramcharan commented 3 years ago

I've not tried it myself but as Courgette does not extend from AndroidJUnitRunner it's unlikely to work.

prashant-ramcharan commented 3 years ago

Did you try using an absolute path for the feature files?

prashant-ramcharan commented 3 years ago

Closing inactive issue.