lundi 27 juillet 2015

Catching junits AssertionError prevents surefire to generate reports

Hopefully there is a simple answer to this question...

I have the following code

@Test
public void myTest() {
    try {
        assertTrue(false);
    } catch (AssertionError ae) {
        setSuccess(false); // logging purposes...
    }
}

which will set my test success status as I intend. My problem is that now Surefire doesn't generate a report at /target/surefire-reports/ as it would with following code

@Test
public void myTest() {
    assertTrue(false);
}

Any suggestions how I can react on the AssertionError and still have the surefire report generated?

Aucun commentaire:

Enregistrer un commentaire