Test « New Generation »
http://testng.org/
https://github.com/cbeust/testng
• Créé par Cédric Beust (Google) en avril 2004
• Version 6.5.1
1.0 2.0 4.0 5.0 6.0 6.5
2004 2005 2006 2007 2008 2009 2010 2011 2012
5
@Test
(non parce que c’est une librairie de tests quand même)
expectedExceptions Méthode ou classe
timeOut
dependsOnMethods /
dependsOnGroup
expectedExceptionsMessageRegExp
groups
dataProvider
invocationCount, singleThreaded
threadPoolSize
priority
8
@Test @Listeners(MonListener.class)
public class maClasseDeTests { ... }
public class MonListener implements ITestListener {
public void onTestFailure(ITestResult res) { ... }
public void onFinish(ITestContext cxt) { ... }
18
public class TestNGFactory{
private String foo;
public TestNGFactory(String foo) { this.foo = foo; }
@Factory public Object[] factory() {
return new Object[] {
new TestNGFactory("hello"),
new TestNGFactory("Devoxx") };
}
@Test public void test() {
System.out.println("==> " + foo);
}
}
24
25.
Et plein d'autreschoses…
Logger inclus Rapports de résultats
(xml, html)
Support Guice Support du YAML
Rerun failing tests first Peut lancer du JUnit 3.x
25