Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add real-time error messages during testing #52

Closed
jaimedelreyg opened this issue Feb 15, 2021 · 7 comments
Closed

Add real-time error messages during testing #52

jaimedelreyg opened this issue Feb 15, 2021 · 7 comments

Comments

@jaimedelreyg
Copy link

Sometimes it is useful to have some information about your test asserts during execution, particularly in long period tests. I propose to add real-time error messages using python's logging module.

@okken
Copy link
Owner

okken commented May 19, 2021

This is a nice feature. I'd like to look into it.
It needs to add real-time logging without duplicating the overall error report.

@okken
Copy link
Owner

okken commented Jun 7, 2021

What do you think about this option?
We could add the flag --log-check-level and maybe the setting log_check_level, defaulting to NOTSET.
And if set, the failures are logged.
This would add real time logging support, but not change the default behavior.

@jaimedelreyg
Copy link
Author

yeah, of course it could be a great idea make this feature optional :)

@kapis90
Copy link

kapis90 commented Jan 10, 2023

I would add something else on my side. It would be wonderful to have logged the passes as well (optionally ofc)
Here is a sample output:

test_sandbox.py::TestSandbox::test_case1 
------------------------------- live log setup --------------------------------
13:17:04.319 [INFO] INIT
-------------------------------- live log call --------------------------------
13:17:04.320 [FAIL] check 2 == 1 FAIL1
13:17:04.853 [PASS] check 1 == 1 PASS
13:17:04.854 [FAIL] check 0 == 1 FAIL2
FAILED                                                                   [100%]
testsuites\sandbox_test\test_sandbox.py:42 (TestSandbox.test_case1)
FAILURE: check 2 == 1: FAIL1
test_sandbox.py:44 in test_case1() -> self.steps.step_check()
scripts\steps.py:25 in step_check() -> check.equal(2, 1, "FAIL1")

FAILURE: check 0 == 1: FAIL2
test_sandbox.py:44 in test_case1() -> self.steps.step_check()
scripts\steps.py:27 in step_check() -> check.equal(0, 1, "FAIL2")

------------------------------------------------------------
Failed Checks: 2

What I did, I added two logging levels (PASS and FAIL) and just log them with message.
I think adding different log levels should not be a problem. I can create them on root logger in my project, and just specify them from command line as you suggest

Why I even need a pass in test case?
Well, I am using pytest for functional tests in my project, after execution I need to create a report what was tested. Having this in log will simplify the process

@okken, does it make sense ?

@okken
Copy link
Owner

okken commented Jan 11, 2023

@kapis90 I understand the request.
I also understand the want. It's really a separate request, I think, from the original want.
PR #115 solves the original issue, hopefully, but doesn't address the pass logging.

I've added #116 for your request.

@okken
Copy link
Owner

okken commented Jan 11, 2023

See changelog for set_failure_callback() on version 2.1.0

@okken okken closed this as completed Jan 11, 2023
@kapis90
Copy link

kapis90 commented Jan 11, 2023

@kapis90 I understand the request. I also understand the want. It's really a separate request, I think, from the original want. PR #115 solves the original issue, hopefully, but doesn't address the pass logging.

I've added #116 for your request.

I agree with you, it can be treated as separate issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants