Closed johan974 closed 3 years ago
@johan974 here is an example that works for me
docker run --rm -it --network host \
--volume "$PWD/robot":/home/robot/tests \
--volume "$PWD/results":/home/robot/results \
asyrjasalo/restinstance -L TRACE -i edit tests/*.robot
"$PWD/robot"
<-- local folder with my RF files --> goes to /home/robot/tests
in container.
tests/*.robot
means all .robot
file in test
folder inside the container will be executed.
Robot options should go after asyrjasalo/restinstance
I think.
"$PWD/results"
<-- local folder where logs go after test run. In the container they are in /home/robot/results
My folder structure looks like this
project
├── src
...
└── tests
├── README.md
├── test-requirements.txt
├── results
│ ├── log.html
│ ├── output.xml
│ └── report.html
├── robot
│ ├── my_tests.robot
│ └── resources
│ └── suite_settings.robot
└── run_local_tests.sh
For another I tried to get this configuration fixed. Why is the extra paramter needed? Please make it optional.
docker run -v /var/jenkins_home/workspace/jenkins-functionaltest-controllers/functional-testing-controllers/results:/home/robot/reports:Z -v /var/jenkins_home/workspace/jenkins-functionaltest-controllers/functional-testing-controllers/tests:/home/robot/tests:Z --network=myrestnetwork -e ROBOT_OPTIONS=--nostatusrc asyrjasalo/restinstance -L TRACE /home/robot/tests [ ERROR ] Suite 'Tests' contains no tests.
My project structure INSIDE a Jenkins Docker container. So inside the container I first start a Docker image (to be tested) after creating a network.
sh "docker run -d -p 8080:8080 --name restapplication --network=myrestnetwork solvedshared/restapp:latest" Then I start the above robot framework docker image.
The project structure is: project ... +- functional-testing-controllers ........ +- tests ........ ........ +- ControllerTest.robot ........ + results
I tried all kinds of combinations for creating the parameter. It doesn't work after many, many trials. Do I need more files? Can I see which files are in the testing container?
@johan974 do you start the RESTinstance container from within the folder where your test files (.robot) are? The error indicates that your .robot files are not shared correctly with the container. Robot Framework inside the container simply can't find your files.
I suggest you experiment locally first before trying with Jenkins.
like so --> cd tests
then docker run ... asyrjasalo/restinstance some-robot-options tests/*.robot
Thanks for offering the nice Docker image.
I have been searching ... what does the extra parameter mean? Whatever I try, I get 'data source not found'. Please help.
For example, I try this:
docker run -v ...jenkins-functionaltest-controllers/functional-testing-controllers/results:/opt/robotframework/reports -v .../jenkins-functionaltest-controllers/functional-testing-controllers/tests:/opt/robotframework/tests --network=myrestnetwork -e ROBOT_OPTIONS=--nostatusrc asyrjasalo/restinstance ControllersTest.robot [ ERROR ] Parsing 'ControllersTest.robot' failed: Data source does not exist.