0% found this document useful (0 votes)
23 views1 page

Runner

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Runner

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Test Runners

Test runner is used for executing the test cases. Here is an example that assumes
the test class TestJunit already exists.
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

public class TestRunner {


public static void main(String[] args) {
Result result = JUnitCore.runClasses(TestJunit.class);

for (Failure failure : result.getFailures()) {


System.out.println(failure.toString());
}

System.out.println(result.wasSuccessful());
}
}

JUnit Classes
JUnit classes are important classes, used in writing and testing JUnits. Some of the
important classes are −
 Assert − Contains a set of assert methods.
 TestCase − Contains a test case that defines the fixture to run multiple tests.
 TestResult − Contains methods to collect the results of executing a test
case.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy