use of junit.framework.TestResult in project guava by google.
the class FeatureSpecificTestSuiteBuilderTest method testLifecycle.
public void testLifecycle() {
final boolean[] setUp = { false };
Runnable setUpRunnable = new Runnable() {
@Override
public void run() {
setUp[0] = true;
}
};
final boolean[] tearDown = { false };
Runnable tearDownRunnable = new Runnable() {
@Override
public void run() {
tearDown[0] = true;
}
};
MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
Test test = builder.usingGenerator("yam").named("yam").withFeatures(CollectionFeature.NONE).withSetUp(setUpRunnable).withTearDown(tearDownRunnable).createTestSuite();
TestResult result = new TestResult();
test.run(result);
assertTrue(testWasRun);
assertTrue(setUp[0]);
assertTrue(tearDown[0]);
}
use of junit.framework.TestResult in project nutz by nutzam.
the class AdvancedTestAll method test.
public static TestResult test(List<Request> reqs, String name, Map<Request, Method> reqMap) {
// TODO 根据order文件还原测试顺序
try {
FileWriter fw = new FileWriter("./test_order_" + name + ".txt");
for (Request request : reqs) {
fw.write(reqMap.get(request).toString());
fw.write("\n");
}
fw.flush();
fw.close();
} catch (IOException e) {
}
final TestResult result = new TestResult();
RunNotifier notifier = new RunNotifier();
notifier.addListener(new RunListener() {
public void testFailure(Failure failure) throws Exception {
result.addError(asTest(failure.getDescription()), failure.getException());
}
public void testFinished(Description description) throws Exception {
result.endTest(asTest(description));
}
public void testStarted(Description description) throws Exception {
result.startTest(asTest(description));
}
public junit.framework.Test asTest(Description description) {
return new junit.framework.Test() {
public void run(TestResult result) {
throw Lang.noImplement();
}
public int countTestCases() {
return 1;
}
};
}
});
for (Request request : reqs) {
request.getRunner().run(notifier);
}
return result;
}
use of junit.framework.TestResult in project android_frameworks_base by ParanoidAndroid.
the class InstrumentationTestSuiteBuilderTest method runSuite.
private SuiteExecutionRecorder runSuite(TestSuiteBuilder builder) {
TestSuite suite = builder.build();
SuiteExecutionRecorder recorder = new SuiteExecutionRecorder();
TestResult result = new TestResult();
result.addListener(recorder);
suite.run(result);
return recorder;
}
use of junit.framework.TestResult in project android_frameworks_base by ParanoidAndroid.
the class UnitTestSuiteBuilderTest method runSuite.
private SuiteExecutionRecorder runSuite(TestSuiteBuilder builder) {
TestSuite suite = builder.build();
SuiteExecutionRecorder recorder = new SuiteExecutionRecorder();
TestResult result = new TestResult();
result.addListener(recorder);
suite.run(result);
return recorder;
}
use of junit.framework.TestResult in project android_frameworks_base by DirtyUnicorns.
the class InstrumentationTestSuiteBuilderTest method runSuite.
private SuiteExecutionRecorder runSuite(TestSuiteBuilder builder) {
TestSuite suite = builder.build();
SuiteExecutionRecorder recorder = new SuiteExecutionRecorder();
TestResult result = new TestResult();
result.addListener(recorder);
suite.run(result);
return recorder;
}
Aggregations