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

Skip module if it has no tests #229

Open
asadsalman opened this issue Mar 11, 2021 · 4 comments
Open

Skip module if it has no tests #229

asadsalman opened this issue Mar 11, 2021 · 4 comments

Comments

@asadsalman
Copy link
Contributor

If an Android module has no tests, we should be able to skip it automatically.
The current behavior is:

RunTests
  No tests for mymodule-debug-androidTest.apk

  Saved 0 shards to android_shards.json

There are no tests to run.

> Task :mymodule:execFlank FAILED

This fails the task (and the entire run) even if all tests in other modules passed.

@asadsalman
Copy link
Contributor Author

Even a check as simple as the one connectedAndroidTest (DeviceProviderInstrumentTestTask) does should be fine.

@runningcode
Copy link
Owner

Thanks for the suggestion. What is the purpose of applying the plugin to a module without tests?

@handstandsam
Copy link

Hi all. I have the same request.

The situation where this occurs:

  • We have code that applies the Fladle plugin to our project
  • We use AffectedModuleDetector and get a dynamic list of modules to run tests for which may or may not have Android Unit Tests.
  • Our dynamic configuration works great whenever we have Android Test APKs to run, but there are cases when all the affected modules only have JVM unit tests, we don't have any APKs. At this point in time we already have the finalizedBy(runFlanktask) set up, and there is no way to avoid running it at this point in time.

We get:

May  2 19:57:54.361: FAILURE: Build failed with an exception.
May  2 19:57:54.361: 
May  2 19:57:54.361: * What went wrong:
May  2 19:57:54.361: Execution failed for task ':writeConfigProps'.
May  2 19:57:54.361: > debugApk must be specified
May  2 19:57:54.361: 
May  2 19:57:54.361: * Try:
May  2 19:57:54.361: > Run with --info or --debug option to get more log output.
May  2 19:57:54.361: > Run with --scan to get full insights.

Idea I'll try that should hopefully work:

  • By using the technique @asadsalman called out, we can determine if any of the affected modules have Android tests, but we can't do that until afterEvaluate when the Android Plugin has been applied and available. At that point in time we can then determine if we want to programmatically add the dependsOn for the runFlankTask. That should work!

@runningcode runningcode reopened this May 3, 2022
@bherbst
Copy link

bherbst commented Jun 13, 2022

I have a similar issue with a slightly different cause -

We have two configurations for Flank, one for our regular UI test suite and one for benchmark tests. Our default configuration does not run benchmark tests. We apply the plugin to a module that contains only benchmark tests, but when we run the runFlank task in our project it executes for that module as well and since it contains no tests runFlank fails.

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

4 participants