Question

Following is my resource.txt which I'm referring to in test case and suite (__init__.txt) files. I would like to get result after executing keywords which are mapped to a static API( RobotLibrary) then pass the result back to same static API(RobotLibrary) module for asserting the result. I tried to hold the result as state in RobotLibrary but that didn't work probably because RobotLibrary is a single instance across multiple tests? I don't mind returning the result via keywords and returning them back as arguments to subsequent calls.

*** Settings ***
Library     ${CURDIR}${/}..${/}src${/}RobotLibrary.py


*** Keywords ***

[return]  ${result_run}

when the configuration file "${filename}" is used to run the journey
        ${result_run}= start journey with config   ${filename}

when the route has a route code of "${routecode}"
        use route code  ${routecode}

journey status should be "${status}"
        assert journey status   ${status}

stop with name "${stopName}" should have an arrival time
        assert stop has arrival time    ${stopName}     ${result}

This didn't work, following is the message I see in console.

(acceptance_test)[root@localhost jsf_acceptance_test]# pybot -L TRACE robot-tests/manual/Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1/
==============================================================================
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1 :: Mandatory-Delayed-S0-Man...
==============================================================================
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1.Mandatory-Delayed-S0-Mandat...
==============================================================================
Ensure feedback for stop stop0 on route CGXD                          | FAIL |
Parent suite setup failed:
No keyword with name '${result_run}= start journey with config' found.
------------------------------------------------------------------------------
Ensure feedback for stop stop1 on route CGXD                          | FAIL |
Parent suite setup failed:
No keyword with name '${result_run}= start journey with config' found.
------------------------------------------------------------------------------
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1.Mandatory-Delayed-... | FAIL |
Parent suite setup failed:
No keyword with name '${result_run}= start journey with config' found.

2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1 :: Mandatory-Delay... | FAIL |
Suite setup failed:
No keyword with name '${result_run}= start journey with config' found.

2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================
Output:  /home/pycharm/jsf_acceptance_test/output.xml
Log:     /home/pycharm/jsf_acceptance_test/log.html
Report:  /home/pycharm/jsf_acceptance_test/report.html

Not sure how best to go about this - I'm relatively new to robot framework and finding it hard to get answers for this in documentation. Anyone has any ideas around this? I'm happy to update the question with more info if you need it. Cheers.

Was it helpful?

Solution

Your tests show this error:

No keyword with name '${result_run}= start journey with config' found.

That means that the robot test runner is encountering that complete string at a point where it's expecting a keyword. This is likely because it appears you have only a single space between the = and start journey.... Try adding another space so that the variable and the keyword are in two separate cells in the test case table.

${result_run}=  start journey with config
#             ^^ two spaces

If you switch to using the pipe-delimited format these types of problems will be much easier to spot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top