jadreymis
jadreymis

Reputation: 79

How to get test results of multiple test classes ,after all tests run using Junit

I have 5 test classes and each testclasses include 2 @Test

example:

    class1:
    @Test
    public void c1_test1(){
    //...
    }
    @Test
    public void c1_test2(){
    //...
    }

    class2:
    @Test
    public void c2_test1(){
    //...
    }
    @Test
    public void c2_test2(){
    //...
    }
    ...

I want to get tests result after all Test Suite(All test classes) run Such As:

Class1: c1_test1 : failed Class1: c1_test2 : success

Class2: c2_test1 : failed class2: c2_test2 : success

tried RunListener class but I got results after test level,but how to get results after suite level. Is it possible in Junit?

Upvotes: 1

Views: 380

Answers (1)

Mark Bramnik
Mark Bramnik

Reputation: 42541

Its possible to implement a listener in a way that it will store the results in some "predefined" file or series of files so that after all the tests will be done the result will appear in a file.

Another option is to use the output of the build tool, for example in maven, when you work with surefire/failsafe plugins it produces a "surefire-reports" where the same information is accessible. If you use it - check the "target" folder.

Upvotes: 1

Related Questions