public static List<ITestNGMethod> invokedMethodsToMethods(Collection<IInvokedMethod> invokedMethods) { List<ITestNGMethod> result = Lists.newArrayList(); for (IInvokedMethod im : invokedMethods) { ITestNGMethod tm = im.getTestMethod(); tm.setDate(im.getDate()); result.add(tm); } return result; }
public static List<ITestNGMethod> invokedMethodsToMethods( Collection<IInvokedMethod> invokedMethods) { List<ITestNGMethod> result = Lists.newArrayList(); for (IInvokedMethod im : invokedMethods) { ITestNGMethod tm = im.getTestMethod(); tm.setDate(im.getDate()); result.add(tm); } return result; }
startDate = iim.getDate(); String date = format.format(iim.getDate()); bw.append("<tr bgcolor=\"").append(createColor(tm)).append("\">") .append(" <td>").append(date).append("</td> ") .append(" <td>").append(Long.toString(iim.getDate() - startDate)).append("</td> ") .append(td(configurationSuiteMethod)) .append(td(configurationTestMethod))
/** * Fix for: * https://github.com/juherr/testng-googlecode/issues/7 * https://github.com/juherr/testng-googlecode/issues/86 * https://github.com/cbeust/testng/issues/93 */ @Test public void sameMethodInvokedMultipleTimesShouldHaveDifferentTimeStamps() { TestNG tng = create(Sample.class); InvokedMethodListener listener = new InvokedMethodListener(); tng.addListener((ITestNGListener) listener); tng.run(); List<IInvokedMethod> m = listener.getInvokedMethods(); IInvokedMethod beforeSuite = m.get(0); Assert.assertFalse(beforeSuite.getTestMethod().isAfterMethodConfiguration()); Assert.assertTrue(beforeSuite.isConfigurationMethod()); IInvokedMethod after1 = m.get(2); Assert.assertTrue(after1.getTestMethod().isAfterMethodConfiguration()); Assert.assertTrue(after1.isConfigurationMethod()); IInvokedMethod after2 = m.get(4); Assert.assertTrue(after2.getTestMethod().isAfterMethodConfiguration()); Assert.assertTrue(after2.isConfigurationMethod()); Assert.assertTrue(after1.getDate() != after2.getDate()); }