1

In TestNG in @AfterMethod how do I know the test result?

 2 years ago
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?

advertisements

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?

I have bunch of unit/integration tests which creates a report after all the tests are run. At the moment i am passing in a hard coded response to the method that creates report. How can i get the outcome of the test method? so that i can pass in this

How do I know the IP address of my iPhone simulator?

How can I know the IP address of my iPhone simulator?It will have the same IP addresses as the computer you're running it on.

How do I know the actual size of an imageView in my device?

I have an ImageView with matchParent property in width. how can i know its runtime width on my device (using eclipse, without adding code programmatically)? how can I know the conversion ratio between dpi to pxls in my device?I have an ImageView ...

How do I know the device information with the reported incident report in Google Play Store?

A few days back I uploaded my app in the play store. Today I got a crash report and the user comments to my account. How can we know the details of the device from which the crash came. Can anyone tell me how to do this?You can implement the crash re

How does sizeof know the size of the array?

This question already has an answer here: How does sizeof know the size of the operand array? 12 answers I have codes as following: main() { int array[5] = {3,6,9,-8,1}; printf("the size of the array is %d\n", sizeof(array)); printf("the ad

How do I know the hostname on the client server program

I am doing a program about client server communication using sockets. I saw examples of client server program on internet, but I have a question. How to get host name? I saw a client program example on the webpage int the link below. The program gets

How do I know the status of chrome.experimental.socket?

When I use "chrome.experimental.socket API" on chrome-extension, how do I know the socket had been disconnected or, is disconnected just now. I'm use Canary-Chrome.I've just made a change which adds a getInfo call to the socket API, which includ

How do I know the JVM configuration targets?

How can I know the targets of JVM configuration? I know how to set JVM for my server, which can be done by command 'java -Xmx3550m -Xms3550m -Xmn2g -Xss128k'. But what's command can to see what it is like? Any guidance?You can use VisualVm/Jconsole t

How do I know the X and Y coordinates of an ImageView?

I want to know the X and Y co-ordinates of a Imageview . I have to click on a single imageview , but on different positions i have to perfrom different tasks. Kindly suggest me how can i know the X and Y co-ordinates of Imageview. Sorry , I am not po

JMeter: How do I know the reason for java.net.SocketTimeoutException?

i am making load test for my web application, and i set the connect timeout and response timeout to be 20 seconds, and sometimes i am getting exceptions like: Non HTTP response code: java.net.SocketTimeoutException: Non HTTP response message: Read ti

How do I know the reason for the error in the promise rejection manager?

I wrote some code using find method like below. The adapter is RESTAdapter. App.SessionManager = Em.Object.extend({ userIdChanged: function() { App.User.find(this.get('userid')).then( function(user) { /* process something */ }, function(error) { /* r

How do I know the location from where I cloned my git repository

This question already has an answer here: How can I determine the URL that a local Git repository was originally cloned from? 16 answers I have cloned the git repo from my servers to different folders. Now I am confused from where I had cloned few sp

In Bundle, how can I know the type of a value for a given key?

I'm new to Android/Java. I'd like to write a test application where any arbitrary extra that I add to a (custom) intent is printed. When I receive the intent with my BroadcastReceiver, I can get all the extras as Bundle and their keys by: Bundle bund

java: How can I know the type of variable in Object?

I have the following code: void testme(Object a) { # printing the type of the variable transferred to the function } how can I know the type of the variable that passed to that function? for example how can I know the difference if the user executed

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK