I have a testcase that runs pretty long (loops over some files).
During execution, the progess is frozen at 1 dot:
==============================================================================
Robotframework :: Init for all test suites
==============================================================================
Robotframework.Run :: Test cases testing the created deb package.
==============================================================================
Md5sum Check :: Verifies that md5s are checked. .
A
Progress dots --/
When does Robot Framework add those dots? In other testcases this updated regularly.
Can I make Robot Framework add those dots manually so the tester does not think the test is frozen?
Related
We are developing / publishing robot-tests in a git environment, where the public (published) git has slightly different settings then the development git (due to personal work-space (development) vs global environment settings).
Because of this one of our robot keywords is different for development and public.
Currently we manage this by commenting out 1 line in the keyword's .robot implementation for the development git and another one for the public git, but this is error prone.
Is it possible to call pybot with some extra command-line options which will be passed on via the .robot files to the python files implementing the final keywords so we can move the 2 lines from the .robot file to the python implementation and decide which to use based on the given command-line option?
Check the Setting variables in command line part of the user guide. With the --variable MYVAR:value command line argument you can create global variables.
For example:
*** Variables ***
${VAR} localenv # this is not necessarily needed, it is used to set default value
*** Test Case ***
Test
IF '${VAR}' == 'localenv'
Log Do this
ELSE IF '${VAR}' == 'globalenv'
Log Do that
END
Run locally
robot test.robot
on global:
robot --variable VAR:globalenv test.robot
I run my robotframework test suite as a teamcity/jenkins build with two simple steps as below
build step #1: pybot
build step #2: pybot --rerunfailed Results\output.xml
When all the tests in step-1 are passed, the build fails because step-2 (--rerunfailed) triggers an error ( [ ERROR ] Collecting failed tests from 'Results\output.xml' failed: All tests passed.) .
Could someone please suggest how to ignore or overcome this error, so that I can show the build as passed in this case ?
I had similar Problem, i fixed it this way:
robot -d %ResultPath% %TestSuitName% || robot --rerunfailed output.xml --output output1.xml -l log.html -r report.html TestSuitName || rebot --rerunmerge --output output.xml -l log.html -r report.html output.xml output1.xml
Uses || to run those command simultaneously and it will work.
Make build step #2 dependent on build step #1 failing. That is, only run pybot --rerunfailed if the first pybot exited with a non-zero exit status.
The simplest way to do this is to create a custom test runner in bash or python or powershell that does both the running of pybot and re-running of pybot as a single step. You then configure this shell script as a single step.
Another way to do it is to have your second build step either look at the return code of the previous step (if possible), or scans the output.xml to see if there are failures. If there are no failures, it returns without doing any work.
There's robot:skip-on-failure tag. It it sets then a test case will skip for failure and perform if it's ok. It takes RobotFramework 5.0.
The below is the code present in parallel_tests.txt
*** Settings ***
Library Parallel
*** Test Cases ***
Runner
Run Parallel Tests Hello World
Hello
[Tags] parallel
Log Hello123
World
[Tags] parallel
Log World123
I am trying to execute this test case file
from terminal using jybot as below:
jybot parallel_tests.txt;
I am getting the following error:
No keyword with name 'Run Parallel Tests' found.
How to execute both test cases Hello and World ,in parallel in robot framework using parallel library.
Slightly different use case but have you tried using pabot?
I haven't gone down the rabbit hole with this one so don't have an in-depth understanding but I do use it for cross-browser tests via sauceLabs. It will work differently from how you want in that it does parallel runs but by test suite rather than test case level. Perhaps this is configurable? Unfortunately as mentioned I just know enough to get it working for my needs and haven't done a deep dive.
Any questions let me know and I'll try to help.
Here's a quick example as requested, I've stripped lots of our stuff which is useless in your case but left some in so you can see how to build up. I changed the processes parameter from %processes% to 2, the end result is the same, in my case these values are coming from a teamcity build configuration:
pabot --processes 2 --variable environment:%environment% --name OS_X_10.9-Firefox --variable browser:%browser% --listener robot-tc-listener --include %includetags% --exclude %exclusiontags% --outputdir %PabotResults_DIR% --output output.xml --report report.html --log log.html tests
Which version of RobotFramework are you using? The Parallel library was removed in 2.5 (see this ticket, though there may be distant plans of reintroducing it).
I tried to reproduce your issue using this file with RF version 2.8, but there are several compatibility problems, as expected.
Are you sure that the library has been loaded properly? When it fails, in addition to the error, you will also get a message telling you that the keywords are unavailable.
I am new to robot framework and wanted to see if i can run test cases without RIDE. I want to create test suite and run test cases sequentially without using RIDE. I went through documentation but could not understand it.
Ex: Test Suite
Test Case 1
Test Case 2
Test Case 3
i would like to put my references to all my resource files to test suite and run all test cases. I can do this using RIDE but wanted to know if i can do this without using it. Do i need to create batch file to do this or any other method to run? Any example will help me. Thank you for advance.
When you install robot, you also installed a program called robot (or pybot in older versions), which is the official robot test runner.
If you have a test suite named "my_tests.robot", you can open up a command prompt (bash on *nix, powershell or command.exe on windows) and type the following command (assuming that robot is in your PATH environment variable, which it probably is):
$ robot my_tests.robot
If you have a collection of suites in a folder, you can give pybot the name of the folder rather than the name of a test file.
To see a list of all robot command line options, use the --help option:
$ robot --help
For more information see Starting test execution in the robot framework users guide.
if you use sublime-text/bracket/Atom/Emacs/vim ... you also have some plug-in :
http://robotframework.org/#tools
Show the path of test suite
exmp: Location of my 'catiav6' test script_
cd C:\Users....\Desktop\catiav6
Run following command from cmd
For single test case:
pybot --test 'Name_of_single_test_case' 'Name_of_test_suite'
For all test cases:
pybot --test * 'Name_of_test_suite'
When using Jenkin plugin for Robot Framework, the instruction stated that we need to force robot framework script return successfully from the shell with "exit 0". This is not a very clear statement.
Can someone tell me how we force the robot framework to return with "exit 0" when tests are successful? An example will be very helpful.
Here is the statement in the Jenkins wiki.
Force your Robot script to return successfully from shell with "exit 0" to empower the plugin in deciding if the build is success/failure
(by default Robot exits with error code when there are any failed
tests)
In order to tell if a job succeeded or failed, jenkins uses the exit code of the last command that was run. "exiting 0" means to have whatever script runs your test finish with an exit code of 0 (zero).
There are two ways to "exit 0" when robot completes with a failed test:
Explicitly call the exit in the script that runs your tests.
Use the pybot option --nostatusrc
More information about robot framework return codes is covered in the Return Codes section of the robot framework user guide.
Using the exit command
exit is a command you can put into a script to force a specific status code. This command behaves the same both on unix and non-unix systems. It takes one argument (such as 0) and exits the enclosing script with the given value as the exit code.
When you configure jenkins, you are creating a batch script (window) or shell script (non-windows) that contains one or more commands. You can add exit 0 as the last command to force this script to "exit 0".
For example, you can configure your jenkins job to look like this:
pybot mytests.robot
exit 0
In this case, that last line will tell jenkins that the script exited cleanly without errors. The robot plugin for jenkins will then look at the output file (output.xml) to determine whether the build succeeded or failed.
Using the command line option --nostatusrc
Beginning with robot version 2.5.7 you can use the command line option --nostatusrc, which causes robot to always "exit 0" no matter how many tests failed. You can include this option in your jenkins job like so:
pybot --nostatusrc mytests.robot