We have the following machines:
# hudson Start/Stop the Hudson Continuous Integration server.
#
# chkconfig: 345 91 10
# description: Hudson is a Continuous Integration server. \
# It monitors a source code repository and triggers builds \
# when it detects any changes. See https://hudson.dev.java.net/ \
# for more details.
# processname: hudson
# pidfile: /var/run/hudson.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
HUDSON_USER=hudson
start(){
echo -n $"Starting Hudson service: "
su - $HUDSON_USER -c "nohup nice java -jar /home/hudson/hudson.war > ~/hudson.log 2>&1"
RETVAL=$?
echo
}
stop(){
action $"Stopping Hudson service: "
su - $HUDSON_USER -c "kill `ps -ef | grep hudson.war | grep -v grep | awk '{ print $2 }'`"
RETVAL=$?
echo
}
status(){
numproc=`ps -ef | grep hudson.war | grep -v "grep hudson.war" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Hudson is running..."
else
echo "Hudson is stopped..."
fi
}
restart(){
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
cd [user profile];vi user.js
user_pref("security.warn_entering_secure", false);
user_pref("security.warn_entering_weak", false);
user_pref("security.warn_leaving_secure", false);
user_pref("security.warn_submit_insecure", false);
user_pref("security.warn_viewing_mixed", false);
<!-- seleniumHQ tests -->
<target name="-runSeleniumTest">
<echo>Starting test suite ${testSuite}</echo>
<java jar="${jarDir}/selenium-server-standalone.jar"
fork="true"
resultproperty="test.result"
errorProperty="test.failure"
timeout="600000">
<arg line="-htmlSuite "*firefox""/>
<arg line=""${baseURL}""/>
<arg line=""${testDir}/${testSuite}""/>
<arg line=""${reportDir}/${testSuite}.results.html""/>
<arg line="-port ${testPort}"/>
</java>
<condition property="test.failed">
<and>
<isset property="test.result"/>
<not><equals arg1="${test.result}" arg2="0" /></not>
</and>
</condition>
</target>
<target name="-try-test" depends="-runSeleniumTest" if="test.failed">
<!--If there is a test error, capture a screenshot and stop the build-->
<exec executable="import">
<arg line="-window root ${reportDir}/screen.png"/>
</exec>
<fail message="${test.result}: '${test.failure}'" />
</target>
<target name="runAllSeleniumTests" depends="time">
<property name="jarDir" value="${user.home}" />
<property name="testDir" value="tests/" />
<property name="reportDir" value="${user.home}/reports/${DSTAMP}${TSTAMP}" /><!-- note: this folder must be mounted-->
<delete dir="${reportDir}" />
<mkdir dir="${reportDir}"/>
<echo>Running SeleniumHQ tests. Results in ${reportDir}</echo>
<parallel>
<!--The first test to fail stops the build. Add any new test suites here. -->
<!-- It would be better to use foreach, but:
- how to add the optional package?
- how to generate the different ports for every test?
-->
<sequential>
<antcall target="-try-test">
<!--testMyEnrd.html-->
<param name="testSuite" value="testMyEnrd.html" />
<param name="baseURL" value="http://webgate.enrd.eu/agri_enrd_d/myenrd/" />
<param name="testPort" value="4444" />
</antcall>
</sequential>
<sequential>
<antcall target="-try-test">
<!--testRDP.html-->
<param name="testSuite" value="testRDP.html" />
<param name="baseURL" value="http://webgate.enrd.eu/agri_enrd_d/myenrd/" />
<param name="testPort" value="4445" />
</antcall>
</sequential>
</parallel>
</target>
Selenium Grid takes care of starting up the various distributed clients. Grid 2.0 is now included in selenium
# selenium#
# chkconfig: 345 91 10
# description: http://seleniumhq.org/docs/
# processname: selenium
# pidfile: /var/run/selenium.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
HUDSON_USER=hudson
COMMAND="java -jar selenium.last -role hub -port 5555 > ~/selenium.log 2>&1 &"
start(){
echo -n $"Starting Selenium: "
su - $HUDSON_USER -c $COMMAND
RETVAL=$?
echo
}
stop(){
action $"Stopping Selenium: "
su - $HUDSON_USER -c "kill `ps -ef | grep selenium | grep -v grep | awk '{ print $2 }'`"
RETVAL=$?
echo
}
status(){
numproc=`ps -ef | grep selenium-server-standalone.jar | grep -v "grep selenium" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Selenium is running..."
else
echo "Selenium is stopped..."
fi
}
restart(){
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
set hub=http://qkcoi0001:5555 set selenium=selenium-server-standalone-2.3.0.jar start Java java -jar %selenium% -role rc -hub %hub%/grid/register -port 5555 REM check on %hub%/console pause
Grid works with FF, IE, Chrome, Safari; defaults to 5 FF, 5 Chrome, 1 IE instances max.
login test selenium test: