How to know whether the @Test is passing or failing from Junit programmatically?

515 views
Skip to first unread message

Sudhansu Sekhar panda

unread,
Jun 4, 2014, 9:27:37 AM6/4/14
to seleniu...@googlegroups.com
Hi All,

I know the below question is not related to this group but still i am asking...If someone might have come accross with this scenario can help me out...

Suppose I am running a @Test annotation in Junit..How to know that whether the @Test is passing or failing from Junit programmatically? Is there any way to do this kind of scenario?

My intention is to capture the result of the test either fail or pass for the JUint. At the end of the test run I need to know the status of the test.

Currently I am executing with the help of @Test annotations

import junit.framework.Assert;
import org.junit.Test;

public class TestApp2 {

 @Test
 public void testPrintHelloWorld2() {     
  Assert.assertEquals(App.getHelloWorld2(), "Hello World 2");     
 }     
}
My point here is to verify the status of the @Test. Here in the above example if the assertion will fail then the JUNIT will fail. But I want to know how the JUNIT is failing - how to know that the JUNIT is failing. My intention is not check the Juint console to check whether the @Test passed or failed.

Thanks,

Sudhansu

Krishnan Mahadevan

unread,
Jun 4, 2014, 9:42:38 AM6/4/14
to Selenium Users

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3f60e5b8-b593-4b88-9b03-74060c905c39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages