Robot Framework - customise log output - robotframework

I'm using Robot Framework to run some tests from SpiraTest.
At the end of the test, Robot FW logs the final statement this way:
Test 1 |PASS|
1 critical test, 1 passed, 0 failed.
My problem is that the Regular Expression in Spiratest triggers the "0 failed" string in the 2nd row as if the whole test has failed, and this has higher priority with respect to the |PASS| statement in the row above.
For this reason, the test is marked as "failed", even if it passed.
Is there any way to mask the second row of the output?
Many thanks in advance,
gischio

Actually the problem was in the Regex that triggers the Failed status.
I've asked the Spirateam support and I've been told it is enough to add
[0-9][1-]* failed
in the RegEx for Failed.

Related

Log.html only showing the passed test cases when using the "pabot --testlevelsplit Tests/demo.robot" command

I am trying to learn robot & facing two confusions(m a total noob) .Pretty sure I am making a rookie mistake & would appreciate some help .
1)Every time I execute the tests using the "pabot --testlevelsplit Tests/demo.robot" command, the log.html doesn't show the failed test case (in this case: Fill the login form and select "Teacher" from the User option) even though the terminal output shows it as failed.
The same test case however passes when I run them individually and log.html shows 3 passed test cases.
code[Log showing only the 2 passed cases
terminal showing only 2 passed test cases
all the test cases passed and showing up in logs when executed using the ".robot /Test/demo.robot" command

Is there a way to generate test report in robot framework which says total test case = 0, passed = 0 , failed = 0?

When we run test suites using a tag say "ABC" and if none of the tests are matching the given tag, there will be no report generated.
But is there a way to generate report that says zero test cases were executed in robot framework?
There is option to do exactly that, just add option --runemptysuite to your command.Here's a link
robot --runemptysuite --include ABC test.robot

How to fix "Escaping empty cells with '\' before line continuation marker '...' is deprecated" error in Robot Framework?

I keep on getting this error when running my Robot Framework script:
"Escaping empty cells with '\' before line continuation marker '...' is deprecated. Remove escaping before Robot Framework 3.2."
Here is a sample code:
*** Test Cases ***
Debug
${Str} = Set Variable Rose
: FOR ${Ctr} IN RANGE 1 5
\ Run Keyword If '${Str}' == 'Test' Log Test
\ ... ELSE Log Not Test
I searched for a solution and I only got this link: https://gerrit.openbmc-project.xyz/#/c/openbmc/openbmc-test-automation/+/22245/
I can see that they used FOR/END instead of :FOR (which was working fine before).
FOR ${userid} IN RANGE 2 16
${user_info}= Get User Info ${userid}
Run Keyword If "${user_info['user_name']}" != ""
... Run IPMI Standard Command user set name ${userid} ""
END
However, when I try to change my code to use FOR/END, RIDE automatically changes it back to :FOR.
I use RIDE heavily and would like to continue to do so I need it to work around this error. My RIDE is the latest one so upgrade won't work. Any help would be appreciated.
The syntax for the FOR-loop is changed. From the documentation:
Not closing loops with END, escaping keywords inside loops with \, and
using :FOR instead of FOR are all going to be deprecated in Robot
Framework 3.2. Users are advised to switch to the new syntax as soon
as possible.
With your code I can still run the test, but the deprecation warning is shown. To remove the warning this worked for me in Eclipse:
Debug
${Str} = Set Variable Rose
:FOR ${Ctr} IN RANGE 1 5
\ Run Keyword If '${Str}' == 'Test' Log Test
... ELSE Log Not Test
When you remove the escape character in the ELSE line the warning is no longer shown. This is a workaround though, untill a new version of RIDE comes along I guess.

expected at least 1 argument, got 0

I installed robot framework yesterday and trying to run a test file.Below is my test file, while i try to run the file using robot -d tests/Amazon.robot , i am getting a error as
[Error] Expected at least 1 argument,got 0.
can someone please help me.
You didn't specify where to look for tests and you are using -d incorrectly.
Most likely you need command robot tests/Amazon.robot
The problem looks like in the usage of the Sleep keyword - you want to pass the argument "3" to it, but did not put two or more spaces b/n them.
With problems like this, check the generated log.html file - the failure will be in the record for the specific keyword, helping you pinpoint which line is the error one.

Definition of OSCOMPSTAT values

I've tried to find a table with the definition for each COMPSTAT (related to the tool Control-M workload Automation) return code but without any success.
Can anyone tell me if such a table exists?
Thank you.
It's the return code from whatever task was being executed at that time. By convention, a zero value means 'OK', and anything non-zero means an error of some kind.
Different utilities (i.e. external commands) have different possible return codes, so if the command were SCP then you would look up the code in the SCP documentation, and find that for example, '67' meant 'key exchange failed'.
There is no table that contains the definition of each COMPSTAT return code.
OSCOMPSTAT stand for Control-M Operating System Completion Status.
The value of COMPSTAT is set by the exit code of the command that was called.
Example:
After calling the command [cat file1.txt] the value of COMPSTAT will be:
0 if the file "file1.txt" is found
1 if the file "file1.txt" is not found
After calling the command [ctmfw] the value of COMPSTAT will be:
0 if the specified file is found
7 if the specified file is not found

Resources