PMC:QA:optimizing integration of hudson and sahi

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Optimizing integration of hudson and sahi

Env:

  • system:linux gentoo
  • sahi:20100803
  • firefox 3.5.6
  • xvfb

install xvfb and create a starting script /etc/inid.d/xvfb

XVFB=/usr/bin/Xvfb
XVFBARGS=":99 -auth /etc/X99.hosts -screen 0 800x600x24"
PIDFILE=/var/run/xvfb.pid
case "$1" in
  start)
    echo -n "Starting virtual X frame buffer: Xvfb"
    start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVBARGS
    echo "."
    ;;
  stop)
    echo -n "Stopping virtual X frame buffer: Xvfb"
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
    echo "."
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
        echo "Usage: /etc/init.d/xvfb {start|stop|restart}"
        exit 1
esac
exit 0

First need to start xvfb:

#/etc/init.d/xvfb start
Starting virtual X frame buffer: Xvfb.

build file

create build files,can put them in sahi home directory

write a build properties file,then we can easy to modify properties.

Example:

zkdemo.properties

sahi.home=/opt/Sahi/sahi
user.data=/opt/Sahi/sahi/userdata
urlbase=http://adqa.adempiereqa.com/webui
suite=/opt/Sahi/sahi/userdata/scripts/ADtest/test/test.suite
browser=/usr/bin/firefox
sahi.host=localhost
sahi.port=9999
browserProcessName=firefox
logdir=/opt/hudson/jobs/Sahi/workspace/logs

zkdemo.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="bids" default="runfftests">
<property file="./zkdemo.properties"/>
       <taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="${sahi.home}/lib/ant-sahi.jar"/>
       <target name="runfftests">
       <antcall target="startsahi"/>
       <sleep seconds="4"/>
               <sahi suite="${suite}"
                     browser="${browser}"
                     baseurl="${urlbase}"
                     sahihost="${sahi.host}"
                     sahiport="${sahi.port}"
                     failureproperty="sahi.failed"
                     haltonfailure="false"
                     browseroption="--display=:99 -profile ${user.data}/browser/ff/profiles/sahi0 -no-remote"
                     browserProcessName="${browserProcessName}"
                     threads="1">
                     <report type="html"/>
                    <report type="junit" logdir="${logdir}"/>
               </sahi>
               <sleep seconds="4"/>
               <antcall target="stopsahi"/>
               <sleep seconds="4"/>
               <antcall target="failsahi"/>
       </target>
               <target name="failsahi" if="sahi.failed">
               <fail message="Sahi tests failed!"/>
       </target>
               <target name="startsahi" description="start sahi proxy">
               <java classname="net.sf.sahi.Proxy" fork="true" spawn="true" dir="${sahi.home}">
                       <!--<env key="MOZ_NO_REMOTE" value="1"/>-->
                       <classpath location="${sahi.home}/lib/sahi.jar">
                               <fileset dir="${sahi.home}/extlib" includes="**/*.jar"/>
                       </classpath>
                       <arg value="${sahi.home}" id="basePath"/>
                       <arg value="${user.data}" id="userdataPath"/>
               </java>
       </target>
       <target name="stopsahi" description="stop sahi server">
               <sahi stop="true" sahihost="${sahi.host}" sahiport="${sahi.port}"/>
       </target>
</project>
  • Above set two type report
    • html:default in sahi_home/userdata/logs/playback
    • junit:xml format reports,i set it in hudson_home/jobs/Sahi/workspace/logs,thus we can "Publish JUnit test result report"

Ohusa1.png

hudson configration

Example:

Ohusa.png

Test result

html report

eg, sahi/userdata/logs/playback/test__03Sep2010__15_43_50/create_product__03Sep2010__15_43_50.htm

Ohusa2.png

junit report

eg,hudson/jobs/Sahi/workspace/logs/TEST-create_product__03Sep2010__15_43_50.xml

Ohusa3.png

Test Result Trend

Ohusa4.png

review test result in hudson

click "Latest Test Result " or

1.select build in "Build History"

2.select "Test Result"

Ohusa5.png

Ohusa6.png

POC: http://www.adempiereqa.com/hudson/job/Sahi/

Links

   * Go back to PMC:QA