aspose file tools*
The moose likes Testing and the fly likes JUnit - List of test methods through TestRunner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit - List of test methods through TestRunner" Watch "JUnit - List of test methods through TestRunner" New topic
Author

JUnit - List of test methods through TestRunner

Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
I have an application running the various test cases by looping through the different Test Classes and instantiating the test suite. TestRunner executes the test cases and TestResult keeps the results in scope.

I am able to retrieve errors() and failures() of the concerned test case and iterating over the enumerations, I am able to get the description and the failure case method names.

I have a requirement to display the names of the successful methods as well - all the test methods executed through the test run. Can this be achieved through TestResult or is there any other alternative?

- Thanks
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I don't think there currently is a totally obvious way of doing that, though there probably is a way. You might want to ask this question at http://tech.groups.yahoo.com/group/junit/


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
Thanks Ilja! I have posted the message to the group. Also, can you please give a hint as to what work around can be done to gather the required information? One option is to set the VO attribute (preferably an ArrayList) of each of the method names in as the method body is invoked.

However, this is not a resueable solution and as the application gorws, there are high chances of inconsistencies in the test cases. Please do let me know your inputs.

- Thanks
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
Resolved - I was able to extract the method names through Java Reflection API.

- Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JUnit - List of test methods through TestRunner
 
Similar Threads
Need help to understand!
Junit and Emma
httpUnit report
Question on addTest method of Junit
Running JUnit test suite from command line