diff options
-rw-r--r-- | smoketestoo_native/data/Global.xml | 12 | ||||
-rw-r--r-- | smoketestoo_native/data/Test_10er.xml | 77 | ||||
-rw-r--r-- | smoketestoo_native/data/Test_DB.xml | 47 | ||||
-rw-r--r-- | smoketestoo_native/data/Test_Ext.xml | 31 |
4 files changed, 82 insertions, 85 deletions
diff --git a/smoketestoo_native/data/Global.xml b/smoketestoo_native/data/Global.xml index 3569343530ba..5da3617fad9b 100644 --- a/smoketestoo_native/data/Global.xml +++ b/smoketestoo_native/data/Global.xml @@ -53,6 +53,9 @@ global const frmMath = 5, frmChart = 7, frmHyperText = 8, frmDraw = 9 global const frmDataBase = 10, frmJava = 13 global const frmExtension = 14 +Global g_CurrentDocTest As Integer +Global g_CurrentTestCase As Integer + global const cLogUnknown = 0, cLogFalse = 1, cLogTrue = 2 'UserFieldKennungen @@ -127,8 +130,7 @@ Sub ClearAllText end Sub Sub AssertionHandler( sMessage as String ) - LogTestResult( cDocNew, "assertion caught: " + sMessage, FALSE ) - 'TODO: get the proper test case number + LogTestResult( "assertion caught: " + sMessage, FALSE ) End Sub Sub Main @@ -371,14 +373,14 @@ Function GetRangeName (nColumn as integer, nRow as integer) as string GetRangeName = chr (nColumn+66) + Trim(Str(nRow+1)) end Function -Sub LogTestResult( nTestCase as Integer, sTestCaseDescription as String, bSuccess as Boolean ) - If ( nTestCase = cLogfileFailed ) Then +Sub LogTestResult( sTestCaseDescription as String, bSuccess as Boolean ) + If ( g_CurrentTestCase = cLogfileFailed ) Then LogState( FALSE, "creating logfile '" + GetLogFileName( g_CurrentDocTest ) + "' failed", MainFileChannel ) SetStatus( 0, FALSE ) Else LogState( bSuccess, sTestCaseDescription, FileChannel ) LogState( bSuccess, sTestCaseDescription, MainFileChannel ) - SetStatus( nTestCase, bSuccess ) + SetStatus( g_CurrentTestCase, bSuccess ) End If End Sub diff --git a/smoketestoo_native/data/Test_10er.xml b/smoketestoo_native/data/Test_10er.xml index b586d9ba4bd1..84a8321deced 100644 --- a/smoketestoo_native/data/Test_10er.xml +++ b/smoketestoo_native/data/Test_10er.xml @@ -42,8 +42,6 @@ const cMessageSaveOpenXMLDoc = "Save/Open Document XML (6/7)" const cMessageNewDoc = "New Document" const cMessageCloseDoc = "Close Document" -Global g_CurrentDocTest As Integer - Global sWorkPath$ Global sWorkPathURL$ Global FileChannel% @@ -328,50 +326,49 @@ Sub MakeDocTest Dim oDoc as Object Dim sFileNameXML$, sFileName8$ Dim bSuccess as Boolean - Dim nCurrentAction as Integer On Local Error GoTo DOCTESTERROR - nCurrentAction = cLogfileFailed + g_CurrentTestCase = cLogfileFailed FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest)) - nCurrentAction = cDocNew + g_CurrentTestCase = cDocNew oDoc = LoadDoc ("private:factory/" + GetDocFilter(g_CurrentDocTest or cFltNewDoc)) - LogTestResult(cDocNew, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) - if not IsNull (oDoc) then - nCurrentAction = cDocSaveOpen8 + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) + if not IsNull (oDoc) then + g_CurrentTestCase = cDocSaveOpen8 if bMakeSaveOpen8Test and IsFilterAvailable (g_CurrentDocTest or cFlt8) then sFileName8 = sWorkPathURL+cTempFileName+"."+GetDocEndings(g_CurrentDocTest or cFlt8) SaveDoc (sFileName8, oDoc, GetDocFilter(g_CurrentDocTest or cFlt8)) end if - nCurrentAction = cDocSaveOpenXML + g_CurrentTestCase = cDocSaveOpenXML if bMakeSaveOpenXMLTest and IsFilterAvailable (g_CurrentDocTest or cFltXML) then sFileNameXML = sWorkPathURL+cTempFileName+"."+GetDocEndings(g_CurrentDocTest or cFltXML) SaveDoc (sFileNameXML, oDoc, GetDocFilter(g_CurrentDocTest or cFltXML)) end if - nCurrentAction = cDocClose + g_CurrentTestCase = cDocClose bSuccess = CloseDoc( oDoc ) - LogTestResult( cDocClose, GetDocFilter(g_CurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) - nCurrentAction = cDocSaveOpen8 + LogTestResult( GetDocFilter(g_CurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) + g_CurrentTestCase = cDocSaveOpen8 if bMakeSaveOpen8Test and IsFilterAvailable (g_CurrentDocTest or cFlt8) then oDoc = LoadDoc (sFileName8) ' oDoc = Documents.open(sFileName) - LogTestResult(cDocSaveOpen8, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, not IsNull (oDoc) ) + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, not IsNull (oDoc) ) if not IsNull (oDoc) then - nCurrentAction = cDocClose + g_CurrentTestCase = cDocClose oDoc.close (true) end If end if - nCurrentAction = cDocSaveOpenXML + g_CurrentTestCase = cDocSaveOpenXML if bMakeSaveOpenXMLTest and IsFilterAvailable (g_CurrentDocTest or cFltXML) then oDoc = LoadDoc (sFileNameXML) ' oDoc = Documents.open(sFileName) - LogTestResult(cDocSaveOpenXML, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, not IsNull (oDoc) ) + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, not IsNull (oDoc) ) if not IsNull (oDoc) then - nCurrentAction = cDocClose + g_CurrentTestCase = cDocClose oDoc.close (true) end If end if @@ -382,11 +379,11 @@ Sub MakeDocTest Exit Sub ' Without error DOCTESTERROR: - If (nCurrentAction = cLogfileFailed) then - LogTestResult( cLogfileFailed, "", False ) + If ( g_CurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) Exit Sub else - LogTestResult(nCurrentAction, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), False ) + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(g_CurrentTestCase), False ) Close #FileChannel% End If Exit Sub ' With error @@ -395,29 +392,28 @@ End Sub Sub MakeNewDoc DIM oDoc as Object Dim bSuccess as Boolean - Dim nCurrentAction as Integer On Local Error GoTo DOCTESTERROR2 - nCurrentAction = cLogfileFailed + g_CurrentTestCase = cLogfileFailed FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest)) - nCurrentAction = cDocNew + g_CurrentTestCase = cDocNew ' oDoc = Documents.Add(GetDocFilter(g_CurrentDocTest)) oDoc = LoadDoc ("private:factory/" + GetDocFilter(g_CurrentDocTest or cFltNewDoc)) - LogTestResult(cDocNew, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) if not IsNull (oDoc) then - nCurrentAction = cDocClose + g_CurrentTestCase = cDocClose bSuccess = CloseDoc( oDoc ) - LogTestResult(cDocClose, GetDocFilter(g_CurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) + LogTestResult( GetDocFilter(g_CurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) end If Print #FileChannel, "---" Close #FileChannel% Exit Sub ' Without error DOCTESTERROR2: - If (nCurrentAction = cLogfileFailed) then - LogTestResult( cLogfileFailed, "", False ) + If ( g_CurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) Exit Sub else - LogTestResult( nCurrentAction, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), False ) + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(g_CurrentTestCase), False ) Close #FileChannel% End If Exit Sub ' With error @@ -430,32 +426,31 @@ Sub MakeChartTest Dim oRect as New com.sun.star.awt.Rectangle const cChartName="TestChart" Dim bSuccess as Boolean - Dim nCurrentAction as Integer On Local Error GoTo CHARTTESTERROR - nCurrentAction = cLogfileFailed + g_CurrentTestCase = cLogfileFailed FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest)) - nCurrentAction = cDocNew + g_CurrentTestCase = cDocNew oDoc = LoadDoc ("private:factory/" + GetDocFilter(frmCalc or cFltNewDoc)) if not IsNull (oDoc) then oCharts = oDoc.sheets(0).Charts oCharts.AddNewByName (cChartName, oRect, oRange(), true, true) bSuccess=oCharts.HasByName(cChartName) - LogTestResult( cDocNew, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, bSuccess ) - nCurrentAction = cDocClose + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, bSuccess ) + g_CurrentTestCase = cDocClose oDoc.close (true) else - LogTestResult( cDocNew, GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FALSE ) + LogTestResult( GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FALSE ) End if Print #FileChannel, "---" Close #FileChannel% Exit Sub ' Without error CHARTTESTERROR: - If (nCurrentAction = cLogfileFailed) then - LogTestResult( cLogfileFailed, "", False ) + If ( g_CurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) Exit Sub else - LogTestResult( nCurrentAction, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FALSE ) + LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(g_CurrentTestCase), FALSE ) Close #FileChannel% End If Exit Sub ' With error @@ -591,9 +586,11 @@ End Function Function TestJava Dim oObj as Object + g_CurrentTestCase = cLogfileFailed FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest)) - oObj = createUnoService(cUnoJavaLoader) - LogTestResult( cDocNew, "Java "+ cMessageNewDoc, not IsNull (oObj) ) + g_CurrentTestCase = cDocNew + oObj = createUnoService( cUnoJavaLoader ) + LogTestResult( "Java "+ cMessageNewDoc, not IsNull (oObj) ) Print #FileChannel, "---" Close #FileChannel% diff --git a/smoketestoo_native/data/Test_DB.xml b/smoketestoo_native/data/Test_DB.xml index 56e55e846c3a..512a1abb1214 100644 --- a/smoketestoo_native/data/Test_DB.xml +++ b/smoketestoo_native/data/Test_DB.xml @@ -37,32 +37,31 @@ const cMessageDatabaseClose = "Close Database" Sub TestDB -Dim oDBConnection as Object, oDataSource as Object, oDBContext as Object -Dim sDBName as String, sTable as String, sCurrentMessage as String -Dim nRowCount as Integer, nCurrentAction as Integer -Dim bResult as Boolean -Const sTestString = "Automatical Test" - + Dim oDBConnection as Object, oDataSource as Object, oDBContext as Object + Dim sDBName as String, sTable as String, sCurrentMessage as String + Dim nRowCount as Integer + Dim bResult as Boolean + Const sTestString = "Automatical Test" On Local Error GoTo DBERROR - nCurrentAction = cLogfileFailed + g_CurrentTestCase = cLogfileFailed FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest)) - nCurrentAction = cDBService + g_CurrentTestCase = cDBService sCurrentMessage = cMessageDatabaseService + " " + cUnoDatabaseContext oDBContext = CreateUnoService(cUnoDatabaseContext) sDBName=oDBContext.ElementNames(0) 'Names of Databases - nCurrentAction = cDBOpen + g_CurrentTestCase = cDBOpen sCurrentMessage = cMessageDatabaseOpen oDataSource = oDBContext.GetByName(sDBName) sTable=oDataSource.Tables.ElementNames(0) oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") - LogTestResult( cDBOpen, "Database "+ cMessageDatabaseOpen, not IsNull (oDBConnection) ) + LogTestResult( "Database "+ cMessageDatabaseOpen, not IsNull (oDBConnection) ) if (IsNull(oDBConnection)) then Close #FileChannel% Exit Sub @@ -70,18 +69,18 @@ Const sTestString = "Automatical Test" ' Database is open now - nCurrentAction = cDBService + g_CurrentTestCase = cDBService sCurrentMessage = cMessageDatabaseService + " " + cUnoRowSet oRowSet = createUnoService(cUnoRowSet) if (IsNull(oRowSet)) then - LogTestResult( cDBService, "Database "+ cMessageDatabaseService + " " + cUnoRowSet, not IsNull (oRowSet) ) + LogTestResult( "Database "+ cMessageDatabaseService + " " + cUnoRowSet, not IsNull (oRowSet) ) Exit Sub else - LogTestResult( cDBService, "Database "+ cMessageDatabaseService, TRUE ) + LogTestResult( "Database "+ cMessageDatabaseService, TRUE ) End If - nCurrentAction = cDBInsert + g_CurrentTestCase = cDBInsert sCurrentMessage = cMessageDatabaseInsert oRowSet.ActiveConnection = oDBConnection @@ -99,12 +98,12 @@ Const sTestString = "Automatical Test" oRowSet.moveToCurrentRow() bResult = (oRowSet.getString(5) = sTestString) - LogTestResult( cDBInsert, "Database "+ cMessageDatabaseInsert, bResult ) + LogTestResult( "Database "+ cMessageDatabaseInsert, bResult ) 'delete only if insert passed if (bResult) Then - nCurrentAction = cDBDelete + g_CurrentTestCase = cDBDelete sCurrentMessage = cMessageDatabaseDelete oRowSet.deleteRow() bResult = (nRowCount - oRowSet.RowCount = 0) @@ -112,32 +111,32 @@ Const sTestString = "Automatical Test" oRowSet.next() bResult = (nRowCount - oRowSet.RowCount = 1) End If - LogTestResult( cDBDelete, "Database "+ cMessageDatabaseDelete, bResult ) + LogTestResult( "Database "+ cMessageDatabaseDelete, bResult ) End If ' read other record - nCurrentAction = cDBSeek + g_CurrentTestCase = cDBSeek sCurrentMessage = cMessageDatabaseSeek oRowSet.first() bResult = not (oRowSet.getString(5) = sTestString) - LogTestResult( cDBSeek, "Database "+ cMessageDatabaseSeek, bResult ) + LogTestResult( "Database "+ cMessageDatabaseSeek, bResult ) - nCurrentAction = cDBClose + g_CurrentTestCase = cDBClose sCurrentMessage = cMessageDatabaseClose oDBConnection.Dispose() - LogTestResult( cDBClose, "Database "+ cMessageDatabaseClose, True ) + LogTestResult( "Database "+ cMessageDatabaseClose, True ) Print #FileChannel, "---" Close #FileChannel% Exit Sub ' Without error DBERROR: - If (nCurrentAction = cLogfileFailed) then - LogTestResult( cLogfileFailed, "", False ) + If ( g_CurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) Exit Sub else - LogTestResult( nCurrentAction, "Database "+ sCurrentMessage, FALSE ) + LogTestResult( "Database "+ sCurrentMessage, FALSE ) Close #FileChannel% End If Exit Sub ' With error diff --git a/smoketestoo_native/data/Test_Ext.xml b/smoketestoo_native/data/Test_Ext.xml index 534917f02eac..9d3931643658 100644 --- a/smoketestoo_native/data/Test_Ext.xml +++ b/smoketestoo_native/data/Test_Ext.xml @@ -33,20 +33,19 @@ const cMessageExtensionInstall = "Install Extension" const cMessageExtensionUninstall = "Uninstall Extension" Sub TestExtensions -Dim oTestExtension as Object, obj_null as Object -Dim sCurrentMessage as String -Dim nCurrentAction as Integer -Dim bResult as Boolean -Dim sImplementationNameString as String -sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" + Dim oTestExtension as Object, obj_null as Object + Dim sCurrentMessage as String + Dim bResult as Boolean + Dim sImplementationNameString as String + sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" On Local Error GoTo EXTERROR - nCurrentAction = cLogfileFailed + g_CurrentTestCase = cLogfileFailed FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest)) sCurrentMessage = cMessageExtensionService - nCurrentAction = cEXTService + g_CurrentTestCase = cEXTService 'Create an implementation of com.sun.star.ucb.XCommandEnvironment which is needed for 'adding the extension. The implementation is in @@ -58,14 +57,14 @@ sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension&q ctx = getDefaultContext ext_mgr = ctx.getValueByName("/singletons/" + cExtensionManager) - LogTestResult( cEXTService, "Extension "+ cMessageExtensionService, not IsNull (ext_mgr) ) + LogTestResult( "Extension "+ cMessageExtensionService, not IsNull (ext_mgr) ) if (IsNull(ext_mgr)) then Close #FileChannel% Exit Sub End If sCurrentMessage = cMessageExtensionInstall - nCurrentAction = cEXTInstall + g_CurrentTestCase = cEXTInstall 'Add the extension. We must provide a file URL here. 'By passing "user" we determine that the actions we perform on @@ -77,14 +76,14 @@ sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension&q 'Check if the extension has been added by creating a service which is contained in the extension. oTestExtension = createUnoService(cUnoSmoketestTestExtension) bResult = (oTestExtension.getImplementationName = sImplementationNameString) - LogTestResult( cEXTInstall, "Extension "+ cMessageExtensionInstall, bResult ) + LogTestResult( "Extension "+ cMessageExtensionInstall, bResult ) if (not bResult) then Close #FileChannel% Exit Sub End If sCurrentMessage = cMessageExtensionUninstall - nCurrentAction = cEXTUninstall + g_CurrentTestCase = cEXTUninstall 'Remove the package ext_mgr.removeExtension("org.openoffice.legacy." + cExtensionFileName, cExtensionFileName, "user",obj_null, cmdEnv) @@ -93,18 +92,18 @@ sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension&q oTestExtension = createUnoService(cUnoSmoketestTestExtension) 'The service must not be available anymore. Therefor isNull must return true. - LogTestResult( cEXTUninstall, "Extension "+ cMessageExtensionUninstall, IsNull (oTestExtension) ) + LogTestResult( "Extension "+ cMessageExtensionUninstall, IsNull (oTestExtension) ) Print #FileChannel, "---" Close #FileChannel% Exit Sub ' Without error EXTERROR: - If (nCurrentAction = cLogfileFailed) then - LogTestResult( cLogfileFailed, "", False ) + If ( g_CurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) Exit Sub else - LogTestResult( nCurrentAction, "Extension "+ sCurrentMessage, False ) + LogTestResult( "Extension "+ sCurrentMessage, False ) Close #FileChannel% End If Exit Sub ' With error |