Skip to content

Instantly share code, notes, and snippets.

@Tset-Noitamotua
Last active August 22, 2017 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tset-Noitamotua/095f1693bd1bb8a3aef5c2b2ca5c3e12 to your computer and use it in GitHub Desktop.
Save Tset-Noitamotua/095f1693bd1bb8a3aef5c2b2ca5c3e12 to your computer and use it in GitHub Desktop.

@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

1. ALTERNATIVE:

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- https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz | tar -xz -C /usr/bin/; pybot -d /root/reports/ /root/robotframework_test/test.txt) TO CMD (Xvfb :10 -ac & export DISPLAY=:10; wget -qO- https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz | 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
@Tset-Noitamotua
Copy link
Author

Tset-Noitamotua 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- https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz | tar -xz -C /usr/bin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment