RandomizedTesting

码农软件 · 软件分类 · 单元测试工具 · 2019-11-18 21:42:25

软件介绍

RandomizedTesting 是一个 JUnit 测试的扩展,封装了内置重复随机的测试和超时控制、参数工厂、线程执行组等等。

示例代码:

@ThreadLeakScope(Scope.TEST)
@ThreadLeakAction({Action.WARN, Action.INTERRUPT})
@ThreadLeakLingering(linger =1000)
publicstaticclassTheGoodBadAndUglyextendsRandomizedTest {
  @Test
  publicvoidgood() {
    // I do nothing and I'm good.
  }
 
  @Test
  @Repeat(iterations =10)
  publicvoidbad() {
    // I fail randomly, about 20% of the time.
    assertFalse(randomIntBetween(1,100) <=20);
  }
 
  @Test
  publicvoidugly() {
    // I start and abandon a thread which falls
    // outside the test's scope. The test will fail.
    newThread() {
      publicvoidrun() {
        RandomizedTest.sleep(5000);
      }
    }.start();
  }
}

本文地址:https://codercto.com/soft/d/19291.html

The Lean Startup

The Lean Startup

Eric Ries / Crown Business / 2011-9-13 / USD 26.00

更多中文介绍:http://huing.com Most startups fail. But many of those failures are preventable. The Lean Startup is a new approach being adopted across the globe, chan ging the way companies are built and ......一起来看看 《The Lean Startup》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换