How to generate test result report using robotium?
Asked Answered
C

6

5

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.

Crissie answered 31/1, 2011 at 12:5 Comment(0)
F
2

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!

Footwear answered 17/2, 2011 at 19:31 Comment(0)
C
2

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.

see also pages: Log class, logcat

Compressibility answered 22/11, 2012 at 20:50 Comment(0)
M
2

XML report generation is quite simple when we are using Eclipse IDE

Steps to be followed

  1. Run the Junit test as usual in eclipse Run As->Android Junit Test.

  2. Once the test run is completed you will be indicated with the status in the status bar provided by the IDE.

  3. 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.

enter image description here

Mucoid answered 26/8, 2013 at 9:17 Comment(1)
Is there a way to make the export from shell instead of lunching it from Eclipse?Bathetic
L
2

In my case, I user spoon to generate test html reports. https://github.com/square/spoon

Lueluebke answered 6/8, 2014 at 7:50 Comment(1)
A phantastic tool! Brief reports for all connected devices and easy to set up. Thx ... :)Yakka
I
1

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.

Inchoation answered 15/8, 2011 at 10:1 Comment(0)
K
0

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.

Kraut answered 12/3, 2014 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.