executing tests methods in classes where used annotation @RunWith(PowerMockRunner.class)`

34 views
Skip to first unread message

Pavlo Rozbytskyi

unread,
Sep 28, 2018, 7:35:50 AM9/28/18
to PowerMock
This method allows you execute all test methods in classes DataContainerTest.class and AnotherTest.class annotated with @Test. 

public
static void main(String [] args) throws Exception {
Result result = JUnitCore.runClasses(DataContainerTest.class, AnotherTest.class);
System.out.println(result.getRunCount());
System.out.println("Total number of tests " + result.getRunCount());
System.out.println("Total number of tests failed: " + result.getFailureCount());

for(Failure failures : result.getFailures()){
System.out.println(failures.getMessage());
} System.out.println(result.wasSuccessful());
}

How can I do the same with classes used annotations @RunWith(PowerMockRunner.class) and @PrepareForTest({Helper.class, etc.})?
@RunWith(PowerMockRunner.class)
@PrepareForTest({Helper.class, UtilsPlatform.class})
public class CommandsTest {

@Test
public void greatTest(){
//Code
}

















 

Reply all
Reply to author
Forward
0 new messages