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.

  1. how can make sure not lose results of tests did run successfully(though passed/failed)?
  2. 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.

  1. batched mode - how testng reports built. listener implements org.testng.ireporter interface built , within generatereport(), logic of consolidating test results report carried out.
  2. realtime mode - done implementing testng listener org.testng.iinvokedmethodlistener , within afterinvocation() 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 of org.testng.itestresult , based on status, show them pass/fail/skipped

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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -