repeattestsuite.java
来自「SRI international 发布的OAA框架软件」· Java 代码 · 共 73 行
JAVA
73 行
/*
#=========================================================================
# Copyright 2003 SRI International. All rights reserved.
#
# The material contained in this file is confidential and proprietary to SRI
# International and may not be reproduced, published, or disclosed to others
# without authorization from SRI International.
#
# DISCLAIMER OF WARRANTIES
#
# SRI International MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
# SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SRI International SHALL NOT BE
# LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
#=========================================================================
Author : shardt
Date: Oct 17, 2003
*/
package com.sri.oaa2.tools.oaatest;
import junit.framework.*;
/** An extension of junit.framework.TestCase that allows the tests inside to be
* run repeatedly.
*/
class RepeatTestSuite extends TestSuite implements TestListener {
RepeatTestSuite(int count) {
super("Repeat " + count);
this.count = count;
}
public void run(TestResult result) {
// Quit if any of the child tests hits an error or failure.
result.addListener(this);
problem = false;
for (int n = 0; n < count; n++) {
super.run(result);
if (problem) {
break;
}
}
result.removeListener(this);
}
/** This value may be off. Returns the number of test cases run if
* successful. But, RepeatTestSuite will stop looping if it hits
* an error, so may actually run fewer tests.
*/
public int countTestCases() {
return count * super.countTestCases();
}
public void addError(Test test, java.lang.Throwable t) {
problem = true;
}
public void addFailure(Test test, AssertionFailedError t) {
problem = true;
}
public void endTest(Test test) {
}
public void startTest(Test test) {
}
boolean problem;
int count;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?