Search the web
Sign In
New User? Sign Up
junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
JUnit - List of test methods through TestRunner   Message List  
Reply | Forward Message #21790 of 22233 |
Hi Everyone,

I am new to the group so please excuse if I may have overlooked a few norms on
my way in. Let me get to the point:

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.

TestRunner runner = new TestRunner();
TestSuite suite = new TestSuite(testClasses);//classes array
TestResult tr = runner.doRun(suite, false);
Enumeration enumError = tr.errors();
while (enumError != null && enumError.hasMoreElements())
{
logger.info("Reporting the error cases");
error = (TestFailure) enumError.nextElement();
//do something useful with error
}

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




Wed Jul 1, 2009 11:54 am

slimer_freak
Offline Offline
Send Email Send Email

Forward
Message #21790 of 22233 |
Expand Messages Author Sort by Date

Hi Everyone, I am new to the group so please excuse if I may have overlooked a few norms on my way in. Let me get to the point: I have an application running...
slimer_freak
Offline Send Email
Jul 1, 2009
10:17 pm

Resolved - I was able to extract the method names through Java Reflection API. Class testClass = Class.forName(MyTestClassName); Method[] methods =...
slimer_freak
Offline Send Email
Jul 3, 2009
12:02 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help