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

[Android] Support "com.android.test" module #974

Open
dongyi-chun opened this issue Sep 26, 2024 · 3 comments
Open

[Android] Support "com.android.test" module #974

dongyi-chun opened this issue Sep 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dongyi-chun
Copy link

Describe the bug
I'm currently using a test module in my project which is officially supported by Google.
https://developer.android.com/studio/test/advanced-test-setup#use-separate-test-modules-for-instrumented-tests

When I configure Marathon with a current project, all of test modules are not supporting marathon gradle test command, seems like it does not compatible with this type of modules.

I tried to find any relevant issues in the history but I can't.

To Reproduce
Steps to reproduce the behaviour:

  1. Multi module Android project with test module.
  2. Try to run ./gradlew :app_test:marathonDevelopmentDebugAndroidTest for example, but it complains cannot find a gradle task even though I can see a marathon related tasks.

Expected behavior
Should support test module for given gradle command: marathonDevelopmentDebugAndroidTest

Logs and reports

FAILURE: Build failed with an exception.

* What went wrong:
Cannot locate tasks that match ':app_test:marathonDevelopmentDebugAndroidTest' as task 'marathonDevelopmentDebugAndroidTest' not found in project ':app_test'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> For more on name expansion, please refer to https://docs.gradle.org/8.9/userguide/command_line_interface.html#sec:name_abbreviation in the Gradle documentation.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Devices (please complete the following information):

  • N/A, general issue

Additional context

  • Running ./gradlew :app_test:marathon triggers some tasks but it saying all test cases incomplete and eventually all test cases are flagged as failed.
  • Result of ./gradlew :app_test:tasks | grep marathon
marathonDevelopmentDebugGenerateMarathonfile - Generates Marathonfile for 'developmentDebug' variation
marathonProductionDebugGenerateMarathonfile - Generates Marathonfile for 'productionDebug' variation
marathon - Runs all the instrumentation test variations on all the connected devices
marathonDevelopmentDebug - Runs instrumentation tests on all the connected devices for 'developmentDebug' variation and generates a report with screenshots
marathonProductionDebug - Runs instrumentation tests on all the connected devices for 'productionDebug' variation and generates a report with screenshots
  • connectedDevelopmentDebugAndroidTest working
@dongyi-chun dongyi-chun added the bug Something isn't working label Sep 26, 2024
@Malinskiy
Copy link
Member

Hey @dongyi-chun

com.android.test is already supported, see examples and the change for more context.

You may be invoking the wrong task, i.e. marathon never plugs into connectedXXX tasks for example because it's not part of AGP.

FYI this repo is for the cli version of marathon, in the future please file issues to https://github.com/MarathonLabs/marathon-gradle-plugin because it's a separate project nowadays.

@dongyi-chun
Copy link
Author

Hello @Malinskiy, thank you for letting me know, it is good hear that.
But when I try to run marathon tasks, I found that there are some issues.

When I list up tasks, it has a different suffix for marathon test as I originally posted.
Also I tried to run by using marathonDevelopmentDebug instead of marathonDevelopmentDebugAndroidTest locally, it does not install testing apk.

Seems like there are different suffix make this problem, I had to workaround to make it dependent between installDevelopmentDebug and installDevelopmentDebugAndroidTest.

(I'm just leaving further comments here to keep a history)

@Malinskiy
Copy link
Member

Every single task that marathon creates starts with marathon suffix (ref)

The usage of any installXX tasks from AGP is irrelevant: marathon gradle plugin doesn't use anything there because it forks into a separate cli invocation and installs apps defined via Marathonfile even if these are present on the device.

For the sample app here is the setup in IDE:
Screenshot_20240927_194040

I suspect you have some other problem with your multi-module project and using installxxx is just masking the real issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants