I have been using robotium to test my android application.Testing was successful but i want to know that is there any way to view test results in a separate file.
I have had good luck just running the robotium tests as regular Android JUnit tests, and then using the standard mechanism to get back the test results, namely the ant task fetch-test-report. To do this I used the build.xml file create by android through the tooling. See documentation for developing in other IDEs for detailed instructions on setting that up. Good luck!
I use approach with logcat and android class Log.'severity'(tag, msg) ('severity' can be i-info, d-debug, w-warn, e-error, v-verbose), here is an example of clicking button myView:
String viewName = solo.getString(R.string.myViewName);
try {
solo.clickOnView((View) solo.getView(R.id.myView));
Log.i("Passed", viewName + " works correctly.");
} catch (Exception e) {
Log.e("Error", viewName + " doesn't work.");
}
Using filters you can filter output by tags and selecting all lines save it in .txt file. All these you can do automatically by writing simple script which will redirect output to file from InstrumentationTestRunner for you.
XML report generation is quite simple when we are using Eclipse IDE
Steps to be followed
Run the Junit test as usual in eclipse Run As->Android Junit Test.
Once the test run is completed you will be indicated with the status in the status bar provided by the IDE.
When you click on the Test Run History Icon which is available in the Junit view of eclipse IDE you will find the Export option through which you can you can export the XML format test.
If you have and problems in finding the icon please watch the below image.
In my case, I user spoon to generate test html reports. https://github.com/square/spoon
You can follow the way of your choice because it is not pure junit code:
1-XML based test execution report using any xml writing/parsing apis
2-logcat based test execution report using logs for example if you are using Eclipse IDE
3-customized report writing to your device under test, for this you will need apis to write to device
These are three ways out of several available as per your requirements and IDE.
You can use the PolideainstrumentationtestRunner, it allows you to specify exactly where you want to store the test result. (add option junitXmlOutput true and junitOutputDirectory yourPath)
http://code.google.com/p/the-missing-android-xml-junit-test-runner/
I hope it will help.
© 2022 - 2024 — McMap. All rights reserved.