diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-02-14 11:15:55 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-02-14 11:15:55 +0100 |
commit | 68bcb8d2fa5021af8ba67309eee65dc2028adf63 (patch) | |
tree | c62e51105b75f0e415bded15ff887c6bac83839e /smoketestdoc/data | |
parent | f6da0ecba9329d3b4f9d5840cbeaa01c7659f0c4 (diff) |
debuglevels: fixed various issues around the test closure's log file
Diffstat (limited to 'smoketestdoc/data')
-rwxr-xr-x | smoketestdoc/data/Global.xml | 94 | ||||
-rwxr-xr-x | smoketestdoc/data/Test_10er.xml | 115 | ||||
-rwxr-xr-x | smoketestdoc/data/Test_DB.xml | 18 | ||||
-rwxr-xr-x | smoketestdoc/data/Test_Ext.xml | 22 |
4 files changed, 134 insertions, 115 deletions
diff --git a/smoketestdoc/data/Global.xml b/smoketestdoc/data/Global.xml index d437eafe3457..53f913234227 100755 --- a/smoketestdoc/data/Global.xml +++ b/smoketestdoc/data/Global.xml @@ -38,7 +38,7 @@ global const cExtensionFileName = "TestExtension.oxt" global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocClose = 3 global const cDBService = 0, cDBOpen = 1, cDBInsert = 2, cDBDelete = 3, cDBSeek = 4, cDBClose = 5 global const cEXTService = 0, cEXTInstall = 1, cEXTUninstall = 2 -global const cOtherSetupDoc = 0, cOtherWriteStatus = 1 +global const cTestClosureSetupDoc = 0, cTestClosureWriteStatus = 1 global const cLogfileFailed = 255 global const cStWriter = 0, cStCalc = 1, cStPraesentation = 2, cStZeichnen = 3 @@ -54,7 +54,7 @@ global const frmWriter = 1, frmCalc = 2, frmImpress = 4 global const frmMath = 5, frmChart = 7, frmHyperText = 8, frmDraw = 9 global const frmDataBase = 10, frmJava = 13 global const frmExtension = 14 -global const frmTestGlue = 15 +global const frmTestClosure = 15 Global gCurrentDocTest As Integer Global gCurrentTestCase As Integer @@ -139,11 +139,23 @@ Sub AssertionHandler( sMessage as String ) End Sub Sub Main - gCurrentDocTest = frmTestGlue - gCurrentTestCase = cOtherSetupDoc - On Local Error Goto MainError - CaptureAssertions( "AssertionHandler" ) + + gCurrentDocTest = frmTestClosure + gCurrentTestCase = cLogfileFailed + + DeleteAllSavedFiles() + DeleteAllLogFiles() + SetupWorkPath() + + if GetSystem (sWorkPath) = "windows" then + sWorkPath = ConvertPathToWin (sWorkPath) + end if + + LocalTestLog% = OpenLogDat( GetLogFileName( gCurrentDocTest ) ) + + gCurrentTestCase = cTestClosureSetupDoc + CaptureAssertions( "AssertionHandler" ) call SetGlobalDoc @@ -158,10 +170,13 @@ Sub Main LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE ) + Dim nPreserveFileHandle% + nPreserveFileHandle% = LocalTestLog% Call Test_10er.Main + LocalTestLog% = nPreserveFileHandle% - gCurrentDocTest = frmTestGlue - gCurrentTestCase = cOtherWriteStatus + gCurrentDocTest = frmTestClosure + gCurrentTestCase = cTestClosureWriteStatus if bShowTable then call CreateStatusTable2 call CreateStatusTable @@ -170,7 +185,13 @@ Sub Main ' do this LogTestResult call before CreateSecondState, since the latter accesses (and displays) the result call CreateSecondState gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage - end if + Else + LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE ) + End If + + ' print the 'test complete' marker + Print #LocalTestLog%, "---" + LocalTestLog% = 0 gOutputDoc.setModified( bWasModified ) @@ -178,15 +199,22 @@ Sub Main Exit Sub MainError: - LogTestResult( GetTestGlueDescription( gCurrentTestCase ), FALSE ) + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) + Exit Sub + else + LogTestResult( "testclosure " + GetTestGlueDescription( gCurrentTestCase ), FALSE ) + Close #LocalTestLog% + LocalTestLog = 0 + End If End Sub Function GetTestGlueDescription( nTestCase as Integer ) Select Case ( nTestCase ) - case cOtherSetupDoc - GetTestGlueDescription = "setup test document" - case cOtherWriteStatus - GetTestGlueDescription = "write test status" + case cTestClosureSetupDoc + GetTestGlueDescription = "setup" + case cTestClosureWriteStatus + GetTestGlueDescription = "write_status" case Else GetTestGlueDescription = "" End Select @@ -259,8 +287,8 @@ Sub CreateStatusTable2 tableRows2(cEXTUninstall ) = "uninstall" dim tableRows3(1) as string - tableRows3(cOtherSetupDoc ) = "setup test" - tableRows3(cOtherWriteStatus ) = "write test result" + tableRows3(cTestClosureSetupDoc ) = "setup test" + tableRows3(cTestClosureWriteStatus ) = "write test result" aDoc = gOutputDoc @@ -380,24 +408,29 @@ Sub LogTestResult( sTestCaseDescription as String, bSuccess as Boolean ) If ( gCurrentTestCase = cLogfileFailed ) Then Dim sAnnotation as String sAnnotation = "creating logfile '" + GetLogFileName( gCurrentDocTest ) + "' failed" - LogState( FALSE, sAnnotation, MainFileChannel ) - SetStatus( 0, FALSE, sAnnotation ) + LogState( FALSE, sAnnotation, GlobalTestLog ) + RecordTestCaseStatus( 0, FALSE, sAnnotation ) Else - If ( LocalFileChannel <> 0 ) Then - LogState( bSuccess, sTestCaseDescription, LocalFileChannel ) + bSuccess = RecordTestCaseStatus( gCurrentTestCase, bSuccess, sTestCaseDescription ) + If ( LocalTestLog <> 0 ) Then + LogState( bSuccess, sTestCaseDescription, LocalTestLog ) EndIf - if ( MainFileChannel <> 0 ) Then - LogState( bSuccess, sTestCaseDescription, MainFileChannel ) + if ( GlobalTestLog <> 0 ) Then + LogState( bSuccess, sTestCaseDescription, GlobalTestLog ) EndIf - SetStatus( gCurrentTestCase, bSuccess, sTestCaseDescription ) End If End Sub -Sub SetStatus( nAction as Integer, bState as Boolean, sFailureAnnotation as String ) +Function RecordTestCaseStatus( nAction as Integer, bState as Boolean, sFailureAnnotation as String ) as Boolean Dim nStatusType as Integer Dim nState as integer nStatusType = GetStatusType( gCurrentDocTest ) - If nStatusType = cStNone then Exit Sub + If nStatusType = cStNone then Exit Function + + If ( gErrorState( nStatusType, nAction ) = cLogFalse ) Then + ' don't overwrite a previous "failed" state for this test + bState = FALSE + End If if bState then nState = cLogTrue @@ -405,17 +438,14 @@ Sub SetStatus( nAction as Integer, bState as Boolean, sFailureAnnotation as Stri nState = cLogFalse end If - If ( gErrorState( nStatusType, nAction ) = cLogFalse ) Then - ' don't overwrite a previous "failed" state for this this - nState = cLogFalse - End If - gErrorState (nStatusType, nAction) = nState If ( nState = cLogFalse ) And ( sFailureAnnotation <> "" ) Then gTestCaseAnnotations( nStatusType, nAction ) = gTestCaseAnnotations( nStatusType, nAction ) + sFailureAnnotation + chr(13) End If -end Sub + + RecordTestCaseStatus = bState +End Function Function GetStatusType (nDocType as Integer) as Integer Select Case ( nDocType ) @@ -435,7 +465,7 @@ Function GetStatusType (nDocType as Integer) as Integer GetStatusType = cStChart ' chart case frmJava GetStatusType = cStJava 'Java - case frmTestGlue + case frmTestClosure GetStatusType = cStTestGlue ' test framework case frmDataBase GetStatusType = cStDataBase 'DataBase diff --git a/smoketestdoc/data/Test_10er.xml b/smoketestdoc/data/Test_10er.xml index 68d69d46991d..b929caccb1b8 100755 --- a/smoketestdoc/data/Test_10er.xml +++ b/smoketestdoc/data/Test_10er.xml @@ -36,7 +36,7 @@ const sSDrawLogFileName = "sdrwlog.dat", sJavaLogFileName = "java const sSDBLogFileName = "dblog.dat", sExtLogFileName = "extlog.dat" const sTestGlueLogFileName = "testclosure.log" const sLogFileName = "smoketest.log" -const cTempFileName = "ttt" +const cTempFileName = "smoketest_file" const cMessageSaveOpen8Doc = "Save/Open open Documents (8.0)" const cMessageSaveOpenXMLDoc = "Save/Open Document XML (6/7)" @@ -45,8 +45,8 @@ const cMessageCloseDoc = "Close Document" Global sWorkPath$ Global sWorkPathURL$ -Global LocalFileChannel% -Global MainFileChannel% +Global LocalTestLog% +Global GlobalTestLog% Sub Main call TestAllDocs() @@ -141,15 +141,13 @@ Function OpenLogDat (sFileName as String) as Integer OpenLogDat = LocaleFileChannel% end Function -Function GetWorkPath as string - sTemp = "$(userpath)/temp/" - GetWorkPath = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp) -End Function +Sub SetupWorkPath + Dim configManager as Object + configManager = CreateUnoService( "com.sun.star.config.SpecialConfigManager" ) -Function GetWorkURL as string - sTemp = "$(userurl)/temp/" - GetWorkURL = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp) -End Function + sWorkPath = configManager.SubstituteVariables( "$(userpath)/temp/" ) + sWorkPathURL = configManager.SubstituteVariables( "$(userurl)/temp/" ) +End Sub Function GetSystem (sTmpWorkPath as string) as string GetSystem = "" @@ -178,13 +176,6 @@ Sub TestAllDocs() DIM sDocURL as String, sDocPath as String DIM nStrPos as Long - sWorkPath = GetWorkPath - sWorkPathURL = GetWorkURL - - if GetSystem (sWorkPath) = "windows" then - sWorkPath = ConvertPathToWin (sWorkPath) - end if - 'search ExtensionURL sDocURL = gOutputDoc.URL CompatibilityMode(true) @@ -192,9 +183,7 @@ DIM nStrPos as Long CompatibilityMode(false) sExtensionURL = Left (sDocURL, nStrPos) - call DeleteAllSavedFiles() - call DeleteAllLogFiles() - MainFileChannel = OpenLogDat (sLogFileName) + GlobalTestLog = OpenLogDat (sLogFileName) call WriteTestSequence if bMakeWriterTest then gCurrentDocTest = frmWriter @@ -237,47 +226,47 @@ DIM nStrPos as Long call Test_Ext.TestExtensions end if - Close #MainFileChannel - MainFileChannel = 0 + Close #GlobalTestLog + GlobalTestLog = 0 end Sub Sub WriteTestSequence - Print #MainFileChannel, "Sequence of testing" + Print #GlobalTestLog, "Sequence of testing" if bMakeWriterTest then - WriteTests ("writer : ", true, MainFileChannel) + WriteTests ("writer : ", true, GlobalTestLog) end if if bMakeCalcTest then - WriteTests ("calc : ", true, MainFileChannel) + WriteTests ("calc : ", true, GlobalTestLog) end if if bMakeImpressTest then - WriteTests ("impress : ", true, MainFileChannel) + WriteTests ("impress : ", true, GlobalTestLog) end if if bMakeDrawTest then - WriteTests ("draw : ", true, MainFileChannel) + WriteTests ("draw : ", true, GlobalTestLog) end if if bMakeHTMLTest then - WriteTests ("HTML : ", true, MainFileChannel) + WriteTests ("HTML : ", true, GlobalTestLog) end if if bMakeChartTest then - WriteTests ("chart : ", false, MainFileChannel) + WriteTests ("chart : ", false, GlobalTestLog) end if if bMakeMathTest then - WriteTests ("math : ", false, MainFileChannel) + WriteTests ("math : ", false, GlobalTestLog) end if if bMakeJavaTest then - WriteTests ("Java : ", false, MainFileChannel) + WriteTests ("Java : ", false, GlobalTestLog) end if if bMakeDBTest then - WriteDBTests ("Database : ", MainFileChannel) + WriteDBTests ("Database : ", GlobalTestLog) end if if bMakeExtensionTest then - WriteExtensionTests ("Extension : ", MainFileChannel) + WriteExtensionTests ("Extension : ", GlobalTestLog) end if - Print #MainFileChannel, "testclosure : setup, write_status" + Print #GlobalTestLog, "testclosure : setup, write_status" - Print #MainFileChannel + Print #GlobalTestLog end Sub Sub WriteTests (sText as string, bTestAll as boolean) @@ -302,7 +291,7 @@ Sub WriteTestSequence sWriteStr = sWriteStr + ", close" - Print #MainFileChannel, sWriteStr + Print #GlobalTestLog, sWriteStr end Sub Sub WriteDBTests (sText as string, nFileChannel as integer) @@ -336,7 +325,7 @@ Sub MakeDocTest On Local Error GoTo DOCTESTERROR gCurrentTestCase = cLogfileFailed - LocalFileChannel% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) gCurrentTestCase = cDocNew oDoc = LoadDoc ("private:factory/" + GetDocFilter(gCurrentDocTest or cFltNewDoc)) LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) @@ -381,19 +370,19 @@ Sub MakeDocTest end if end If - Print #LocalFileChannel, "---" - Close #LocalFileChannel% - LocalFileChannel = 0 + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub ' Without error DOCTESTERROR: If ( gCurrentTestCase = cLogfileFailed ) then - LogTestResult( "", False ) + LogTestResult( " ", False ) Exit Sub else LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(gCurrentTestCase), False ) - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 End If Exit Sub ' With error End Sub @@ -403,7 +392,7 @@ Sub MakeNewDoc Dim bSuccess as Boolean On Local Error GoTo DOCTESTERROR2 gCurrentTestCase = cLogfileFailed - LocalFileChannel% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) gCurrentTestCase = cDocNew ' oDoc = Documents.Add(GetDocFilter(gCurrentDocTest)) oDoc = LoadDoc ("private:factory/" + GetDocFilter(gCurrentDocTest or cFltNewDoc)) @@ -413,19 +402,19 @@ Sub MakeNewDoc bSuccess = CloseDoc( oDoc ) LogTestResult( GetDocFilter(gCurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) end If - Print #LocalFileChannel, "---" - Close #LocalFileChannel% - LocalFileChannel = 0 + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub ' Without error DOCTESTERROR2: If ( gCurrentTestCase = cLogfileFailed ) then - LogTestResult( "", False ) + LogTestResult( " ", False ) Exit Sub else LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(gCurrentTestCase), False ) - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 End If Exit Sub ' With error End Sub @@ -439,7 +428,7 @@ Sub MakeChartTest Dim bSuccess as Boolean On Local Error GoTo CHARTTESTERROR gCurrentTestCase = cLogfileFailed - LocalFileChannel% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) gCurrentTestCase = cDocNew oDoc = LoadDoc ("private:factory/" + GetDocFilter(frmCalc or cFltNewDoc)) if not IsNull (oDoc) then @@ -452,19 +441,19 @@ Sub MakeChartTest else LogTestResult( GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FALSE ) End if - Print #LocalFileChannel, "---" - Close #LocalFileChannel% - LocalFileChannel = 0 + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub ' Without error CHARTTESTERROR: If ( gCurrentTestCase = cLogfileFailed ) then - LogTestResult( "", False ) + LogTestResult( " ", False ) Exit Sub else LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(gCurrentTestCase), FALSE ) - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 End If Exit Sub ' With error End Sub @@ -566,7 +555,7 @@ Function GetLogFileName (DocType as Integer) as String GetLogFileName = sSChartLogFileName ' chart case frmJava GetLogFileName = sJavaLogFileName 'Java - case frmOther + case frmTestClosure GetLogFileName = sTestGlueLogFileName ' test framework case frmDataBase GetLogFileName = sSDBLogFileName 'Database @@ -602,14 +591,14 @@ End Function Function TestJava Dim oObj as Object gCurrentTestCase = cLogfileFailed - LocalFileChannel% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) gCurrentTestCase = cDocNew oObj = createUnoService( cUnoJavaLoader ) LogTestResult( "Java "+ cMessageNewDoc, not IsNull (oObj) ) - Print #LocalFileChannel, "---" - Close #LocalFileChannel% - LocalFileChannel = 0 + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 TestJava = not IsNull (oObj) End Function diff --git a/smoketestdoc/data/Test_DB.xml b/smoketestdoc/data/Test_DB.xml index a9f1fc2e316d..1f5667cae5a5 100755 --- a/smoketestdoc/data/Test_DB.xml +++ b/smoketestdoc/data/Test_DB.xml @@ -46,7 +46,7 @@ Sub TestDB On Local Error GoTo DBERROR gCurrentTestCase = cLogfileFailed - LocalFileChannel% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) gCurrentTestCase = cDBService sCurrentMessage = cMessageDatabaseService + " " + cUnoDatabaseContext @@ -63,8 +63,8 @@ Sub TestDB LogTestResult( "Database "+ cMessageDatabaseOpen, not IsNull (oDBConnection) ) if (IsNull(oDBConnection)) then - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub End If @@ -128,19 +128,19 @@ Sub TestDB oDBConnection.Dispose() LogTestResult( "Database "+ cMessageDatabaseClose, True ) - Print #LocalFileChannel, "---" - Close #LocalFileChannel% - LocalFileChannel = 0 + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub ' Without error DBERROR: If ( gCurrentTestCase = cLogfileFailed ) then - LogTestResult( "", False ) + LogTestResult( " ", False ) Exit Sub else LogTestResult( "Database "+ sCurrentMessage, FALSE ) - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 End If Exit Sub ' With error End Sub diff --git a/smoketestdoc/data/Test_Ext.xml b/smoketestdoc/data/Test_Ext.xml index 735aae537596..ac39f4816d7b 100755 --- a/smoketestdoc/data/Test_Ext.xml +++ b/smoketestdoc/data/Test_Ext.xml @@ -42,7 +42,7 @@ Sub TestExtensions On Local Error GoTo EXTERROR gCurrentTestCase = cLogfileFailed - LocalFileChannel% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) sCurrentMessage = cMessageExtensionService gCurrentTestCase = cEXTService @@ -59,8 +59,8 @@ Sub TestExtensions LogTestResult( "Extension "+ cMessageExtensionService, not IsNull (ext_mgr) ) if (IsNull(ext_mgr)) then - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub End If @@ -79,8 +79,8 @@ Sub TestExtensions bResult = (oTestExtension.getImplementationName = sImplementationNameString) LogTestResult( "Extension "+ cMessageExtensionInstall, bResult ) if (not bResult) then - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub End If @@ -96,19 +96,19 @@ Sub TestExtensions 'The service must not be available anymore. Therefor isNull must return true. LogTestResult( "Extension "+ cMessageExtensionUninstall, IsNull (oTestExtension) ) - Print #LocalFileChannel, "---" - Close #LocalFileChannel% - LocalFileChannel = 0 + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 Exit Sub ' Without error EXTERROR: If ( gCurrentTestCase = cLogfileFailed ) then - LogTestResult( "", False ) + LogTestResult( " ", False ) Exit Sub else LogTestResult( "Extension "+ sCurrentMessage, False ) - Close #LocalFileChannel% - LocalFileChannel = 0 + Close #LocalTestLog% + LocalTestLog = 0 End If Exit Sub ' With error |