Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Given I have the following class (See Parallelized Runner for more information on parallel runs):

@RunWith(Parallelized.class)
public class TopicTest {

    String topic;

    public TopicTest(String topic) {
        this.topic = topic;
    }

    @Test
    public void testTopicPage() {
       WebDriver driver = new FirefoxDriver();
       driver.get("http://www.mysite.com/topics/" + topic + "/");
       TopicPage topicPage = PageFactory.initElements(driver, TopicPage.class);
       Assert.assertTrue("No items were located on this topic page <" + topic + ">", topicPage.elementsFound());
       driver.quit();
    }

    @Parameters
    public static Collection<Object []> topics() {
        List<Object []> parameters = new ArrayList<Object []>();
        for(String s : new String [] { "topic1", "topic2", "invalidTopic" }) {
            parameters.add(new Object [] { s });
        }
        return parameters;
     }

     public static class TopicPage {
         @FindBy(className = "result-set-a")
         private List<WebElement> items;

         public boolean elementsFound() {
             return items != null && items.size() > 0;
         }
     }
}

Is there anyway that I can get more information out of my test run other than pass / fail status? I can get the following information on my failed runs due to the assertion error:

junit.framework.AssertionFailedError: No recipes were located on this topic page <invalidTopic>

Is there a way that I could get more information out from our passing tests for reporting purposes?

share|improve this question
    
Scott, what kind of information do you have in mind? More specifically, do you want information that JUnit already has, or do you envision adding logging calls to your tests? –  user246 Feb 22 '12 at 14:42
    
For instance with this test I will see the one assertion error, but not see anything for the other two topics, it'd be nice to see that topic1, topic2 passed without needing to look at the code to see which items were tested. –  Scott Feb 22 '12 at 17:43
add comment

1 Answer

up vote 2 down vote accepted

If I understand the question, the issue is not so much about parallelized tests as it is about the JUnit runner's policy of reporting failures individually but only reporting successes in aggregate. If you want successes to be reported individually, I suggest you register a custom RunListener. The RunListener will be invoked each time an event occurs during the test, e.g. when a test starts, when it finishes, and when it fails.

Another avenue to investigate would be the TestWatcher class.

share|improve this answer
    
I should have thought of the TestWatcher first, as I had already been using that to report status messages back to Sauce Labs, which I had done in a POC. –  Scott Feb 23 '12 at 20:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.