mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
feat: report tests start event and running exception to sentry
This commit is contained in:
+5
-1
@@ -1,6 +1,10 @@
|
|||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
## 2.4.6 (2019-12-21)
|
## 2.4.6 (2019-12-23)
|
||||||
|
|
||||||
|
**Added**
|
||||||
|
|
||||||
|
- feat: report tests start event and running exception to sentry
|
||||||
|
|
||||||
**Fixed**
|
**Fixed**
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from sentry_sdk import capture_message
|
||||||
|
|
||||||
from httprunner import (__version__, exceptions, loader, logger, parser,
|
from httprunner import (__version__, exceptions, loader, logger, parser,
|
||||||
report, runner, utils)
|
report, runner, utils)
|
||||||
|
|
||||||
@@ -183,6 +185,7 @@ class HttpRunner(object):
|
|||||||
def run_tests(self, tests_mapping):
|
def run_tests(self, tests_mapping):
|
||||||
""" run testcase/testsuite data
|
""" run testcase/testsuite data
|
||||||
"""
|
"""
|
||||||
|
capture_message("start to run tests")
|
||||||
project_mapping = tests_mapping.get("project_mapping", {})
|
project_mapping = tests_mapping.get("project_mapping", {})
|
||||||
self.project_working_directory = project_mapping.get("PWD", os.getcwd())
|
self.project_working_directory = project_mapping.get("PWD", os.getcwd())
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -1,7 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from sentry_sdk import capture_exception
|
||||||
from httprunner import __description__, __version__
|
from httprunner import __description__, __version__
|
||||||
from httprunner.api import HttpRunner
|
from httprunner.api import HttpRunner
|
||||||
from httprunner.compat import is_py2
|
from httprunner.compat import is_py2
|
||||||
@@ -101,8 +101,9 @@ def main():
|
|||||||
report_file=args.report_file
|
report_file=args.report_file
|
||||||
)
|
)
|
||||||
err_code |= (0 if summary and summary["success"] else 1)
|
err_code |= (0 if summary and summary["success"] else 1)
|
||||||
except Exception:
|
except Exception as ex:
|
||||||
color_print("!!!!!!!!!! exception stage: {} !!!!!!!!!!".format(runner.exception_stage), "YELLOW")
|
color_print("!!!!!!!!!! exception stage: {} !!!!!!!!!!".format(runner.exception_stage), "YELLOW")
|
||||||
|
capture_exception(ex)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
return err_code
|
return err_code
|
||||||
|
|||||||
Reference in New Issue
Block a user