robot, crontab linux

707 views
Skip to first unread message

majatalo

unread,
Aug 3, 2013, 5:06:07 AM8/3/13
to robotframe...@googlegroups.com
hi
I have tried to schedule my test in linux machine using crontab.
I created shell script that work when i run it from command line.
but when i try to run it from cron it does not do same thing.
script run pybot + test name
test is simple that open browser and goes to web page and clicks button and then closes browser.

i tested with another script that echoes text in to ascii file and that worked fine when executed from cron.

does anyone have example how to schedule robot test using crontab?

Tatu Aalto

unread,
Aug 3, 2013, 7:18:36 AM8/3/13
to robotframe...@googlegroups.com
Ugh

Most likely, this is caused by that you do not have display defined.
User group provides solutions how to solve this problem [1]. I did use
same solution also in our environment.

-Tatu
[1]
https://groups.google.com/forum/#!searchin/robotframework-users/display$20headless/robotframework-users/eIn5yiHnmUs/jg3ZyZjmiykJ
> --
> You received this message because you are subscribed to the Google
> Groups "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to robotframework-u...@googlegroups.com.
> To post to this group, send email to
> robotframe...@googlegroups.com.
> Visit this group at http://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

majatalo

unread,
Aug 3, 2013, 10:50:39 AM8/3/13
to robotframe...@googlegroups.com
I made some google searches and i might have instructions how to install and setup xvfb, but
how do I run test so that is goes to that virtual display?




lauantai, 3. elokuuta 2013 14.18.36 UTC+3 Tatu Aalto kirjoitti:
Ugh

Most likely, this is caused by that you do not have display defined.
User group provides solutions how to solve this problem [1]. I did use
same solution also in our environment.

-Tatu
[1]
https://groups.google.com/forum/#!searchin/robotframework-users/display$20headless/robotframework-users/eIn5yiHnmUs/jg3ZyZjmiykJ

On 3.8.2013 12:06, majatalo wrote:
> hi
> I have tried to schedule my test in linux machine using crontab.
> I created shell script that work when i run it from command line.
> but when i try to run it from cron it does not do same thing.
> script run pybot + test name
> test is simple that open browser and goes to web page and clicks
> button and then closes browser.
>
> i tested with another script that echoes text in to ascii file and
> that worked fine when executed from cron.
>
> does anyone have example how to schedule robot test using crontab?
> --
> You received this message because you are subscribed to the Google
> Groups "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to robotframework-users+unsub...@googlegroups.com.

Tatu Aalto

unread,
Aug 3, 2013, 1:26:11 PM8/3/13
to kir...@gmail.com, robotframework-users

Ugh

Unfortunately for you, I am on holiday and do not recall the implementation details. But I think that others have also used same method, so perhaps someone else can help you.

-Tatu

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

majatalo

unread,
Aug 4, 2013, 6:02:06 AM8/4/13
to robotframe...@googlegroups.com, kir...@gmail.com
if no one else has ansver when you get back to work let me know.
I am not in rush, just to educate my self and expand knowledge.
> To post to this group, send email to
> robotframe...@googlegroups.com.
> Visit this group at http://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Teppo Testaaja

unread,
Aug 5, 2013, 5:49:20 AM8/5/13
to robotframe...@googlegroups.com, kir...@gmail.com
If the problem is truly concerning a headless environment then with xvfb one can use a command:

DISPLAY=:1 xvfb-run pybot testcasefilename.txt

If this command is not enough, you can try this command:

startx -- /usr/bin/Xvfb :1 -screen 0 1024x768x24 & DISPLAY=:1 pybot testcasefilename.txt

In this command, one first starts a new session of the xserver with a certain sized virtual screen buffer. Then the DISPLAY 1 of the new xserver session is used for running the tests. After the new session of xserver has been started, the following tests should be run using the command starting with the DISPLAY=:1 command only, otherwise Linux will complain that the xserver is already running. The benefit of the latter command is that one can define the screensize as well. I have used this extended command successfully when running Sikuli cases in a headless environment in Xubuntu OS. And this was a tricky problem because Sikuli takes screenshots and makes bitmap comparison. If only using Selenium, then the first more elegant command has worked for me fine.

Br,
Teppo

majatalo

unread,
Aug 7, 2013, 3:58:50 AM8/7/13
to robotframe...@googlegroups.com, kir...@gmail.com
Well, machine is not headless it has monitor connected.
when I run .sh file from terminal I can see Robot log in terminal window and browser opens ok etc.
when crontabruns  same script, browser is not opened= assumption test is not executed.
when I run simple test.sh script containing "echo hello world >test.log" from crontab log file is created and text is wirtten in that file.

so actual problem is "why test is not running when I run .sh from crontab?" "why browser does not open "

Tatu Aalto

unread,
Aug 7, 2013, 5:57:55 AM8/7/13
to kir...@gmail.com, robotframework-users

Ugh

One can always run RF and get debug file [1] for better details why your test is failing.

-Tatu
[1] http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.1#debug-file

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Jerry Schneider

unread,
Aug 7, 2013, 11:45:18 AM8/7/13
to robotframe...@googlegroups.com
You may have a monitor attached, but machine is running headless when running crontabs.  You have to setup a virtual framebuffer to run GUI items from cron.

jer
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Linux registered user #475536
Ubuntu registered user #28583
Reply all
Reply to author
Forward
0 new messages