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

How to use android command: am instrument to run testcase if testcase writed in main directory rather than test directory? #360

Open
yanweishr opened this issue Oct 18, 2024 · 2 comments
Labels

Comments

@yanweishr
Copy link

I write testcase in main dictory rather than test dictory , and run testcase with :adb shell am instrument xxx,
then it report error:"Caused by: java.lang.IllegalArgumentException: Could not find extra class de.mannodermaus.junit5.AndroidJUnit5Builder"
And I found out that the android-test.apk include the AndroidJUnit5Builder.class ,but the release.apk didnot include the AndroidJUnit5Builder.class, the plugin do something to pack the class to apk file.

So is there a way to use am instrument commond to run junit5 testcase ?

@mannodermaus
Copy link
Owner

It's possible that this sort of unusual use case isn't supported from the Android side, which is why it won't pick up anything outside androidTest for running as an instrumentation test. Are you saying that you can write testcases in the main directory with JUnit 4, but it doesn't work with JUnit 5? Or is this a general question about how to make this use case work? (If it's the latter, then I'm afraid we can't do anything about it since the Android instrumentation itself would need to be changed first).

@yanweishr
Copy link
Author

In fact, this project provides a plugin for users to use. The plugin packs the junit5 library internally.
Can it be packed as an aar ,so that users can directly use the aar in the project?

@yanweishr yanweishr changed the title How to use android command: am instrument to run testcase if testcase writed in main dictory rather than test dictory? How to use android command: am instrument to run testcase if testcase writed in main directory rather than test dictory? Oct 21, 2024
@yanweishr yanweishr changed the title How to use android command: am instrument to run testcase if testcase writed in main directory rather than test dictory? How to use android command: am instrument to run testcase if testcase writed in main directory rather than test directory? Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants