Comments (5)
Allure output for test, failed with 'with check:'
/home/den/Codding/logs/rep_27_07_check/fd002fa9-9f2b-42ae-8961-0dc37074ea72-result.json:1:{"name": "test_fail_scenario[4-5-G/C-json_result0]", "status": "failed", "parameters": [{"name": "first_source", "value": "4"}, {"name": "second_source", "value": "5"}, {"name": "result", "value": "'G/C'"}, {"name": "json_result", "value": "{'additional_text': 'Entertainment stop', 'additional_text_info': 'Info stop', 'additional_text_after_stop_interruption': '', 'additional_text_info_after_stop_interruption': '', 'source_id_state': '2', 'interrupt_id_state': '0', 'source_action': '2', 'interrupt_action': '0', 'action_after_stop_interruption': '', 'source_id_state_after_stop_interruption': '0'}"}], "start": 1595866982848, "stop": 1595866986382, "uuid": "cfd0cf0e-de4b-4183-9445-0149a45a96a9", "historyId": "bed0cfa61c2e91ba71667fc442eb4b72", "fullName": "regression.audiomanagement.test_jira_reporting#test_fail_scenario[4-5-G/C-json_result0]", "labels": [{"name": "parentSuite", "value": "regression.audiomanagement"}, {"name": "suite", "value": "test_jira_reporting"}, {"name": "host", "value": "den-pc"}, {"name": "thread", "value": "151296-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "regression.audiomanagement.test_jira_reporting"}], "links": [{"type": "link", "url": "", "name": "Second"}]}
Allure output for test, failed with 'assert'
/home/den/Codding/logs/rep_27_07/ec67058d-f9db-4b1a-ace5-380a19c065be-result.json:1:{"name": "test_fail_scenario[4-5-G/C-json_result0]", "status": "failed", "statusDetails": {"message": "AssertionError: [['Expected =>>> audioSourceId: 4 Action: 2', \"Actual =>>> ['01-01 06:31:16.508 3029 3029 I CommandReceiver: OnReceive...: 5 state: 0 type: 0 priority type: 5 reason: 0']\"], 'Combination 4 and 5', 'Expected arbitration table result is G/C']\nassert not [['Expected =>>> audioSourceId: 4 Action: 2', \"Actual =>>> ['01-01 06:31:16.508 3029 3029 I CommandReceiver: OnReceive...: 5 state: 0 type: 0 priority type: 5 reason: 0']\"], 'Combination 4 and 5', 'Expected arbitration table result is G/C']", "trace": "first_source = 4, second_source = 5, result = 'G/C'\njson_result = {'action_after_stop_interruption': '', 'additional_text': 'Entertainment stop', 'additional_text_after_stop_interruption': '', 'additional_text_info': 'Info stop', ...}\n\n @allure.link('',\n name='Second')\n @pytest.mark.parametrize(\"first_source, second_source, result, json_result\", parameter_gatherer1())\n def test_fail_scenario(first_source, second_source, result, json_result):\n current_timestamp = logcat.get_current_logcat_timestamp()\n logger.info(\"Test started for {0} and {1}\".format(first_source, second_source))\n AmmTestApp().source_change_start(first_source)\n assert not check_source_state_sc_start(first_source, current_timestamp)\n current_timestamp = logcat.get_current_logcat_timestamp()\n AmmTestApp().source_change_start(second_source)\n assert not check_source_state_sc_start(second_source, current_timestamp)\n sc_start_actions = ent_ent_validator.check_source_state_sc_start(result=result,\n source_id_source=first_source,\n source_id_new=second_source,\n source_action=json_result[\"source_action\"],\n interrupt_action=json_result[\"interrupt_action\"],\n interrupt_id_state=json_result[\n \"interrupt_id_state\"],\n current_timestamp=current_timestamp)\n> assert not sc_start_actions, sc_start_actions\nE AssertionError: [['Expected =>>> audioSourceId: 4 Action: 2', \"Actual =>>> ['01-01 06:31:16.508 3029 3029 I CommandReceiver: OnReceive...: 5 state: 0 type: 0 priority type: 5 reason: 0']\"], 'Combination 4 and 5', 'Expected arbitration table result is G/C']\nE assert not [['Expected =>>> audioSourceId: 4 Action: 2', \"Actual =>>> ['01-01 06:31:16.508 3029 3029 I CommandReceiver: OnReceive...: 5 state: 0 type: 0 priority type: 5 reason: 0']\"], 'Combination 4 and 5', 'Expected arbitration table result is G/C']\n\ntest_jira_reporting.py:74: AssertionError"}, "parameters": [{"name": "first_source", "value": "4"}, {"name": "second_source", "value": "5"}, {"name": "result", "value": "'G/C'"}, {"name": "json_result", "value": "{'additional_text': 'Entertainment stop', 'additional_text_info': 'Info stop', 'additional_text_after_stop_interruption': '', 'additional_text_info_after_stop_interruption': '', 'source_id_state': '2', 'interrupt_id_state': '0', 'source_action': '2', 'interrupt_action': '0', 'action_after_stop_interruption': '', 'source_id_state_after_stop_interruption': '0'}"}], "start": 1595866724999, "stop": 1595866728622, "uuid": "a9de0202-b248-43c1-a67d-fb5a3d140521", "historyId": "bed0cfa61c2e91ba71667fc442eb4b72", "fullName": "regression.audiomanagement.test_jira_reporting#test_fail_scenario[4-5-G/C-json_result0]", "labels": [{"name": "parentSuite", "value": "regression.audiomanagement"}, {"name": "suite", "value": "test_jira_reporting"}, {"name": "host", "value": "den-pc"}, {"name": "thread", "value": "150849-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "regression.audiomanagement.test_jira_reporting"}], "links": [{"type": "link", "url": "", "name": "Second"}]}
`
As I can see, 'assert' has statusDetails section, and it takes as AssertionError in html. Is it possible to send something into this section with help of plugin?
UDP:
manual adding of this information into the report with with check: (assertion type) started display expected information:
"statusDetails": {"message": "AssertionError: [['Expected =>>> audioSourceId: 4 Action: 2', \"Actual =>>> ['01-01 06:31:16.508 3029 3029 I CommandReceiver: OnReceive...: 5 state: 0 type: 0 priority type: 5 reason: 0']\"], 'Combination 4 and 5', 'Expected arbitration table result is G/C']"},
from pytest-check.
Additional information - during using regular 'assert' there is reprcrash parameter, which, I think, leads to the "statusDetails" message in Allure
If I use 'with check:' - there is only 'longrepr' and 'longreprtext' with error
from pytest-check.
If anybody interested in the same problem, I workaround it with help of this code in conftest.py
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
rep = outcome.get_result()
if rep.when == 'call' and rep.failed:
allure.attach(rep.longreprtext, name="errr_log")
In this case file with all errors will be attached to allure report as "errr_log" file
from pytest-check.
@DenKos363 Thanks for posting the workaround. very cool.
from pytest-check.
Leaving this open so I can try it out and add to documentation.
from pytest-check.
Related Issues (20)
- Feature request: Add new test outcome status ? HOT 1
- Test is not marked as xfailed when pytest.xfail() called after a failure. HOT 2
- RFE: is it possible to start making github releases?🤔 HOT 6
- pytest check is not reporting all failures distributed across multiple python functions or setup fixture called within a test function HOT 3
- Linux environment does not have version 2.1.5 HOT 3
- Document & test: custom error message for check.raises HOT 2
- raises match argument HOT 1
- Is the 'raises' parameter in xfail ignored? HOT 1
- `pytest-check` causes `pytest-xdist` testing to fail HOT 1
- Add new check type: match - use regular expressions to tests againgst a string HOT 1
- pytest_html HOT 1
- How to have all failure on logging pytestfile HOT 1
- [v2.2.3] ExceptionRepr creation is not compatible with pytest < 7.3. HOT 2
- INTERNALERROR after upgrading package to 2.2.3 or 2.2.4 version HOT 5
- Add an xdist test
- Incorrect arguments to `ExceptionRepr` HOT 5
- d7afe0d6570c24d8d9ecc4443be9a765a0b85c2c HOT 1
- d7afe0d6570c24d8d9ecc4443be9a765a0b85c2c
- type-hinting the project
- Include a `check.match` and `check.not_match` for regex comparison
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-check.