In TestNG in @AfterMethod how do I know the test result?
source link: https://www.codesd.com/item/in-testng-in-aftermethod-how-do-i-know-the-test-result.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
In TestNG in @AfterMethod how do I know the test result?
I have a number of TestNG test classes that all extend one base class AbstractIntegrationTest
. In the superclass I have a mehod commonAfterMethod
which is invoked after each test method and performs some clean-up.
What I want is to do in this method something depending on the test result, e.g. if the test fails, I want to dump the test data into a file for further investigation. The problem is that I need to do it exactly in commonAfterMethod
because it performs a roll-back on the database and the data is lost afterwards.
Thanx
Perhaps you can do something with a test listener instead? See ITestListener and IInvokedMethodListener.
Related Articles
How do I pass the test result to a different method in unit tests / C # integration?
How do I know the IP address of my iPhone simulator?
How do I know the actual size of an imageView in my device?
How do I know the device information with the reported incident report in Google Play Store?
How does sizeof know the size of the array?
How do I know the hostname on the client server program
How do I know the status of chrome.experimental.socket?
How do I know the JVM configuration targets?
How do I know the X and Y coordinates of an ImageView?
JMeter: How do I know the reason for java.net.SocketTimeoutException?
How do I know the reason for the error in the promise rejection manager?
How do I know the location from where I cloned my git repository
In Bundle, how can I know the type of a value for a given key?
java: How can I know the type of variable in Object?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK