Commits

Anonymous committed 2b76545

#117505# Collect assertions from nonpro OOo for QUAste status files

  • Participants
  • Parent commits 6a546ed

Comments (0)

Files changed (2)

File testautomation/global/system/includes/gvariabl.inc

 Global gErrorSum as Integer         '///+ gErrorSum : last value of errors in a test
 Global gWarningSum as Integer       '///+ gWarningSum : last value of warnings in a test
 Global gQaErrorSum as Integer       '///+ gQaErrorSum : last value of qaErrors in a test
+Global gAssertionSum as Integer     '///+ gAssertionSum : last value of Assertions in a test
 Global gStatusDuration              '///+ gStatusDuration : starting time to get at the end the duration of a test
 Global gTestcaseStart as Date       '///+ gTestCaseDuration : starting time of the testcase
 Global glsStatusPage (32000) as String  '///+ glsStatusPage () : list for the output in the status-page

File testautomation/global/system/includes/status.inc

     gErrorSum = getErrorCount()      ' not 0! if you run 2-times status in/out in one bas-file!
     gWarningSum = getWarningCount()
     gQaErrorSum = getQaErrorCount()
+    gAssertionSum = 0
     
     ' make sure we have everything to update the status-Database.
     gDatabasePath = getDatabasePath(privateDatabasePath)
     PrintLog Chr(13) + "* - End of the test - *"
     Printlog "Date : " + Date() + "   Time: " + Time()
     Printlog "Duration : " + sLocalTestDuration
+    ' Output assertion count message only in nonpro version
+    if (NOT isProduct) then
+        if (gAssertionSum > 0) then
+            warnlog " ** " + gAssertionSum + " Assertions"
+        else
+            printlog " ** " + gAssertionSum + " Assertions"
+        endif
+    endif
+end sub
+
+sub hGetNonproAssertions(sName as string, sDuration as string)
+    Dim sResultFilePath as string
+    dim fList(15000) as string
+    dim i, a as integer
+    dim aCount as integer
+    dim x
+    dim soutput as string
+    dim xlist(15000) as string
+
+    if (bDebugVersion = true) then
+        'Get the path to the RESULT directory and put resultfile into array
+        sResultFilePath = GetIniValue (gTesttoolIni, gTTProfileName , "LogBaseDir") + gPathSigne + Left(gTestname, Len(gTestname)-4) + ".res"
+        listRead(fList, sResultFilePath, "UTF8")
+        for i=1 to listcount(fList(0))
+            'Go through whole file, but only last testrun counts
+            if (left(fList(i),1,1) = "0") then
+                'Line starting with 0 indicates start of new testrun: reset counters
+                aCount=0
+                listalldelete(xlist())
+            endif 
+            if (left(fList(i),1,1) = "6") then
+                'Assertion found like:
+                '5;~global\system\includes\master.inc;533;12;65535;"Dial
+                '0   1: file                          2:Line        5:Text
+                x = split(fList(i), ";")
+                aCount=aCount+1
+                sOutput =          sName _
+                        + Chr(9) + sDuration _
+                        + Chr(9) + "4" _
+                        + Chr(9) + mid(fRemoveLineBreaks(x(5)),2, len(fRemoveLineBreaks(x(5)))-2) _
+                        + Chr(9) + x(2) _
+                        + Chr(9) + "No Revision found" _
+                        + Chr(9) + fgetFileName(x(1)) _
+                        + Chr(9) 
+                ListAppend (xlist(), sOutput)
+            endif 
+        next i
+        'Update global message list
+        for i = gAssertionSum +1 to listcount(xlist)
+            ListAppend (glsStatusPage(), xlist(i))
+        next i
+        'Update global assertion counter
+        gAssertionSum = aCount 
+    endif 
 end sub
 
 sub hStatusAddTestcase()
     '///+ duration => the duration of the testcase
 
     sTestcaseDuration = wielange(gTestcaseStart, 1)     '(2)
-    sTestcaseStart    = convertDateToDatabase(gTestcaseStart) + " " + convertTimeToDatabase(gTestcaseStart) ' TODO: ask HDE/TBO
+    sTestcaseStart    = convertDateToDatabase(gTestcaseStart) + " " + convertTimeToDatabase(gTestcaseStart)
     
     sTCname = GetTestcaseName  ' testtool basic command
         iCut = Instr ( sTCname, "(" )
     endif
     
     ' generate status line for testcase and append to global array
-    '/// iErrorLevel: 0: no faults; 1: Warning; 2: Error; 3: qaError ///'
+    '/// iErrorLevel: 0: no faults; 1: Warning; 2: Error; 3: qaError; 4: Assertion ///'
     iErrorLevel = -1
 'D    printlog "Iall: " + iAllErrorCount + " W:" + iWarningCount + " E: " + iErrorCount
     for i = 0 to iAllErrorCount
     gErrorSum = getErrorCount()
     gQaErrorSum = getQaErrorCount()
     gWarningSum = getWarningCount()
+    hGetNonproAssertions(sTCname, sTestcaseDuration) ' workaround to get assertions count
 end sub
 
 sub hStatusWriteOutputFirstFile ()
     dim sTemp as string
     dim sFileName as string
     dim slVersion() as string
+    dim iDebug as integer
     dim ilVersion as integer
     dim sVersionCWS as string
     dim iPosA as integer
     '///+ 13 cws name => if it is the master: 'Master' else the name of the childworkspace
     '///+ 14 source tree => 
     '///+ 15 product => 
-    '///+ 16 builder => 
+    '///+ 16 debug => 
     '///+ 17 checksum => 
     '///+ data => 
 
         sUsername = gReturnAddress
     endif
 
+    if (isProduct()) then
+        iDebug = 0
+    else
+        iDebug = 1
+    endif
+
     ListAppend ( lTestrun(), "fileformat=0.2"             )
     ListAppend ( lTestrun(), "product=" + sProduct        )
     ListAppend ( lTestrun(), "sourcetree=" + sSource      )
     ListAppend ( lTestrun(), "testname=" + gTestName      )                        '(10) ' generated in hStatusIn
     ListAppend ( lTestrun(), "cws=" + sVersionCWS         )
     ListAppend ( lTestrun(), "ooolanguage=" + iSprache    )                        '(9)
+    ListAppend ( lTestrun(), "debug=" + iDebug            )                        
     ListAppend ( lTestrun(), "checksum=" + "")
 '    ListAppend ( lTestrun(), "data=" + )