To explain my use case, let's take TestNG tutorial 5.7 as an example
(http://testng.org/doc/documentation-main.html#factories)
With @Factory, you can create multiple instances of test classes that
are configured differently. This is very convenient, but when you see
the report, all those instances will look the same, as they are all
named after the test method. So I can't easily distinguish which
WebTest instance failed.
What I'd like to do is to give each WebTest class a different name. I
don't really care how I tell the name to TestNG, but it could be
something like this:
public class WebTest {
private int m_numberOfTimes;
public WebTest(int numberOfTimes) { ... }
@Name
public String getTestName() {
return "WebTest "+m_numberOfTimes;
}
@Test
public void testServer() { ... }
}
The expected semantics is that TestNG finds a method via annotation.
Another possibility might be to do it like IHookable --- define an
interface and a method that returns the name (I like this one better
actually.)
Internally, there's already ITestResult.getName() --- it's just a
matter of having Invoker update the name accordingly.
I hope the development team considers this.
PASSED TESTS | ||
Test method | Time (seconds) | Exception |
test.tmp.B.t (Test1) | 0 | none |
test.tmp.B.t (Test2) | 0 | none |
test.tmp.FactoryTest.f2 | 0 | none |
I'm interested in the same functionality as Kohsuke. Would it be
possible to get the jar file you mentioned?
Regards,
Igor