So this seems to already be better in the similar TestNG version. TestNG
will smartly display _both_ errors!
Misha
package com.mksoft.fbautomate.facebook
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
}
}
On Thu, 2010-06-10 at 14:00 -0500, Misha Koshelev wrote:
> Dear All:
>
> Perhaps this is expected but it certainly had me stumped for a few
> hours. Apparently errors in @After statements take precedence over those
> in @Test statements, thus if both:
> a) a @Test fails
> and
> b) and @After fails
>
> You will only get the @After failure in the report (e.g., if there is an
> assertion in the @After statement you will never see the exception)
>
> Here is sample code:
>
> 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
> }
> }
>
> You will see the blah error but not the asdf error.
>
> This looks quite simple, but when there is an assert somewhere in a call
> in the After that goes awry, can be quite devastating/confusing.
>
> Thank you!
> Misha
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email