ERP en LOGICIEL LIBRE dédié aux PME-PMI

           Devenez partenaire Principal ou Majeur de Neogia

ConfigurationHudson


Contents

Introduction

java -jar hudson.jar --httpPort=8888

Firefox 3

export LD_LIBRARY_PATH="/opt/gtk210/lib"

selenium server

Configuration Xvnc pour un serveur type dedibox sous debian

/usr/bin/vnc/Xvnc :10 -geometry 800x600 -fp /usr/share/fonts/X11/misc

Configuration du job selenium

via ANT

<?xml version="1.0" encoding="UTF-8"?>
<project name="Selenium testing" default="build" basedir=".">
 <property environment="env" />
 <property name="test.suite"           value="${basedir}/TestSuite.html" />
 <property name="firefox"              value="*firefox /usr/lib/firefox3/firefox3-bin"/>
 <property name="base.url"             value="http://localhost:4455" />
 <property name="firefox.profile.dir"  value="/var/www/vdev/Profil" />
 <property name="result.file"          value="result_${env.BUILD_NUMBER}_${env.BUILD_ID}.html" />
 <property name="result.dir"           value="${basedir}/result" />
 <target name="run-selenium-tests">
   <mkdir dir="${result.dir}" />
   <java jar="${basedir}/selenium-server.jar"
           fork="true" spawn="false">
     <arg line="-port "4455""/>
     <arg line="-htmlSuite "${firefox}""/>
     <arg line=""${base.url}""/>
     <arg line=""${test.suite}""/>
     <arg line=""${result.dir}/${result.file}""/>
     <arg line="-avoidProxy" />
     <arg line="-timeout 30000"/>
     <arg line="-debug"/>
     <arg line="-trustAllSSLCertificates"/>
     <arg line="-firefoxProfileTemplate "${firefox.profile.dir}""/>
     <arg line="-browserSessionReuse"/> 
     <arg line="-log "${basedir}/log.log""/>
     <arg line="-singleWindow" />
   </java>
   <echo message="Copying result.html"/>
   <copy file="${result.dir}/${result.file}" todir="${env.WORKSPACE}/../builds/${env.BUILD_ID}/"/>
   <echo message="Copying log file"/>
   <copy file="log.log" todir="${env.WORKSPACE}/../builds/${env.BUILD_ID}/"/>
 </target>
 <target name="storingResults">
   <echo message="Renaming result.html to result_BUILDNUMBER_DATE.html"/>
   <copy file="${result.dir}/result.html" tofile="${result.dir}/${result.file}"/>
 </target>
 <target name="stop-server">
   <get taskname="selenium-shutdown" 
      src="http://localhost:4455/selenium-server/driver/?cmd=shutDown"    
      dest="result.txt" ignoreerrors="true" />
   <echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" />
 </target>
 <target name="info">
   <echo message="Affichage des variables Hudson pour ANT"/>
   <echo message="buildId = ${env.BUILD_ID}" />
   <echo message="buildNumber = ${env.BUILD_NUMBER}"/>
   <echo message="jobName = ${env.JOB_NAME}"/>
   <echo message="buildTag = ${env.BUILD_TAG}"/>
   <echo message="executorNumber = ${env.EXECUTOR_NUMBER}"/>
   <echo message="javaHome = ${env.JAVA_HOME}"/>
   <echo message="workspace = ${env.WORKSPACE}"/>
   <echo message="hudsonURL = ${env.HUDSON_URL}"/>
   <echo message="SVN revision = ${env.SVN_REVISION}"/>
   <echo message="cvs branch = ${env.CVS_BRANCH}"/>
   <echo message="basedir = ${basedir}"  />
 </target>
</project>

via le plugin seleniumhq

Création du projet selenium

via ANT

via seleniumhq

Enchaînements de builds

Le but ici va être d'enchaîner les actions suivantes :

  1. mettre à jour le projet
  2. faire un ant clean-all
  3. faire un ant run-install
  4. lancer le serveur
  5. effectuer les tests
  6. arrêter le serveur

Pour cela nous allons créer deux projets :

Configuration du lancement

http://svn.apache.org/repos/asf/ofbiz/trunk
ofbiz
ant clean-all
ant run-install
cd ofbiz/
echo "Starting ofbiz be patient .."
sleep 10
# shutdown settings
ADMIN_PORT=10523
ADMIN_KEY=so3du5kasd5dn
# console log file
OFBIZ_LOG=runtime/logs/console.log
# delete the last log
rm -f $OFBIZ_LOG
# VM args
ADMIN="-Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY"
#DEBUG="-Dsun.rmi.server.exceptionTrace=true"
#automatic IP address for linux
#IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print  $1}'`
#RMIIF="-Djava.rmi.server.hostname=$IPADDR"
MEMIF="-Xms128M -Xmx512M"
#MISC="-Duser.language=en"
VMARGS="$MEMIF $MISC $DEBUG $RMIIF $ADMIN"
# Worldpay Config
#VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar $VMARGS"
# location of java executable
if [ -f "$JAVA_HOME/bin/java" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA=java
fi
# start ofbiz
$JAVA $VMARGS -jar ofbiz.jar $* >>$OFBIZ_LOG 2>>$OFBIZ_LOG&
ok=true
echo "."
while($ok)
 do
   if [ -z "$(grep -i 'CatalinaContainer.java:235' runtime/logs/console.log)" ]; then
     echo -n "."
     sleep 4
   else
     ok=false
   fi
 done
echo "ofbiz Ready, Starting Selenium Test .."
le nom de mon projet selenium

Configuration de l'arrêt

le nom de mon projet selenium
cd ~/.hudson/jobs/ofbizTrunk/workspace/ofbiz
sh stopofbiz.sh
sleep 4
sh stopofbiz.sh

Il faut mettre le chemin vers le workspace



Erreurs au lancement

Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'

alors faire un

cp /etc/X11/rgb.txt /usr/X11R6/lib/X11/
_XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running

alors faire un

netstat -ln

et rechercher s'il y a une connexion sur le port 6000 + n° de display et puis trouver ce qui traine derrière