unit testing - How do I use TestNG SkipException? -
how use testng throw new skipexception() effectively? have example?
i tried throwing exception @ start of test method blows teardown, setup, methods, etc. , , has collateral damage causing few (not all) of subsequent tests skipped also, , shows bunch of garbage on testng html report.
i use testng run unit tests , know how use option @test annotation disable test. test show "existent" on report without counting in net result. in other words, nice if there @test annotation option "skip" test. can mark tests ignored sortof without having test disappear list of tests.
is "skipexception" required thrown in @beforexxx before @test ran? might explain wierdness seeing.
yes, suspicion correct. throwing exception within @test doesn't work, , neither did throwing in @beforetest, while using parallel classes. if that, exception break test setup , testng report show exceptions within of related @configuration methods , may cause subsequent tests fail without being skipped.
but, when throw within @beforemethod, works perfectly. glad able figure out. documentation of class suggests work in of @configuration annotated methods, doing didn't allow me that.
@beforemethod public void beforemethod() { throw new skipexception("testing skip."); }
Comments
Post a Comment