-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JUnitReportReporter should capture the test case output at the test c… #2876
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
testng-core/src/test/java/test/junitreports/issue2124/TestClassSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,69 @@ | ||
package test.junitreports.issue2124; | ||
|
||
import org.testng.Assert; | ||
import org.testng.Reporter; | ||
import org.testng.annotations.AfterSuite; | ||
import org.testng.annotations.BeforeSuite; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
public class TestClassSample { | ||
|
||
public static final String MESSAGE_1 = "Teenage Mutant Ninja Turtles"; | ||
public static final String MESSAGE_2 = "Teenage Mutant Ninja Turtles: <i>Out of the Shadows</i>"; | ||
public static final String MESSAGE_3 = | ||
"Teenage Mutant Ninja Turtles: <i>The Secret of the Ooze</i>"; | ||
public static final String MESSAGE_4 = "Teenage Mutant Ninja Turtles: <i>Mutant Mayhem</i>"; | ||
public static final String MESSAGE_5 = | ||
"Teenage Mutant Ninja Turtles: <i>Rise of the Teenage Mutant Ninja Turtles</i>"; | ||
public static final String MESSAGE_BEFORE = "Teenage Mutant Ninja Turtles Movies"; | ||
public static final String MESSAGE_AFTER = "To be continued"; | ||
public static final String MESSAGE_FAIL = "Cowabunga"; | ||
|
||
public static final String TEST_METHOD_WITH_REPORTER = "testReporter"; | ||
public static final String TEST_METHOD_WITH_DATA_PROVIDER_REPORTER = | ||
"testReporterWithDataProvider"; | ||
public static final String TEST_METHOD_FAIL_WITH_REPORTER = "testFailWithReporter"; | ||
public static final String TEST_METHOD_FAIL_NO_REPORTER = "testFailNoReporter"; | ||
public static final String TEST_METHOD_NO_REPORTER = "testNoReporter"; | ||
|
||
@BeforeSuite | ||
public void before() { | ||
Reporter.log(MESSAGE_BEFORE, true); | ||
} | ||
|
||
@AfterSuite | ||
public void after() { | ||
Reporter.log(MESSAGE_AFTER, true); | ||
} | ||
|
||
@Test | ||
public void testReporter() { | ||
Reporter.log(MESSAGE_1, true); | ||
Reporter.log(MESSAGE_2, true); | ||
} | ||
|
||
@DataProvider(name = "testReporterDataProvider") | ||
public Object[][] testReporterDataProvider() { | ||
return new Object[][] {{MESSAGE_3}, {MESSAGE_4}}; | ||
} | ||
|
||
@Test(dataProvider = "testReporterDataProvider") | ||
public void testReporterWithDataProvider(String message) { | ||
Reporter.log(message, true); | ||
} | ||
|
||
@Test | ||
public void testFailWithReporter() { | ||
Reporter.log(MESSAGE_5, true); | ||
Assert.fail(MESSAGE_FAIL); | ||
} | ||
|
||
@Test | ||
public void testFailNoReporter() { | ||
Assert.fail(MESSAGE_FAIL); | ||
} | ||
|
||
@Test | ||
public void testNoReporter() {} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: too much parentheses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take care of fixing this. Going ahead with merging this PR @juherr