mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix #188: display response image in html report
This commit is contained in:
37
tests/httpbin/load_image.yml
Normal file
37
tests/httpbin/load_image.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
- config:
|
||||
name: load images
|
||||
request:
|
||||
base_url: https://httpbin.org
|
||||
|
||||
- test:
|
||||
name: get png image
|
||||
request:
|
||||
url: /image/png
|
||||
method: GET
|
||||
validators:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
name: get jpeg image
|
||||
request:
|
||||
url: /image/jpeg
|
||||
method: GET
|
||||
validators:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
name: get webp image
|
||||
request:
|
||||
url: /image/webp
|
||||
method: GET
|
||||
validators:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
name: get svg image
|
||||
request:
|
||||
url: /image/svg
|
||||
method: GET
|
||||
validators:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
@@ -135,3 +135,13 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
self.assertTrue(summary["success"])
|
||||
self.assertEqual(summary["stat"]["testsRun"], 1)
|
||||
self.assertEqual(summary["records"][0]["meta_data"]["response_body"]["data"], "abc")
|
||||
|
||||
def test_html_report_repsonse_image(self):
|
||||
testset_path = "tests/httpbin/load_image.yml"
|
||||
runner = HttpRunner().run(testset_path)
|
||||
summary = runner.summary
|
||||
output_folder_name = os.path.basename(os.path.splitext(testset_path)[0])
|
||||
report = runner.gen_html_report(html_report_name=output_folder_name)
|
||||
self.assertTrue(os.path.isfile(report))
|
||||
report_save_dir = os.path.join(os.getcwd(), 'reports', output_folder_name)
|
||||
shutil.rmtree(report_save_dir)
|
||||
|
||||
Reference in New Issue
Block a user