Page 1 of 1

Automation though wget

Posted: Sat Aug 25, 2007 5:20 pm
by calguy1000
After many trials and tribulations, I managed to get wget to login to cms made simple, and to perform an admin action.  To do anything requires intimate knowledge of the php at the back end (to know what parameters to supply, wether they are via post or get, etc). But it's possible.

Here's the script I ended up with.  Of course, I could improve on it, but, you'll get the point.

Code: Select all

#!/bin/sh
rm /tmp/login.php* /tmp/index.php* /tmp/moduleinterface.php*
sitename='http://www.mysite.com'
cookies=/tmp/cookies.tmp
postdata='username=theusername&password=thepassword&loginsubmit=Submit'

cd /tmp
wget --save-cookies ${cookies} --keep-session-cookies --post-data=$postdata ${sitename}/admin/login.php
wget --load-cookies ${cookies} ${sitename}/admin/moduleinterface.php\?mact=FileMailer,m1_,admin_setfiles,0
rm /tmp/cookies.tmp

Re: Automation though wget

Posted: Sun Aug 26, 2007 11:18 am
by Pierre M.
Cool, thank you.

I suggest to use it with a dedicated admin user, say "botuser" : this way you can see it acting in the admin log.

Pierre M.

Re: Automation though wget

Posted: Sun Sep 09, 2007 9:46 pm
by Pierre M.
calguy1000 wrote: After many trials and tribulations, I managed to get wget to login to cms made simple, and to perform an admin action.  To do anything requires intimate knowledge of the php at the back end (to know what parameters to supply, wether they are via post or get, etc). But it's possible.
Hey, wait !
This is a powerfull automated testing tool :-)

The QA should like it : it provides a way to automate regression testing.
The developers may like it : it provides a way for eXtrem Programming (coding the tests then the feature) if they like XP.

Documentation's users' cases can become test cases.

Too lazy... I hadn't seen all the power ;-)

Pierre M.

Re: Automation though wget

Posted: Sun Sep 09, 2007 9:51 pm
by calguy1000
Yes, it is an excellent automated testing tool.

I need to write a couple of scripts.... one for populating a couple of hundred news items into the database, and one for populating some FEU users.

The problem is, it take time to write all of these things.... and the permutations and combinations would be combersome.  As well, this is only 1/2 of the solution, as I provide no way at this time to validate the result of everything.