diff --git a/CHANGES.txt b/CHANGES.txt index fb9ca2aa01..bae4930da5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,6 @@ Current 7.6.0 +Fixed: GITHUB-2741: Show fully qualified name of the test instead of just the function name for better readability of test output.(Krishnan Mahadevan) Fixed: GITHUB-2726: @AfterClass config method is executed for EACH @Test method when parallel == methods (Krishnan Mahadevan) Fixed: GITHUB-2752: TestListener is being lost when implenting both IClassListener and ITestListener (Krishnan Mahadevan) New: GITHUB-2724: DataProvider: possibility to unload dataprovider class, when done with it (Dzmitry Sankouski) diff --git a/testng-core-api/src/main/java/org/testng/internal/Utils.java b/testng-core-api/src/main/java/org/testng/internal/Utils.java index 75f786a5b1..b304d78adb 100644 --- a/testng-core-api/src/main/java/org/testng/internal/Utils.java +++ b/testng-core-api/src/main/java/org/testng/internal/Utils.java @@ -455,6 +455,14 @@ public static String detailedMethodName(ITestNGMethod method, boolean fqn) { return tempName + (fqn ? method.toString() : method.getMethodName()); } + public static String detailedMethodName(ITestNGMethod method) { + String tempName = annotationFormFor(method); + if (!tempName.isEmpty()) { + tempName += " "; + } + return tempName + method.getQualifiedName(); + } + /** * Given a TestNG method, returns the corresponding annotation based on the method type * diff --git a/testng-core/src/main/java/org/testng/reporters/TextReporter.java b/testng-core/src/main/java/org/testng/reporters/TextReporter.java index e43494e3e6..3b37e42294 100644 --- a/testng-core/src/main/java/org/testng/reporters/TextReporter.java +++ b/testng-core/src/main/java/org/testng/reporters/TextReporter.java @@ -50,7 +50,7 @@ private void logResults(ITestContext context) { logResult( "FAILED CONFIGURATION", - Utils.detailedMethodName(tr.getMethod(), false), + Utils.detailedMethodName(tr.getMethod()), tr.getMethod().getDescription(), stackTrace, tr.getParameters(), @@ -61,7 +61,7 @@ private void logResults(ITestContext context) { for (ITestResult tr : results) { logResult( "SKIPPED CONFIGURATION", - Utils.detailedMethodName(tr.getMethod(), false), + Utils.detailedMethodName(tr.getMethod()), tr.getMethod().getDescription(), null, tr.getParameters(), @@ -129,7 +129,7 @@ private void logResults(ITestContext context) { private void logResult(String status, ITestResult tr, String stackTrace) { logResult( status, - tr.getName(), + tr.getMethod().getQualifiedName(), tr.getMethod().getDescription(), stackTrace, tr.getParameters(), diff --git a/testng-core/src/test/java/test/reports/ReportTest.java b/testng-core/src/test/java/test/reports/ReportTest.java index c53e5dde4e..fbfa491ead 100644 --- a/testng-core/src/test/java/test/reports/ReportTest.java +++ b/testng-core/src/test/java/test/reports/ReportTest.java @@ -301,8 +301,10 @@ public void reportCreatedWithNullParameter() { System.setOut(new PrintStream(systemOutCapture)); tng.run(); System.setOut(previousOut); + String actual = systemOutCapture.toString(); Assert.assertTrue( - systemOutCapture.toString().contains("PASSED: testMethod(null, \"Bazinga!\")")); + actual.contains( + "PASSED: test.reports.ReportTest$NullParameter.testMethod(null, \"Bazinga!\")")); } }