I have an Android test project that I'd like to link into Hudson, but I haven't found a way to output the test results as XML instead of text. Does anyone know if there's an easy way to do this already?
-Dan
When you use AndroidJUnitRunner to run your tests, you can access the context for the app under test by calling the static ApplicationProvider. getApplicationContext() method. If you've created a custom subclass of Application in your app, this method returns your custom subclass's context.
Earlier in the module's build.gradle file, we have a testInstrumentationRunner statement: testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" (from ToDoTests/build.gradle) This tells Android how to run our JUnit instrumented tests. JUnit uses “runner” classes for this role, and androidx.
Instrumented tests run on Android devices, whether physical or emulated. As such, they can take advantage of the Android framework APIs. Instrumented tests therefore provide more fidelity than local tests, though they run much more slowly.
FYI, for anyone else who happens to stumble on this question. I've created a new TestRunner that you can use in your Android test projects that will output your test results in XML readable by Hudson (and probably any other CI app). You can read about it here: http://droiddudes.com/2010/04/07/athenatestrunner/ or just grab it from here: http://github.com/dwatling/athena
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With