junit.framework.Test类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中junit.framework.Test类的一些代码示例,展示了Test类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Test类的具体详情如下:
包路径:junit.framework.Test
类名称:Test

Test介绍

[英]A Test can be run and collect its results.
[中]可以运行测试并收集其结果。

代码示例

代码示例来源:origin: junit-team/junit4

@Override
public void run(RunNotifier notifier) {
  TestResult result = new TestResult();
  result.addListener(createAdaptingListener(notifier));
  getTest().run(result);
}

代码示例来源:origin: junit-team/junit4

/**
 * Informs the result that a test will be started.
 */
public void startTest(Test test) {
  final int count = test.countTestCases();
  synchronized (this) {
    fRunTests += count;
  }
  for (TestListener each : cloneListeners()) {
    each.startTest(test);
  }
}

代码示例来源:origin: stackoverflow.com

function Test() {
 this.a = 'a';
}
Test.prototype.b = 'b';

var test = new Test(); 
test.a; // "a", own property
test.b; // "b", inherited property

代码示例来源:origin: org.testng/testng

protected TestResult doRun(Test suite) {
 TestResult result = createTestResult();
 result.addListener(this);
 suite.run(result);
 return result;
}

代码示例来源:origin: junit-team/junit4

/**
 * The basic run behaviour.
 */
public void basicRun(TestResult result) {
  fTest.run(result);
}

代码示例来源:origin: google/guava

.withTearDown(tearDownRunnable)
    .createTestSuite();
TestResult result = new TestResult();
test.run(result);
assertTrue(testWasRun);
assertTrue(setUp[0]);

代码示例来源:origin: junit-team/junit4

/**
 * Counts the number of test cases that will be run by this test.
 */
public int countTestCases() {
  int count = 0;
  for (Test each : fTests) {
    count += each.countTestCases();
  }
  return count;
}

代码示例来源:origin: stackoverflow.com

public static void main(String args[])
{
  Test t = new Test();
  t.doTask();
  t.get();  // Will block
  System.out.println("done");
}

代码示例来源:origin: stackoverflow.com

Test test = new Test()
Field field = test.getClass().getDeclaredField("x");
field.setAccessible(true);

System.out.println(field.getName() + "="+field.get(test ));

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws IOException {
  Test test=new Test();
  Date fromDate = Calendar.getInstance().getTime();
  System.out.println("UTC Time - "+fromDate);
  System.out.println("GMT Time - "+test.cvtToGmt(fromDate));
}
private  Date cvtToGmt( Date date ){
  TimeZone tz = TimeZone.getDefault();
  Date ret = new Date( date.getTime() - tz.getRawOffset() );

  // if we are now in DST, back off by the delta.  Note that we are checking the GMT date, this is the KEY.
  if ( tz.inDaylightTime( ret )){
    Date dstDate = new Date( ret.getTime() - tz.getDSTSavings() );

    // check to make sure we have not crossed back into standard time
    // this happens when we are on the cusp of DST (7pm the day before the change for PDT)
    if ( tz.inDaylightTime( dstDate )){
      ret = dstDate;
    }
   }
   return ret;
}

代码示例来源:origin: cbeust/testng

protected TestResult doRun(Test suite) {
 TestResult result = createTestResult();
 result.addListener(this);
 suite.run(result);
 return result;
}

代码示例来源:origin: google/j2objc

/**
 * The basic run behaviour.
 */
public void basicRun(TestResult result) {
  fTest.run(result);
}

代码示例来源:origin: google/j2objc

/**
 * Counts the number of test cases that will be run by this test.
 */
public int countTestCases() {
  int count = 0;
  for (Test each : fTests) {
    count += each.countTestCases();
  }
  return count;
}

代码示例来源:origin: google/j2objc

@Override
public void run(RunNotifier notifier) {
  TestResult result = new TestResult();
  result.addListener(createAdaptingListener(notifier));
  getTest().run(result);
}

代码示例来源:origin: junit-team/junit4

public TestResult doRun(Test suite, boolean wait) {
  TestResult result = createTestResult();
  result.addListener(fPrinter);
  long startTime = System.currentTimeMillis();
  suite.run(result);
  long endTime = System.currentTimeMillis();
  long runTime = endTime - startTime;
  fPrinter.print(result, runTime);
  pause(wait);
  return result;
}

代码示例来源:origin: junit-team/junit4

public void runTest(Test test, TestResult result) {
  test.run(result);
}

代码示例来源:origin: google/j2objc

/**
 * Informs the result that a test will be started.
 */
public void startTest(Test test) {
  final int count = test.countTestCases();
  synchronized (this) {
    fRunTests += count;
  }
  for (TestListener each : cloneListeners()) {
    each.startTest(test);
  }
}

代码示例来源:origin: junit-team/junit4

public int countTestCases() {
  return fTest.countTestCases();
}

代码示例来源:origin: stackoverflow.com

Test x = new Test();
Test y = new Test();
x.instanceVariable = 10;
y.instanceVariable = 20;
System.out.println(x.instanceVariable);

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public void run(RunNotifier notifier) {
  TestResult result = new TestResult();
  result.addListener(createAdaptingListener(notifier));
  getTest().run(result);
}

相关文章