mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 00:09:37 +08:00
refactor run times: display test statistics correctly with run times setting
This commit is contained in:
24
tests/test_cli.py
Normal file
24
tests/test_cli.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from httprunner.task import TaskSuite
|
||||
from pyunitreport import HTMLTestRunner
|
||||
from tests.base import ApiServerUnittest
|
||||
|
||||
|
||||
class TestCli(ApiServerUnittest):
|
||||
|
||||
def test_run_times(self):
|
||||
testset_path = "tests/data/demo_testset_cli.yml"
|
||||
output_folder_name = os.path.basename(os.path.splitext(testset_path)[0])
|
||||
kwargs = {
|
||||
"output": output_folder_name
|
||||
}
|
||||
|
||||
task_suite = TaskSuite(testset_path)
|
||||
result = HTMLTestRunner(**kwargs).run(task_suite)
|
||||
self.assertEqual(result.testsRun, 5)
|
||||
|
||||
report_save_dir = os.path.join(os.getcwd(), 'reports', output_folder_name)
|
||||
shutil.rmtree(report_save_dir)
|
||||
Reference in New Issue
Block a user