1. Html Test Runner Python Interview
  2. Htmltestrunner Python 3

The dedicated test runner. Code completion for test subject and pytest fixtures. Code navigation. Detailed failing assert reports. Support for Python 2.7 and Python 3.5 and later. Multiprocessing test execution. By default, the suggested default test runner is unittest. So, to utilize pytest, you need to make it the default test runner first. Online Python IDE is a web-based tool powered by ACE code editor. This tool can be used to learn, build, run, test your python script. You can open the script from your local and continue to build using this IDE. You've written some unit tests for your Python app. There are dozens of us, dozens! You don't always remember to run your tests, or worse, your colleagues don't always remember to run them. Wouldn't it be nice to automatically run unit tests on every commit to GitHub? What about on every pull request? You can do this with GitHub.

Once you have a Selenium test run, you need to analyze the results as well. For that you need to have all your test reports organized clearly, and run properly so that you have the visibility and the run reports all at one place so that you can take a look at it better.

Once of the most common disadvantages of Selenium is that it doesn’t allows you the reporting capability. You need to have a third party framework to help obtain a well detailed report of the tests that you run.

For Java, we have TestNG which serves this purpose. For Python, we have

  • HTMLTestRunner
  • Allure
  • Nose

which allows us to take out a well detailed report in HTML format.

Today we will see how we can use the HTMLTestRunner to generate a HTML report for our Selenium tests.

We will

  • Create a simple suite of test cases
  • Use HTMLTestRunner to generate an HTML report of the test cases in test suite.

Creating A Test Suite

A Test Suite is a collection of two or more test scripts, run together using a single runner. So, in a test suite, we would combine many test scripts and then call them together so that they are executed one by one.

Let us take two simple scripts .

This is a very simple script, where we are opening the wikipedia page and typing Sachin Tendulkar in search box of wiki webpage.

Let’s take another simple script

In this script, we’re opening the Youtube home page and typing Metallica in the search box.

Html Test Runner Python Interview

Once we have both the scripts, let’s create a test suite for both these test cases

Now, we have our test suite. The suite takes the HTMLTestRunner extension and runs a tests and then creates a nice report out of it.

Runner

Htmltestrunner Python 3

Let’s have a look at the report

It looks good. It’s not as fancy as the one provided by Allure, but it does the work. The HTMLTestRunner along with the test suite scripts are here in my repo.