How do I capture java.util.logging output in TestNG?

Posted by Misha Koshelev on Stack Overflow See other posts from Stack Overflow or by Misha Koshelev
Published on 2010-06-10T19:17:21Z Indexed on 2010/06/10 19:22 UTC
Read the original article Hit count: 371

Filed under:
|

Dear All:

I am sorry just wanted to know if this was possible?

I have discovered an interesting issue with JUnit and am looking for alternatives.

Thank you Misha

p.s. Here is JUnit issue:

import org.junit.After
import org.junit.Before
import org.junit.Test
import static org.junit.Assert.*

class MyTestTest {
 @Before public void beforeTests() {
   println "Before"
 }

 @Test public void testLogin() {
   println "Before asdf"
asdf
   println "After asdf"
 }

 @After public void logoutOfMyTest() {
   println "After"
blah
 }
}

JUnit only reports error related to blah.

Whereas TestNG reports both:

import org.testng.annotations.*

class MyTestTest {
 @BeforeClass public void beforeTests() {
   println "Before"
 }

 @Test public void testLogin() {
   println "Before asdf"
asdf
   println "After asdf"
 }

 @AfterClass public void logoutOfMyTest() {
   println "After"
blah

 }
}

Thank you! Misha

© Stack Overflow or respective owner

Related posts about logging

Related posts about testng