Tests on test(AVD) - failed: Instrumentation run failed due to 'java.io.IOException'

人走茶凉 提交于 2019-12-04 12:01:24

The problem 'java.io.IOException' is because Cucumber-jvm can't write to the location indicated in @CucumberOptions under format.

In my case, it's because the path exists on the device but does not exist on the emulator, that's why it fails only on emulator.

The solution is to change the path to the html, json and junit reports to a path that is writable in both device and emulator.

My initial path (/mnt/sdcard/cucumber-reports/html-report) was great for placing the html report and retrieving it after execution is finished. The path that works in both device and emulator is the example below, but this path will be deleted after application is removed by Gradle test execution:

@CucumberOptions(features = "features", // Test scenarios
        glue = {"com.neoranga55.cleanguitestarchitecture.cucumber.steps"}, // Steps definitions
        format = {"pretty", // Cucumber report formats and location to store them in phone
                "html:/data/data/com.neoranga55.cleanguitestarchitecture/cucumber-reports/html-report",
                "json:/data/data/com.neoranga55.cleanguitestarchitecture/cucumber-reports/cucumber.json",
                "junit:/data/data/com.neoranga55.cleanguitestarchitecture/cucumber-reports/cucumber.xml"
        },
        tags={"~@manual", "@login-scenarios"}
)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!