Skip to content

Product Flavor tasks don't find their tests properly #25

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

Closed
skrugly opened this issue Nov 1, 2017 · 6 comments
Closed

Product Flavor tasks don't find their tests properly #25

skrugly opened this issue Nov 1, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@skrugly
Copy link

skrugly commented Nov 1, 2017

Subject

@mannodermaus
Copy link
Owner

What error are you facing when the product flavor is active? Starting with AGP3, each product flavor has to be assigned a dimension, which you declared, but didn't assign to the flavor (it should say dev { dimension "tier" }).

Here is an example from the plugin's unit tests. Please let me know if the error persists beyond that, and post a stack trace as well!

@skrugly
Copy link
Author

skrugly commented Nov 1, 2017

The problem is that it doesn't found Spek tests.
This is the result of ./gradlew junitPlatformTestDevDebug with an existing product flavour

Test run finished after 28 ms
[         3 containers found      ]
[         0 containers skipped    ]
[         3 containers started    ]
[         0 containers aborted    ]
[         3 containers successful ]
[         0 containers failed     ]
[         **0 tests found**       ]
[         0 tests skipped         ]
[         0 tests started         ]
[         0 tests aborted         ]
[         0 tests successful      ]
[         0 tests failed          ]

And this is of ./gradlew junitPlatformTest without a product flavour

Test run finished after 32 ms
[         4 containers found      ]
[         0 containers skipped    ]
[         4 containers started    ]
[         0 containers aborted    ]
[         4 containers successful ]
[         0 containers failed     ]
[         **1 tests found**       ]
[         0 tests skipped         ]
[         1 tests started         ]
[         0 tests aborted         ]
[         0 tests successful      ]
[         1 tests failed          ]

@mannodermaus
Copy link
Owner

Thanks for elaborating! This looks like an issue with how the different source paths are fed into the flavor-aware sub tasks. I'll keep you posted.

@mannodermaus mannodermaus self-assigned this Nov 1, 2017
@mannodermaus mannodermaus changed the title Doesn't work with AGP3 if a product flavor exist Product Flavor tasks don't find their tests properly Nov 1, 2017
@mannodermaus mannodermaus added this to the 1.0.12 milestone Nov 1, 2017
mannodermaus added a commit that referenced this issue Nov 2, 2017
This adds "FunctionalSpec" classes that verify the correct execution
of JUnit 5 tests in different scenarios. We've had some issues with
test discovery in the past, which go beyond the "pure" plugin tests
that assert the correct configuration and behavior. These new tests
create virtual projects & run their unit tests with GradleRunner,
then assert if everything went as expected.

These tests are detecting the incorrect behavior for issues like #25,
which are related to a bug in the Kotlin copy task, for instance.
mannodermaus added a commit that referenced this issue Nov 2, 2017
* Introduce functional unit tests akin to the JUnit 5 Java plugin

This adds "FunctionalSpec" classes that verify the correct execution
of JUnit 5 tests in different scenarios. We've had some issues with
test discovery in the past, which go beyond the "pure" plugin tests
that assert the correct configuration and behavior. These new tests
create virtual projects & run their unit tests with GradleRunner,
then assert if everything went as expected.

These tests are detecting the incorrect behavior for issues like #25,
which are related to a bug in the Kotlin copy task, for instance.

* #25: Fix destination of copied Kotlin classes for AGP3
@mannodermaus
Copy link
Owner

Actually the problem wasn't how the JUnit tasks were set up, but rather where the intermediate Kotlin classes were copied to. If you used a Java test instead, it would have been picked up properly. After some writing, I have now introduced functional tests which will aid in verifying the behavior of the plugin with actual unit test sources.

On the latest snapshot of the plugin, 1.0.12-SNAPSHOT, this issue has been fixed, and it will be part of the next proper release, also due very shortly.

Thanks for reporting!

@skrugly
Copy link
Author

skrugly commented Nov 2, 2017

1.0.12-SNAPSHOT made the fix.
Thank you!

@mannodermaus
Copy link
Owner

Released in 1.0.12!

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