Loading ...
Sorry, an error occurred while loading the content.

Re: [junit] Displaying test case name from the testcase

Expand Messages
  • David Saff
    See also https://github.com/KentBeck/junit/blob/master/src/main/java/org/junit/rules/TestName.java
    Message 1 of 3 , Feb 15, 2012
    View Source
    • 0 Attachment
      See also https://github.com/KentBeck/junit/blob/master/src/main/java/org/junit/rules/TestName.java

      On Wed, Feb 15, 2012 at 6:05 PM, Dawid Weiss <dawid.weiss@...> wrote:
      > You should write a @Rule that will intercept the Description associated
      > with the current test case and store it somewhere (or use it directly).
      > Check out the javadoc for @Rule.
      >
      > http://kentbeck.github.com/junit/javadoc/latest/org/junit/rules/TestRule.html
      >
      >
      > Dawid
      >
      > On Wed, Feb 15, 2012 at 3:54 PM, Wayne <wdtj@...> wrote:
      >
      >> **
      >>
      >>
      >> Forgive me if this is a FAQ, but I have tried digging through the
      >> documentation and the answer was not apparent.
      >>
      >> I am writing some test cases. As part of the testing, I want to keep a log
      >> of the responses from the code for debugging purposes. It would be really
      >> helpful to have some simple process to print out the tests name and other
      >> properties into the log. Since there are hundreds of tests, I would like to
      >> make this a common step (ie call a method) to do this. Problem is finding
      >> the name of the test itself (without having to pass it into the logging
      >> method or hacking the stack).
      >>
      >> I see there is a Description class in the runner. Is there any way to
      >> access the runner (i.e. a singleton or static getter) from the test case?
      >>
      >>
      >>
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.