Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

@Raghavendra Balgi thanks for the steps for apache2. The reason I asked was because on Windows there is a problem with shared folders. It is not easy to configure epecially on a corporate host. So I needed an alternative way so check robot output files. I think the apache aproach might be a bit difficult (at least for beginners), too.

I have found two (imho easier) alternatives how to get a look on robots output files:

NOTE: I did all that on Windows 10


docker cp --help --> Copy files or folders between a container and the local filesystem

A) create image from Dockerfile

docker build -t robot . NOTE: this will create an image tagged robot from Dockerfile in current directory

B-1) create container from our image with a name which we can refer to later:

docker create --name robotcontainer robot NOTE: this will create a container with name robotcon from our robot image check it's existence with docker ps -a

B-2) start container so that our robot tests are executed and output files created

docker start -i robotcon

NOTE: instead of B-1 + B-2 you can also do just one command docker run --name robotcon robot

C) copy robot ouput from container to local filesystem

docker cp robotcon:/root/reports/ C:\path_to_your_folder\where-you-want-files-to-be

EXAMPLE: docker cp robotcon:/root/reports/ C:\qs_playground\docker_test\ubuntu

2. ALTERNATIVE: use python's build in SimpleHTTPServer

A) Change last line of our Dockerfile

FROM CMD (Xvfb :10 -ac & export DISPLAY=:10; wget -qO- | tar -xz -C /usr/bin/; pybot -d /root/reports/ /root/robotframework_test/test.txt) TO CMD (Xvfb :10 -ac & export DISPLAY=:10; wget -qO- | tar -xz -C /usr/bin/; pybot -d /root/reports/ /root/robotframework_test/test.txt; cd /root/reports/; python -m SimpleHTTPServer 9999)

NOTE: here we go to /root/reports/ folder and start Python's HTTP server on port 9999

B) build docker image from new Dockerfile

docker build -t robot2 (give i another tag so that we dont get confused with first alternative)

C) run --> docker run -it -p 9999:999 robot2

NOTE: with -p 9999:9999 we are publishing the container's port to our host (Windows 10)

D) watch robot output in your local browser

Open youf favorite browser (Google, Firefox, Edge etc.) and got to http://localhost:9999 you should see three robot output files listed

  • log.html
  • output.xml
  • report.html

This comment has been minimized.

Copy link
Owner Author

commented Aug 22, 2017

@raghavendra Balgi I have so much questions ... hope you don't mind me spaming you blog :)))

Why did you put geckodriver download under CMD instead in a RUN command?

I noticed that having it in a RUN speeds up execution a bit.

RUN wget -qO- | tar -xz -C /usr/bin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.