From 9a969b295e80e5efa8ee50c430c5db9fdc44e1de Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 21 May 2020 17:34:51 +0800 Subject: [PATCH] feat: builtin allure report --- docs/CHANGELOG.md | 1 + httprunner/runner.py | 4 +++- poetry.lock | 36 +++++++++++++++++++++++++++++++++++- pyproject.toml | 1 + 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a87ecc09..94777e44 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,7 @@ **Added** - feat: add default header `HRUN-Request-ID` for each testcase #721 +- feat: builtin allure report **Fixed** diff --git a/httprunner/runner.py b/httprunner/runner.py index a3ab7315..b6ed0fbb 100644 --- a/httprunner/runner.py +++ b/httprunner/runner.py @@ -1,6 +1,7 @@ import os import time import uuid +import allure from datetime import datetime from typing import List, Dict, Text @@ -207,7 +208,8 @@ class HttpRunner(object): step.variables, self.__project_meta.functions ) # run step - extract_mapping = self.__run_step(step) + with allure.step(f"step: {step.name}"): + extract_mapping = self.__run_step(step) # save extracted variables to session variables self.__session_variables.update(extract_mapping) diff --git a/poetry.lock b/poetry.lock index 8cc0bcd1..e373caa9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -12,6 +12,32 @@ version = "0.2.2" python = "<3.7" version = "2.4" +[[package]] +category = "main" +description = "Allure pytest integration" +name = "allure-pytest" +optional = false +python-versions = "*" +version = "2.8.15" + +[package.dependencies] +allure-python-commons = "2.8.15" +pytest = ">=4.5.0" +six = ">=1.9.0" + +[[package]] +category = "main" +description = "Common module for integrate allure with python-based frameworks" +name = "allure-python-commons" +optional = false +python-versions = "*" +version = "2.8.15" + +[package.dependencies] +attrs = ">=16.0.0" +pluggy = ">=0.4.0" +six = ">=1.9.0" + [[package]] category = "main" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." @@ -516,7 +542,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "be53fb0cd423bac9dda129a958a58026009a99a455081333d7af51c22a4df8cf" +content-hash = "67027f8f78c61b981f3c01613ded1da2a0256a28fb92f95dd2d642b3fd1b43a5" python-versions = "^3.6" [metadata.files] @@ -524,6 +550,14 @@ aiocontextvars = [ {file = "aiocontextvars-0.2.2-py2.py3-none-any.whl", hash = "sha256:885daf8261818767d8f7cbd79f9d4482d118f024b6586ef6e67980236a27bfa3"}, {file = "aiocontextvars-0.2.2.tar.gz", hash = "sha256:f027372dc48641f683c559f247bd84962becaacdc9ba711d583c3871fb5652aa"}, ] +allure-pytest = [ + {file = "allure-pytest-2.8.15.tar.gz", hash = "sha256:27f9c75194e95ba069ee2d6d2a2615ed6c7e96617ff9a492ab3a74f3f4e64be2"}, + {file = "allure_pytest-2.8.15-py3-none-any.whl", hash = "sha256:62512bbce3d39b27a8e7ffbfb24e08e99c43df29b4f345168dfc9692bfddef71"}, +] +allure-python-commons = [ + {file = "allure-python-commons-2.8.15.tar.gz", hash = "sha256:c4768e5e1350fe2eb6e1c9dac6158dcb82e23de80c83c4fc6d71765c207c1408"}, + {file = "allure_python_commons-2.8.15-py3-none-any.whl", hash = "sha256:88ad53109b6fa57e6b721f4eab59116db6037e219bf54e1f196a222ba5e2dcfe"}, +] appdirs = [ {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, diff --git a/pyproject.toml b/pyproject.toml index 5c47f4bf..9a499654 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ loguru = "^0.4.1" jmespath = "^0.9.5" black = "^19.10b0" pytest = "^5.4.2" +allure-pytest = "^2.8.15" [tool.poetry.dev-dependencies] coverage = "^4.5.4"