-
Notifications
You must be signed in to change notification settings - Fork 319
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
Code Coverage fails to generate when instrumented tests combined with Cucumber #1319
Comments
Sorry I'm not familiar at all with Cucumber - you might want to file this issue on cucumber's repository. I notice it uses a custom test runner 'io.cucumber.android.runner.CucumberAndroidJUnitRunner' which I would guess does not support orchestration. Using a custom runner in general is not recommended for issues like this. |
I have already logged an issue in the Cucumber repo around this same issue (cucumber/cucumber-android#96). I will pursue a resolution there but I was hoping you can maybe shed some light on why a workaround I devised is able to work. I created a set of gradle tasks that will:
This implies to me that the .ec files are well formatted, however, either there is a problem with the timing of their creation or there is an issue with how these files are being copied to the local build folder. As mentioned in my initial issue, I'm getting a proper representation of .ec files matching the tests that were ran, but the copied over files are all zero bytes. If you can please point me to the code that copies these files over, I can look to see if there is an incompatibility with what Cucumber's runner is doing and what is expected (e.g., check if there are restrictions on file names like no spaces or special characters). |
@yuuki3655 can you provide some insight here? |
Sure. Those ec files are copied from Android device to a host machine after all test cases are finished by AndroidTestCoveragePlugin. I downloaded your sample project, https://github.com/fwpascual/cucumber-coverage-sample, and I can reproduce the issue. However, after I upgraded the AGP version to the latest, |
I can confirm that in my sample, updating to Applying the same change to my other project produces a new error, but I guess this is unrelated to this issue specifically.
|
I got the same result when updating AGP to the newly released |
Description
I am having trouble combining Cucumber with Android Espresso tests and getting code coverage results. With code coverage disabled, the
cAT
gradle task completes successfully and with valid test results. With it enabled, however, the gradle task fails when generating the code coverage results.I've created a sample project linked below that demonstrates the issue using the Android testing-samples repo as a baseline.
My issue seems similar to this issue, but I think it's a more advanced problem due to my usage of Cucumber. Using the unmodified sample from this tracked issue, I am able to get code coverage results:
https://issuetracker.google.com/issues/123987001
Steps to Reproduce
Using the linked repo below, you can see the issue by running
./gradlew clean cAT
You can download and build the provided repo that shows this issue directly; the following are steps that were used to create that project.
MyTest
withCucumberOptions
annotationSampleSteps
with sample cucumber step./gradlew clean cAT
with an emulator runningExpected Results
Expected a code coverage report
Actual Results
Get a failure during the
:app:createDebugAndroidTestCoverageReport
gradle taskInspecting the folder under
app/build/outputs/code_coverage/debugAndroidTest/connected/Pixel_4_XL_API_31(AVD) - 12
, I see aSample\ Feature#Sample\ Scenario.ec
file, but it's zero bytes. When I look for this same file on the emulator, I see the same file under/sdcard/googletest/internal_use/data/data/com.example.android.testing.androidtestorchestratorsample/coverage_data/Sample Feature#Sample Scenario.ec
with a 123 byte file.Running the
:app:connectedDebugAndroidTest
task, I don't get a failure, and at this point the.ec
file is also in the above described emulator device folder, however, I see this error in the gradle build log:AndroidX Test and Android OS Versions
Emulator: Android API 31
Runner: 1.4.1-alpha03 (1.4.0 as well)
Test Services: 1.4.1-alpha03 (1.4.1 as well)
Link to a public git repo demonstrating the problem:
https://github.com/fwpascual/cucumber-coverage-sample
The text was updated successfully, but these errors were encountered: