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.
Junit xml
Hi!
I try to use sahi with hudson jenkins. In order to do this I need xml logs in out. I run my tests like this:
java -cp c:\sahi\lib\ant-sahi.jar net.sf.sahi.test.TestRunner -test "c:\sahi\userdata\scripts\oprint\bc_orderflow.sah" -browserType ie -baseURL http://test.optimalprint.com -threads 1 -junitLog true -htmlLog true -junitLogDir c:\www\temp\sahi-test\xml -htmlLogDir c:\www\temp\sahi-test\html
I get .xml on out, BUT hudson cant read it. This lines from hudson console log:
Recording test results
And this is generated by sahi xml report:
Please advise
I try to use sahi with hudson jenkins. In order to do this I need xml logs in out. I run my tests like this:
java -cp c:\sahi\lib\ant-sahi.jar net.sf.sahi.test.TestRunner -test "c:\sahi\userdata\scripts\oprint\bc_orderflow.sah" -browserType ie -baseURL http://test.optimalprint.com -threads 1 -junitLog true -htmlLog true -junitLogDir c:\www\temp\sahi-test\xml -htmlLogDir c:\www\temp\sahi-test\html
I get .xml on out, BUT hudson cant read it. This lines from hudson console log:
Recording test results
ERROR: Failed to archive test reports
hudson.util.IOException2: Failed to read /var/lib/jenkins/jobs/Sahi_tests_firefox_test/workspace/build/logs/TEST-bc_orderflow__26Apr2011__12_55_24.xml
at hudson.tasks.junit.TestResult.parse(TestResult.java:215)
at hudson.tasks.junit.TestResult.parse(TestResult.java:155)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:118)
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:114)
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:87)
at hudson.FilePath.act(FilePath.java:756)
at hudson.FilePath.act(FilePath.java:738)
at hudson.tasks.junit.JUnitParser.parse(JUnitParser.java:83)
at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:123)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:135)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:649)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:625)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:603)
at hudson.model.Build$RunnerImpl.post2(Build.java:161)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:572)
at hudson.model.Run.run(Run.java:1386)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: org.dom4j.DocumentException: Error on line 54 of document file:///var/lib/jenkins/jobs/Sahi_tests_firefox_test/workspace/build/logs/TEST-bc_orderflow__26Apr2011__12_55_24.xml : The value of attribute "name" associated with an element type "null" must not contain the '<' character. Nested exception: The value of attribute "name" associated with an element type "null" must not contain the '<' character.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:264)
at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:101)
at hudson.tasks.junit.TestResult.parse(TestResult.java:200)
... 19 more
Caused by: org.xml.sax.SAXParseException: The value of attribute "name" associated with an element type "null" must not contain the '<' character.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:932)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:460)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:277)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
... 22 more
Finished: FAILURE
And this is generated by sahi xml report:
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="0" name="bc_orderflow.sah" tests="44">
<testcase name="_navigateTo("http://test.optimalprint.net");"></testcase>
<testcase name="_sahi.setServerVar('___lastValue___1303818863718', _isVisible(_submit("Authenticate")));"></testcase>
<testcase name="_navigateTo("/en-US/");"></testcase>
<testcase name="_sahi.setServerVar('___lastValue___1303818864591', _exists(_byId("node_btn_logout")));"></testcase>
<testcase name="_click( _byId("signInLink") );"></testcase>
<testcase name="_click( _byId("email") );"></testcase>
<testcase name="_setValue( _byId("email"), "selenium1@test-mail.com");"></testcase>
<testcase name="_setValue( _byId("psw"), "selenium1");"></testcase>
<testcase name="_click( _link(0, _in( _byClassName("loginBoxBtn", "div", _in( _byId("loginForm") ))) ));"></testcase>
<testcase name="_assertNotNull( _byId("node_btn_logout") );"></testcase>
<testcase name="_click( _link("tabCtrlBusiness") );"></testcase>
<testcase name="_click( _link("Business Cards[1]"));"></testcase>
<testcase name="_click( _span("button blue") );"></testcase>
<testcase name="_click( _link("nodeSelectDesign0") );"></testcase>
<testcase name="Designer Text Test begins here."></testcase>
<testcase name="_log("Designer Text Test begins here.", "info");"></testcase>
<testcase name="_wait(1000);"></testcase>
<testcase name="_sahi.setServerVar('___lastValue___1303818896213', _isVisible(_byId("popupImageLoaderWaiting")));"></testcase>
<testcase name="_wait(1000);"></testcase>
<testcase name="_sahi.setServerVar('___lastValue___1303818897415', _isVisible(_byId("preview_loading")));"></testcase>
<testcase name="_click( _link(0, _in(_byId("tab2"))) );"></testcase>
<testcase name="_click( _div("add_text_button") );"></testcase>
<testcase name="Designer Text Edit begins here."></testcase>
<testcase name="_log("Designer Text Edit begins here.", "info");"></testcase>
<testcase name="_doubleClick(_div("dd dt editable ui-draggable ui-resizable selected"));"></testcase>
<testcase name="_rteWrite(_rte("text_editor_area_ifr"), "Selenium test text");"></testcase>
<testcase name="_click(_link("text_editor_area_fontsizeselect_text"));"></testcase>
<testcase name="_click(_span("mceText[28]"));"></testcase>
<testcase name="_click(_span("mceIcon mce_bold"));"></testcase>
<testcase name="_click(_span("mceIcon mce_italic"));"></testcase>
<testcase name="_click(_span("mceIcon mce_underline"));"></testcase>
<testcase name="_click(_span("mceIcon mce_justifyleft"));"></testcase>
<testcase name="_click(_span("mceIcon mce_justifycenter"));"></testcase>
<testcase name="_click(_span("mceIcon mce_justifyright"));"></testcase>
<testcase name="_click(_span("mceIcon mce_lineheight"));"></testcase>
<testcase name="_click(_link("90%"));"></testcase>
<testcase name="_click( _byId("apply_text_editor_changes_button") );"></testcase>
<testcase name="_dragDropXY(_div("dd dt editable ui-draggable ui-resizable selected"), 40, 40, true);"></testcase>
<testcase name="Designer Image Test begins here."></testcase>
<testcase name="_log("Designer Image Test begins here.", "info");"></testcase>
<testcase name="_click( _byId("add_image_button") );"></testcase>
<testcase name="_doubleClick(_table("start-InlineEditor start-InlineEditor-txt"));"></testcase>
<testcase name="_click( _link(0, _in(_byId("tabUploader"))) );"></testcase>
<testcase name="_setFile(_file("picture_file_1"), "d:\\Images\\"+"sunrise.jpg", "upload/file_from_swf?action=upload");
Error: File not found: d:\Images\sunrise.jpg; Base directory is userdata directory: C:\sahi\userdata
Error("File not found: d:\\Images\\sunrise.jpg; Base directory is userdata directory: C:\\sahi\\userdata")@:0
([object HTMLInputElement],"d:\\Images\\sunrise.jpg","http://test.optimalprint.net/en-US/upload/file_from_swf")@http://test.optimalprint.net/_s_/spr/concat.js:987
()@http://test.optimalprint.net/_s_/spr/concat.js:2831
()@http://test.optimalprint.net/_s_/spr/concat.js:2831
@http://test.optimalprint.net/_s_/spr/concat.js:2643
<a href='/_s_/dyn/Log_getBrowserScript?href=C:\sahi\userdata\scripts\oprint\bc_orderflow.sah&n=987'><b>Click for browser script</b></a>
at uploadFile (scripts/oprint/lib/functions.sah:2)
">
<failure message="Assertion Failed"></failure>
</testcase>
</testsuite>
Please advise
Comments
This is not available in the current version.
The next version of Sahi will produce XML test reports that can be viewed from Jenkins.
Regards,
dkulkarni
Waiting for it
Could you please tell me when we will be able to get the new version of Sahi with the above feature implemented. Will it be available with Sahi pro only or also along with Sahi?
Regards,
Sreejit P
The above features are available in the latest version of Sahi and Sahi pro.
Regards
Sumitra
Output in Hudsons console:
And the XML file generated by Sahi:
I know that I probably could fix the test that's causing the error to be thrown, but I think we should still be able to expect Sahi to produce valid XML.
Please let me know if there is a way to fix this.
Thanks in advandce!
The XML file which you have posted is for the Older version of Sahi.
Jenkins integration is available since this build- SahiV3.5:2011-03-28
Kindly try with the latest version of Sahi.
Regards
Sumitra
I added the following to testrunner.sh
[-junitLog true -junitLogDir "/tmp/xmllog" ]
I can see that the xml log is generated but the output contains only the testsuite name nothing else.
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="0" name="disks_summary.sah.disks_summary" tests="1" time="83.75">
<testcase classname="disks_summary.sah.disks_summary" name="disks_summary.sah" time="83.75">
....
.....
(Blank lines)
....
</testcase></testsuite>
Am i missing something or is there a bug?
I'm really in need of knowing why even on the new version I'm not able to generate the needed output