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

adds qutest.py failure line number #9

Closed
wants to merge 1 commit into from

Conversation

harrisonmg
Copy link

@harrisonmg harrisonmg commented Mar 28, 2019

This PR adds functionality to the qutest.py script.

Upon failure of a QUTest, the line number of the calling DSL function from the user's test script will be printed as shown below.

Ex: The line number in test_init.py of the failing expect() call is 13.

QUTest unit testing front-end 6.4.0 running on Python 3.6.7
Copyright (c) 2005-2018 Quantum Leaps, www.state-machine.com
Attaching to QSPY (localhost:7701) ... OK
--------------------------------------------------
Group: test_init.py
init: FAIL (1.443s):13
  expected: "=FAILURE=> St-Init  Obj=ExAO,State=NULL->ExAO_idle"
  received: "===RTC===> St-Init  Obj=ExAO,State=NULL->ExAO_idle"
============= Target: 190326_084346 ==============
1 Groups, 1 Tests, 1 Failures, 0 Skipped (1.456s)
FAIL!

@quantum-leaps
Copy link
Contributor

Hi Harrison,
Thanks a lot for the valuable contribution.
Your change with a slight modification has been incorporated into the qutest.py script.
I made a new commit of QTools labeled as 6.5.0, so you can pick it up from there.

Here is a qutest output example from a test run (please note the FAIL lines):

python C:\qp\qtools/qspy/py/qutest.py *.py build/test_basic.exe
QUTest unit testing front-end 6.5.0 running on Python 2.7.15
Copyright (c) 2005-2019 Quantum Leaps, www.state-machine.com
Attaching to QSPY (localhost:7701) ... OK
--------------------------------------------------
Group: test_ProductionCode.py
FindFunction_WhichIsBroken() Should Return Zero If Item Is Not In List, Which Works Even In Our Broken Code: PASS (0.154s)
FindFunction_WhichIsBroken() Should Return The Index For Items In List, Which Will Fail Because Our Function Under Test Is Broken: FAIL @line:32 (1.104s):
   expected: "0000000001 USER+000 FindFunction_WhichIsBroken 1 34"
   received: "0000000001 USER+000 FindFunction_WhichIsBroken 0 34"
 FunctionWhichReturnsLocalVariable() Should Return The Current Counter Value: PASS (1.133s)
 
 FunctionWhichReturnsLocalVariable() Should Return The Current Counter Value Again: PASS (0 .069s)
 FunctionWhichReturnsLocalVariable() Should Return Current Counter, But Fails Because This Test Is Actually Flawed: FAIL @line:61 (0.053s):
   expected: "0000000001 USER+001 FunctionWhichReturnsLocalVariable 0x1234"
   received: "0000000001 USER+001 FunctionWhichReturnsLocalVariable 0x5A5A"
 ============= Target: 190328_165854 ==============
 1 Groups, 5 Tests, 2 Failures, 0 Skipped (3.565s)
 FAIL!
 Makefile:224: recipe for target 'run' failed
 make: *** [run] Error 2 

--MMS

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

Successfully merging this pull request may close these issues.

2 participants