This is a quick "how to run" if you already have everything Robot Framework-related installed. This Gist might be especially handy for those you either just starting out, or if you've inherited a code-base from someone else.
The following assumes you have a terminal (CMD or PowerShell on Windows, Terminal on Mac or Linux) and aren't afraid to use it.
cd
into the root directory of the Robot Framework files and test cases; we'll assume all test cases are somewhere within a directory namedtest_cases
.- If the directory doesn't already exist, then
mkdir reports
(this is a convenience - where our reports will live). - Execution step:
robot -T -d reports -n noncritical test_cases
- You'll see a bunch of stuff on the terminal. Get some ☕ if you have many tests.
- When it's done, you'll see the report (timestamped) in the
reports
directory; double-click thereport-
YYYYMMDD-
HHMMSS.html
(where YYYYMMDD is the year, month, date and HHMMSS is the hour, minute, and seconds - e.g,report-20170302-114737.html
).
-T
- Short for--timestampoutputs
. Creates reports, logs, etc. with the current timestamp so we don't overwrite existing ones upon execution.-d
- Short for--outputdir
. Tells the framework where to create the report files.-n
- Short for--noncritical
. This tells Robot Framework what tag indicates a non-critical test (I've standardized onnoncritical
to reduce ambiguity).
There's one more switch you should probably use: --dryrun
. This tells Robot Framework to run through all of your test cases, resource files, etc. looking for syntax-type problems. Recommended as it can save some headaches if you have a lot to execute. You can add it anywhere in the command line.
To execute only the test cases with a particular tag, do everything in Testing ALL THE THINGS above, except in step 3, perform:
robot -T -d reports -n noncritical -i NAMEOFTAGHERE test_cases
Substitute NAMEOFTAGHERE
with whatever is appropriate; e.g., smoke
or api
. This will execute all test cases that include the tag you specify. The -i
is short for --include
which means "include for testing only those test cases with this tag".
Also, you can "stack" the selected tags by repeating the switch and tag name. For example, you could do -i negative -i smoke
and it would execute all test cases which have a tag of both negative and smoke.
To execute only a particular test suite (file), do everything in Testing ALL THE THINGS above, except in step 3, perform:
robot -T -d reports -n noncritical test_case/path/to/case.robot
where /path/to/case.robot
is of course the path to the suite (file) you want to execute.
To execute only a particular test case, do everything in Testing ALL THE THINGS above, except in step 3, perform:
robot -T -d reports -n noncritical -t "Name of Test Case Here" test_case/path/to/case.robot
where "Name of Test Case Here"
is the name of the test case within the file pointed to via /path/to/case.robot
. For example, if you wanted to execute the test case Verify All Widgets Present within the Smoke - Dashboard Page suite, you'd execute:
robot -T -d reports -n noncritical -t "Verify All Widgets Present" test_case/path/to/dashboard_tests.robot
See the official word on all command-line switches. Have fun!
Sounds like you have two different questions here:
For both of these questions, there are plenty of places to look on the internet (nothing really special about calling the
robot
runner per se).udp.sh
, you would execute:./udp.sh
cd ~/;ls -l
If you really want commands to run "in parallel" then you can append commands with an ampersand (&) which means that after the first command is received by the executor, it will continue to the next without waiting for the first command to return.
If you want more information, I'd Google it and play around with Linux a bit more.