Thursday, 31 January 2013

Reporting Results | Selenium Tutorial pdf

Reporting Results

Selenium-RC does not have its own mechanism for reporting results. Rather, it allows you to build your reporting customized to your needs using features of your chosen programming language. That’s great, but what if you simply want something quick that’s already done for you? Often an existing library or test framework will exist that can meet your needs faster than developing your own test reporting code.

=> Test Framework Reporting Tools

Test frameworks are available for many programming languages. These, along with their primary function of providing a flexible test engine for executing your tests, include library code for reporting results.
For example, Java has two commonly used test frameworks, JUnit and TestNG. .NET also has its own, NUnit.
We won’t teach the frameworks themselves here; that’s beyond the scope of this user guide. We will simply introduce the framework features that relate to Selenium along with some techniques you can apply. Their are good books available on these test frameworks however along with information on the internet.

=> Test Report Libraries

Also available are third-party libraries specifically created for reporting test results in your chosen  programming language. These often support a variety of formats such as HTML or PDF.

=> What’s The Best Approach?

Most people new to the testing frameworks will being with the framework’s built-in reporting features.
From there most will examine any available libraries as that’s less time consuming than developing your own. As you begin to use Selenium no doubt you will start putting in your own “print statements” for reporting progress. That may gradually lead to you developing your own reporting, possibly in parallel to using a library or test framework. Regardless, after the initial, but short, learning curve you will naturally develop what works best for your own situation.

=> Test Reporting Examples

To illustrate, we’ll direct you to some specific tools in some of the other languages supported by Selenium.
The ones listed here are commonly used and have been used extensively (and therefore recommended) by the authors of this guide.
Test Reports in Java
=> If Selenium Test cases are developed using JUnit then JUnit Report can be used to generate test reports. Refer to JUnit Report for specifics.
=> If Selenium Test cases are developed using TestNG then no external task is required to generate test reports. The TestNG framework generates an HTML report which list details of tests. See TestNG Report for more.
=> ReportNG is a HTML reporting plug-in for the TestNG framework. It is intended as a replacement for the default TestNG HTML report. ReportNG provides a simple, colour-coded view of the test results. See ReportNG for more.
=> Also, for a very nice summary report try using TestNG-xslt. A TestNG-xslt Report looks like this.

See TestNG-xslt for more.
Logging the Selenese Commands
=> Logging Selenium can be used to generate a report of all the Selenese commands in your test along with the success of failure of each. Logging Selenium extends the Java client driver to add this Selenense logging ability. Please refer to Logging Selenium.
Test Reports for Python
=> When using Python Client Driver then HTMLTestRunner can be used to generate a Test Report.
See HTMLTestRunner.
Test Reports for Ruby
=> If RSpec framework is used for writing Selenium Test Cases in Ruby then its HTML report can be used to generate test report. Refer to RSpec Report for more.
Note: If you are interested in a language independent log of what’s going on, take a look at Selenium Server Logging.

No comments: