Home>

The method of installing the htmltestrunner library is very simple,Just pip it.

pip install html-testrunner

You can search directly inAnd the official also provided detailed documentation,Very easy to operate

Official sample code:

import htmltestrunner
import unittest
class teststringmethods (unittest.testcase):
  def test_upper (self):
    self.assertequal ("foo" .upper (), "foo")
  def test_error (self):
    "" "this test should be marked as error one." ""
    raise valueerror
  def test_fail (self):
    "" "this test should fail." ""
    self.assertequal (1, 2)
  @ unittest.skip ("this is a skipped test.")
  def test_skip (self):
    "" "this test should be skipped." ""
    pass
if __name__ == "__main__":
  unittest.main (testrunner=htmltestrunner.htmltestrunner (output="example_dir"))

This is after running,Generated html page

  • Previous C ++ to achieve dynamic linear table
  • Next thinkphp51 Framework import/export excel file operation example