0

I am using Selenium framework for my test cases execution. I need an instant report of test cases that are passed while the full suite is in execution currently. For Eg: There are 100 test cases in suite and five have run of which 3 passed, 2 failed and I need these instant report while the suite is in-progress. Can you please help me with this task?

2
  • Tell us what you already tried and what is not working. Please read stackoverflow.com/help/how-to-ask Commented Jun 7, 2016 at 12:14
  • I do have an automation suite that generates testNG and ATUreports after the code execution and i can view the progress in console. But i need the status of tc's passed/failed while the suite is in execution. Commented Jun 7, 2016 at 12:38

1 Answer 1

1

You can use ExtentReport.

You can use it to log your test steps and once its done it will generate a report to show your results.

For what your looking for, ExtentReport uses a "flush".

If you call this flush after each test step it will amend the step and create the report.

This is something I'm looking into myself at the moment, so I wouldn't consider this an answer but something I've stumbled across myself, hope it helps.

Here is how to set up ExtentReports on your project with examples - http://www.ontestautomation.com/creating-html-reports-for-your-selenium-tests-using-extentreports/

You must use it in conjunction with a test runner eg. TestNG or JUnit.

For what you are trying to achieve is slightly different to the example. You need to call a flush after every test step so it will amend to the report after the step is completed rather than when all the tests are completed. Its not something I have done before but it was explained to me like the following

Just call .flush() after every test instead of once at the end of your test run. BUT you need to make sure the ExtentReports object itself is only initialized once, instead of being reinitialized at the start of every test. For example, I used TestNG. The ExtentReports is called once using @BeforeSuite, but the .flush() is called after every test using @AfterMethod. I hope this makes sense.

The only thing that can’t be solved via code is the HTML refresh as this is outside the control of the ExtentReports library (it doesn’t know where you’ve opened the actual HTML file). But this can be taken care of by using a simple browser plugin as I said. At least for Chrome there are a lot of them, just do a Google search for ‘chrome auto refresh’.

Hope this helps. If you need anymore advice don't hesitate to contact me.

Sign up to request clarification or add additional context in comments.

10 Comments

Up rate for introducing something new for me "ExtentReport"
Thanks Colin. So you mean to say, instant status of pass/fail for current suite can be generated only at the end of execution?
Yes, if you use the report as the logger feature. I will update my question further.
@GauravLad Thank you. Its a very good feature to use with your TestRunner and the creators of it are very helpful. It is an opensource project so you can give them your own recommendations and they will add it to the next update :)
@colin Thanks and this makes sense. Willl the same apply for ATU reports as well>
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.