In a .travis.yml file using sbt, I see this
script:
- sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS test:fullOptJS
In sbt, I can run test, and I can run fastOptJS . What does the single colon between them do?
In travis, can one run a sequence of commands? ie. what does it mean for test:fastOptJS to be followed by test:fullOptJS?
In sbt, I can run test, and I can run fastOptJS . What does the single colon between them do?
test:fastOptJS means fastOptJS in test scope. The confusion comes from the fact that the test scope and the test task are both test in sbt's shell.
This, btw, is fixed in sbt 1.1's new "unified slash syntax" where the test scope now Test, so test:fastOptJS is now Test / fastOptJS.
In travis, can one run a sequence of commands? ie. what does it mean for test:fastOptJS to be followed by test:fullOptJS?
Yes you can run a sequence of commands.
sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS test:fullOptJS means run ++$TRAVIS_SCALA_VERSION (which changes scalaVersion), then test:fastOptJS then test:fullOptJS.
Related
I want to run several sbt-commands within sbt interactive mode, i.e. without leaving the sbt "shell"?
(Note:
Some questions answer how to pass argument to sbt-commands using sbt in the standard shell. Not what I wnat here)
Example: I am in sbt interactive shell, and I want to run "test:compile", then "test"
I know test will call required compilation, but in this example I want to run the compilation of all sub-projects, before any test is started.
To run commands sequentially within the sbt shell, use ; to chain commands:
> ;test:compile ;test
Note however that running the test task will compile your sources if necessary without you having to explicitly running the compile task.
Is there a way to run two separate test suites using it:testOnly with SBT?
I know that if I want to run one test suite I would use sbt "it:testOnly directory.testName", and that if I wanted to run a set of tests that all match a certain expression I could for example do sbt "it:testOnly directory.*", but I can't for the life of me figure out how to do two individual tests. I have tried
sbt "it:testOnly directory.test1 directory.test2"
and
sbt "it:testOnly directory.test1,directory.test2"
but neither of those work, and I can't find any documentation on it when I googled the issue.
Turns out I'd made a spelling mistake in the name of the second test. The correct format is
sbt "it:testOnly directory.test1 directory.test2"
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'
sbt's test-only command can be used to run the tests found in a specific test class. With JUnit tests you can use test-only to run specific methods on a test class e.g. test-only mypackage.MyTestClass.test1Equals1 to run just that method.
Is such a thing possible with scalatest's more free-form test syntax, presumably by working out the name it uses internally to reference a specific test? If it isn't possible in FreeSpec (which is easy to imagine given its nature) is there a way to do it with a simpler testing approach like FunSuite?
For a general solution we need to wait for sbt#911, but apparently ScalaTest 2.1.3 has a support for running a specific test. Seth says:
This is now supported in ScalaTest 2.1.3 with:
test-only *MySuite -- -z foo
to run only the tests whose name includes the substring "foo". For exact match rather than substring, use -t instead of -z.
To run a test:
sbt test-only com.path.to.UnitTestSpec
To run a particular integration test:
sbt it:test-only com.path.to.IntegrationTestSpec