Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClasspathSuite runner fails on Android #17

Open
mbolotov opened this issue Jun 9, 2017 · 4 comments
Open

ClasspathSuite runner fails on Android #17

mbolotov opened this issue Jun 9, 2017 · 4 comments

Comments

@mbolotov
Copy link

mbolotov commented Jun 9, 2017

I've encountered a problem when running a test by ClasspathSuite runner on Android platform:

import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.runner.RunWith;

@RunWith(ClasspathSuite.class)
public class AllTabletTests {
}

The problem seems to be caused by Android specific value for "java.class.path" property: it's always '.'
See https://developer.android.com/reference/java/lang/System.html

So it fails with the following exception:

java.lang.NullPointerException: Attempt to get length of null array
at org.junit.extensions.cpsuite.RecursiveFilenameIterator.getInnerIterators(RecursiveFilenameIterator.java:46)
at org.junit.extensions.cpsuite.RecursiveFilenameIterator.(RecursiveFilenameIterator.java:36)
at org.junit.extensions.cpsuite.RecursiveFilenameIterator.(RecursiveFilenameIterator.java:29)
at org.junit.extensions.cpsuite.ClasspathClassesFinder.gatherClassesInRoot(ClasspathClassesFinder.java:65)
at org.junit.extensions.cpsuite.ClasspathClassesFinder.findClassesInRoots(ClasspathClassesFinder.java:50)
at org.junit.extensions.cpsuite.ClasspathClassesFinder.findClassesInClasspath(ClasspathClassesFinder.java:44)
at org.junit.extensions.cpsuite.ClasspathClassesFinder.find(ClasspathClassesFinder.java:33)
at org.junit.extensions.cpsuite.ClasspathSuite.getSortedTestclasses(ClasspathSuite.java:127)
at org.junit.extensions.cpsuite.ClasspathSuite.(ClasspathSuite.java:117)
at org.junit.extensions.cpsuite.ClasspathSuite.(ClasspathSuite.java:110)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:107)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at android.support.test.internal.runner.junit4.AndroidAnnotatedBuilder.runnerForClass(AndroidAnnotatedBuilder.java:77)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runner.Computer.getRunner(Computer.java:40)
at org.junit.runner.Computer$1.runnerForClass(Computer.java:31)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87)
at org.junit.runners.Suite.(Suite.java:81)
at org.junit.runner.Computer.getSuite(Computer.java:28)
at android.support.test.internal.runner.TestRequestBuilder.classes(TestRequestBuilder.java:789)
at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:753)
at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:354)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:260)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)

@timtheguy
Copy link

I've also experienced this when casually trying to use this package in Android - did you ever find a solution?

@mbolotov
Copy link
Author

As far as I remember - we've ending up with an external runner that select and run the test set.

@timtheguy
Copy link

Thank you for the response - if you happen to recall the name of the runner, do let me know! Cheers

@mbolotov
Copy link
Author

It's our locally developed runner, we didn't open source it. By 'external' I mean external to the junit system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants