18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Integration with Jenkins
Hello,
I have been tasked with looking into integration with Jenkins, but I've ended up a bit confused. Can this be done with Sahi Open Source, or is it only possible with Sahi Pro? If it is possible with the open source version, could you point me to some instructions. So far, everything I have seen refers to Sahi Pro.
Thank you in advance.
I have been tasked with looking into integration with Jenkins, but I've ended up a bit confused. Can this be done with Sahi Open Source, or is it only possible with Sahi Pro? If it is possible with the open source version, could you point me to some instructions. So far, everything I have seen refers to Sahi Pro.
Thank you in advance.
Best Answer
-
Hi
you can totally use Sahi OS, here is how i automated nightly tests with sahi OS:
get the https://wiki.jenkins-ci.org/display/JENKINS/Custom+Tools+Plugin
Configure jenkins to install sahi from an archive.
On your Jenkins Slave, define an environment variable $SAHI_HOME.
When I am running my tests I do 3 Things:
Install and clean sahi:
Tick "Install Custom Tool" Sahi in the configurations.echo "kill Sahi if running" PID=$(lsof -i:9999 -F p | cut -dp -f2) if test -z $PID ; then echo "no Sahi running" ; else kill $PID ; fi export SAHI_HOME=$SAHI_HOME/sahi // this export is a WTF, but jenkins messes with the environment variables -.- echo "remove browser profiles" rm -rf $SAHI_HOME/userdata/browser/* echo "starting sahi to make sure the profiles are set up correctly" // display created from Xvfb, start and stop currently not automated - TODO DISPLAY=:0 sh "${SAHI_HOME}/bin/sahi.sh" & SAHI=$! sleep 2 kill $SAHI // setup automatic SSLcert creation echo "build root CA" openSslCerts.sh buildRoot openSslCerts.sh buildNewCert sahi.example.com export SAHI_HOME=$SAHI_HOME/sahi echo "Adding CA to chromium/chrome NSS Shared DB" echo "You may clean it once in a while" certutil -A -n Sahi_Root -t "C,," -i $SAHI_HOME/userdata/certs/ca.crt -d sql:/home/s-treadmill/.pki/nssdb echo "Adding CA to firefox sahi0 profile" certutil -A -n Sahi_Root -t "C,," -i $SAHI_HOME/userdata/certs/ca.crt -d $SAHI_HOME/userdata/browser/ff/profiles/sahi0
Checkout/update some common libraries for all projects:
e.g. javascript files which get _included()
Run Test:// start sahi and add sahi/bin to $PATH cd $SAHI_HOME/bin export PATH=$PATH:$SAHI_HOME/bin DISPLAY=$XVFB_DISPLAY sh sahi.sh & //start testrunner java -cp $SAHI_HOME/lib/ant-sahi.jar net.sf.sahi.test.TestRunner \ -test $WORKSPACE/nightly.suite \ -browserType chromium \ -baseURL http://sahi.example.com/_s_/dyn/Driver_initialized \ -host localhost \ -port 9999 \ -threads 1 \ -useSingleSession false \ -initJS " \ \$jenkinsBuildIndex='$BUILD_NUMBER'; \ \$jenkinsTimestamp='$BUILD_ID'; \ \$jenkinsJobName='$JOB_NAME'; \ \$jenkinsSlave='$NODE_NAME'; \ " \ -htmlLog true \ -htmlLogDir $WORKSPACE/target \ -junitLog true \ -junitLogDir $WORKSPACE/target // kill sahi lsof -i:9999 -F p | cut -dp -f2 | xargs kill
As Post-Build Action you can create a report from the JUnit Testresults
I hope this can clear things up. Feel free to ask any questions, this code may not be very selfexplainatory and I am to lazy to make sone screenshots right now.
If you like we could skype or google-hangout when you can't get nowhere with this
Regards
Wormi

Answers
Jenkins integration is bit difficult with information provided in sahi's site.
I too had many problems with it.
But now, its almost done.
The only part remaining for me is to get sahi's log to be used with JUnit and report generation using it.
@Wormi, will be great help if you can share how report is made using JUnit. hope you have used sahi's log.
Will get back to you when I try this and have trouble. :-)
There should be a Post-Build action for Junit Results. If not, there may be a missing plugin but I just can't finde any related plugin im my list..
Whatever, if you used "-junitLog true \
-junitLogDir $WORKSPACE/target"
then you should by able to set "target/*.xml" as pattern for the JunitResults.
Post-Build action is set and a report is getting generated.
i just wanted to know if sahi's log can be brought into the junit reports.
By sahi's log, i mean the one that will be saved into "userdata\logs\playback" folder.
same thing that is said in this thread.
http://sahi.co.in/forums/discussion/4736/sahi-reports-in-jenkins/p1
-htmlLog true \
-htmlLogDir $WORKSPACE/target \
-junitLog true \
-junitLogDir $WORKSPACE/target
The jenkinsDomain/recycle/job/yourTestJob/ws/target/index.htm lists the latest testreports.
Or is there something else you want to do with the reports?
Could you please explain further what you want to achieve?
will try what you said above.
Thanks