Re: A way to log test execution (who is going to run/stop), FYI...
"Oleskandr" <[email protected]>
| Newsgroups | gmane.comp.java.junit.user |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], David Saff <saff@...> wrote: > On Fri, Feb 22, 2013 at 8:32 AM, Oleskandr <gavenkoa@...> wrote: > > > > After googling I found: > > > > http://stackoverflow.com/questions/473401/get-name-of-currently-executing-test-in-junit-4 > > Sorry for the late reply. You may be best off with a Rule for > displaying the method names. > http://stackoverflow.com/questions/473401/get-name-of-currently-executing-test-in-junit-4 > might be a starting point. Good luck, > I already read provided link but doesn't look dipper into @Rule. Seems that @Rule scope to contained class file. I look for solution which doesn't require of modifying of existent test source code (because I want make logging facility persistent - commit to SVN duplicate code is wrong). So instead of *coding* I look for *configuring*! And finally get it with: > > import java.io.*; > > import org.junit.runner.Description; > > import org.junit.runner.notification.RunListener; > > > > public class LogTests extends RunListener { > > > > static PrintStream out = new PrintStream(new > > FileOutputStream(FileDescriptor.out)); > > > > public void testStarted(Description description) { > > out.println("Test started: " + description.getDisplayName()); > > } > > > > public void testFinished(Description description) { > > out.println("Test finished: " + description.getDisplayName()); > > } > > } > > > > Next I add profile to pom.xml and configure build on Jenkins with > > '-Pjunitlog'. > > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/junit/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/junit/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/