go to post Caza Cazamir · Jul 18, 2018 It's a good idea to also have look at https://community.intersystems.com/post/deploying-applications-intersystems-cache-installer in case you have to create a CSP application, specific global mappings, etc.
go to post Caza Cazamir · Jun 5, 2017 If you add to your batch script something like: do ##class(com.isc.UnitTest.Manager).OutputResultsXml("c:/unittests/unit_test_results.xml") then you could pass on the unit_test_results.xml file to the JUnit plugin from Jenkins. This will give you useful reports, duration and individual results breakdown, etc. For example: https://support.smartbear.com/testcomplete/docs/_images/working-with/integration/jenkins/trend-graph.png
go to post Caza Cazamir · Jun 4, 2017 Hi Ankita, I found a couple of issues in the script that might affect your end results:- the folder C:\unittests doesn't exist (at least not on my computer); unless the value of the WORKSPACE env variable is C:\untittest then you have to ensure the folder exists (you can create it either using batch mkdir or using COS ##class(%%File).CreateDirectoryChain() method )- what is stored in the ^UnitTest.Result(i,"myunittest") global is not a status code but a numeric value; so I would suggest replacing Do $system.OBJ.DisplayError(r3) with a simple write command, like this: @ECHO if r3'= 0 set file = "C:/unittests/successflag.txt" o file:("NWS") u file write r3 >>build.cos @ECHO if r3'= 1 set file = "C:/unittests/failureflag.txt" o file:("NWS") u file write r3 >>build.cos Regarding "@ECHO %FAILUREFLAG%" - make sure there are no spaces before or after the = character in the following two commands: @SET SUCCESSFLG =%CD%\successflag.txt @SET FAILUREFLAG =%CD%\failureflag.txt When I did copy/paste of the example script I ended up with a space character before the = character. Can you try these changes and let me know how you go? Cheers,Caza
go to post Caza Cazamir · Jun 2, 2017 Hi Ankita,Would you be able to provide some more details about how you currently run the unit tests from your batch script? Regards,Caza
go to post Caza Cazamir · May 31, 2017 I second that.Please see my response in the other thread - https://community.intersystems.com/post/unit-test-intersystem-jenkins. Hope this helps.Caza
go to post Caza Cazamir · May 31, 2017 Hi, We use something like the below to output the unit test results to an xml file in JUnit format. /// Extend %UnitTest manager to output unit test results in JUnit format. /// This relies on the fact that unit test results are stored in <b>^UnitTest.Result</b> global. Results displayed on CSP pages come from this global. Class com.isc.UnitTest.Manager Extends %UnitTest.Manager { ClassMethod OutputResultsXml(pFileName As %String) As %Status { set File=##class(%File).%New(pFileName) set i=$order(^UnitTest.Result(""),-1) if i="" quit $$$OK // no results kill ^||TMP // results global set suite="" for { set suite=$order(^UnitTest.Result(i,suite)) quit:suite="" set ^||TMP("S",suite,"time")=$listget(^UnitTest.Result(i,suite),2) set case="" for { set case=$order(^UnitTest.Result(i,suite,case)) quit:case="" if $increment(^||TMP("S",suite,"tests")) set ^||TMP("S",suite,"C",case,"time")=$listget(^UnitTest.Result(i,suite),2) set method="" for { set method=$order(^UnitTest.Result(i,suite,case,method)) quit:method="" set ^||TMP("S",suite,"C",case,"M",method,"time")=$listget(^UnitTest.Result(i,suite,case,method),2) set assert="" for { set assert=$order(^UnitTest.Result(i,suite,case,method,assert)) quit:assert="" if $increment(^||TMP("S",suite,"assertions")) if $increment(^||TMP("S",suite,"C",case,"assertions")) if $increment(^||TMP("S",suite,"C",case,"M",method,"assertions")) if $listget(^UnitTest.Result(i,suite,case,method,assert))=0 { if $increment(^||TMP("S",suite,"failures")) if $increment(^||TMP("S",suite,"C",case,"failures")) if $increment(^||TMP("S",suite,"C",case,"M",method,"failures")) set ^||TMP("S",suite,"C",case,"M",method,"failure")=$get(^||TMP("S",suite,"C",case,"M",method,"failure")) _$listget(^UnitTest.Result(i,suite,case,method,assert),2) _": "_$listget(^UnitTest.Result(i,suite,case,method,assert),3) _$char(13,10) } } if ($listget(^UnitTest.Result(i,suite,case,method))=0) && ('$data(^||TMP("S",suite,"C",case,"M",method,"failures"))) { if $increment(^||TMP("S",suite,"failures")) if $increment(^||TMP("S",suite,"C",case,"failures")) if $increment(^||TMP("S",suite,"C",case,"M",method,"failures")) set ^||TMP("S",suite,"C",case,"M",method,"failure")=$get(^||TMP("S",suite,"C",case,"M",method,"failure")) _$listget(^UnitTest.Result(i,suite,case,method),3) _": "_$listget(^UnitTest.Result(i,suite,case,method),4) _$char(13,10) } } if $listget(^UnitTest.Result(i,suite,case))=0 && ('$data(^||TMP("S",suite,"C",case,"failures"))) { if $increment(^||TMP("S",suite,"failures")) if $increment(^||TMP("S",suite,"C",case,"failures")) if $increment(^||TMP("S",suite,"C",case,"M",case,"failures")) set ^||TMP("S",suite,"C",case,"M",case,"failure")=$get(^||TMP("S",suite,"C",case,"M",case,"failure")) _$listget(^UnitTest.Result(i,suite,case),3) _": "_$listget(^UnitTest.Result(i,suite,case),4) _$char(13,10) } } } do File.Open("WSN") do File.WriteLine("<?xml version=""1.0"" encoding=""UTF-8"" ?>") do File.WriteLine("<testsuites>") set suite="" for { set suite=$order(^||TMP("S",suite)) quit:suite="" do File.Write("<testsuite") do File.Write(" name="""_$zconvert(suite,"O","XML")_"""") do File.Write(" assertions="""_$get(^||TMP("S",suite,"assertions"))_"""") do File.Write(" time="""_$get(^||TMP("S",suite,"time"))_"""") do File.Write(" tests="""_$get(^||TMP("S",suite,"tests"))_"""") do File.WriteLine(">") set case="" for { set case=$order(^||TMP("S",suite,"C",case)) quit:case="" do File.Write("<testsuite") do File.Write(" name="""_$zconvert(case,"O","XML")_"""") do File.Write(" assertions="""_$get(^||TMP("S",suite,"C",case,"assertions"))_"""") do File.Write(" time="""_$get(^||TMP("S",suite,"C",case,"time"))_"""") do File.Write(" tests="""_$get(^||TMP("S",suite,"C",case,"tests"))_"""") do File.WriteLine(">") set method="" for { set method=$order(^||TMP("S",suite,"C",case,"M",method)) quit:method="" do File.Write("<testcase") do File.Write(" name="""_$zconvert(method,"O","XML")_"""") do File.Write(" assertions="""_$get(^||TMP("S",suite,"C",case,"M",method,"assertions"))_"""") do File.Write(" time="""_$get(^||TMP("S",suite,"C",case,"M",method,"time"))_"""") do File.WriteLine(">") if $data(^||TMP("S",suite,"C",case,"M",method,"failure")) { do File.Write("<failure type=""cache-error"" message=""Cache Error"">") do File.Write($zconvert(^||TMP("S",suite,"C",case,"M",method,"failure"),"O","XML")) do File.WriteLine("</failure>") } do File.WriteLine("</testcase>") } do File.WriteLine("</testsuite>") } do File.WriteLine("</testsuite>") } do File.WriteLine("</testsuites>") do File.Close() kill ^||TMP quit $$$OK } }