java - How can we get results of successfully run tests in TestNG even when the run gets terminated abruptly? -
i'm pretty new testng hailing cucumber background. in current project, jenkins jobs configured maven , testng, using java , selenium scripting.
any job, 30 tests, if takes 2hrs complete, when abruptly terminated due reason on last minute, not results of tests run successfully. hence forced run again entire job. see error stack trace , result as:
results :tests run: 0, failures: 0, errors: 0, skipped: 0
i sure there better way of designing this, hoping better approaches.
- how can make sure not lose results of tests did run successfully(though passed/failed)?
- is test management tool or entity store run time results , mandatory requirement or testng has provision built-in?
how can make sure not lose results of tests did run successfully(though passed/failed)?
there 2 ways in can build reporting testng driven tests.
- batched mode - how testng reports built. listener implements
org.testng.ireporter
interface built , withingeneratereport()
, logic of consolidating test results report carried out. - realtime mode - done implementing testng listener
org.testng.iinvokedmethodlistener
, withinafterinvocation()
following :- check type of incoming
org.testng.iinvokedmethod
(to see if configuration method (or)@test
method ) , handle these types of methods differently (if report needs show them separately). test status oforg.testng.itestresult
, based on status, show thempass/fail/skipped
- check type of incoming
ireporter
implementations run @ end after tests have run (which why call them batched mode). if crashes towards end before reporting phase executed, lose execution data.
so might want try , build realtime reporting model. can take @ runtimereporter report selion uses. built on realtime model.
is test management tool or entity store run time results , mandatory requirement or testng has provision built-in?
there no such mandatory requirements testng places. explained above, boils down how constructing reports. if constructing reports in realtime fashion (you can leverage templating engines such velocity/freemarker/thymeleaf) build reporting template , use iinvokedmethodlistener
inject values template, can rendered easily.
read more here comparison on templating engines can choose fits need.
wiki
Comments
Post a Comment