summaryrefslogtreecommitdiff
path: root/smoketestoo_native
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-02-08 12:59:01 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-02-08 12:59:01 +0100
commit2b35c388bb80f1d7739afec38dbc842240babbdd (patch)
tree07d885875f467056306376c1fa690645dba9198d /smoketestoo_native
parent325b08b894be41b87f353010156ce38b9a1cfaee (diff)
debuglevels: make the current test case a global variable, so the AssertionHandler can use it
Diffstat (limited to 'smoketestoo_native')
-rw-r--r--smoketestoo_native/data/Global.xml12
-rw-r--r--smoketestoo_native/data/Test_10er.xml77
-rw-r--r--smoketestoo_native/data/Test_DB.xml47
-rw-r--r--smoketestoo_native/data/Test_Ext.xml31
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
&apos;UserFieldKennungen
@@ -127,8 +130,7 @@ Sub ClearAllText
end Sub
Sub AssertionHandler( sMessage as String )
- LogTestResult( cDocNew, &quot;assertion caught: &quot; + sMessage, FALSE )
- &apos;TODO: get the proper test case number
+ LogTestResult( &quot;assertion caught: &quot; + 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, &quot;creating logfile &apos;&quot; + GetLogFileName( g_CurrentDocTest ) + &quot;&apos; failed&quot;, 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 = &quot;Save/Open Document XML (6/7)&quot;
const cMessageNewDoc = &quot;New Document&quot;
const cMessageCloseDoc = &quot;Close Document&quot;
-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 (&quot;private:factory/&quot; + GetDocFilter(g_CurrentDocTest or cFltNewDoc))
- LogTestResult(cDocNew, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, not IsNull (oDoc) )
- if not IsNull (oDoc) then
- nCurrentAction = cDocSaveOpen8
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, not IsNull (oDoc) )
+ if not IsNull (oDoc) then
+ g_CurrentTestCase = cDocSaveOpen8
if bMakeSaveOpen8Test and IsFilterAvailable (g_CurrentDocTest or cFlt8) then
sFileName8 = sWorkPathURL+cTempFileName+&quot;.&quot;+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+&quot;.&quot;+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)+&quot; &quot;+ cMessageCloseDoc, bSuccess )
- nCurrentAction = cDocSaveOpen8
+ LogTestResult( GetDocFilter(g_CurrentDocTest)+&quot; &quot;+ cMessageCloseDoc, bSuccess )
+ g_CurrentTestCase = cDocSaveOpen8
if bMakeSaveOpen8Test and IsFilterAvailable (g_CurrentDocTest or cFlt8) then
oDoc = LoadDoc (sFileName8)
&apos; oDoc = Documents.open(sFileName)
- LogTestResult(cDocSaveOpen8, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageSaveOpen8Doc, not IsNull (oDoc) )
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ 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)
&apos; oDoc = Documents.open(sFileName)
- LogTestResult(cDocSaveOpenXML, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageSaveOpenXMLDoc, not IsNull (oDoc) )
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ 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 &apos; 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)+&quot; &quot;+ GetErrorMessage(nCurrentAction), False )
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ GetErrorMessage(g_CurrentTestCase), False )
Close #FileChannel%
End If
Exit Sub &apos; 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
&apos; oDoc = Documents.Add(GetDocFilter(g_CurrentDocTest))
oDoc = LoadDoc (&quot;private:factory/&quot; + GetDocFilter(g_CurrentDocTest or cFltNewDoc))
- LogTestResult(cDocNew, GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, not IsNull (oDoc) )
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, not IsNull (oDoc) )
if not IsNull (oDoc) then
- nCurrentAction = cDocClose
+ g_CurrentTestCase = cDocClose
bSuccess = CloseDoc( oDoc )
- LogTestResult(cDocClose, GetDocFilter(g_CurrentDocTest)+&quot; &quot;+ cMessageCloseDoc, bSuccess )
+ LogTestResult( GetDocFilter(g_CurrentDocTest)+&quot; &quot;+ cMessageCloseDoc, bSuccess )
end If
Print #FileChannel, &quot;---&quot;
Close #FileChannel%
Exit Sub &apos; 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)+&quot; &quot;+ GetErrorMessage(nCurrentAction), False )
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ GetErrorMessage(g_CurrentTestCase), False )
Close #FileChannel%
End If
Exit Sub &apos; With error
@@ -430,32 +426,31 @@ Sub MakeChartTest
Dim oRect as New com.sun.star.awt.Rectangle
const cChartName=&quot;TestChart&quot;
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 (&quot;private:factory/&quot; + 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)+&quot; &quot;+ cMessageNewDoc, bSuccess )
- nCurrentAction = cDocClose
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, bSuccess )
+ g_CurrentTestCase = cDocClose
oDoc.close (true)
else
- LogTestResult( cDocNew, GetDocFilter(frmCalc or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, FALSE )
+ LogTestResult( GetDocFilter(frmCalc or cFltNewDoc)+&quot; &quot;+ cMessageNewDoc, FALSE )
End if
Print #FileChannel, &quot;---&quot;
Close #FileChannel%
Exit Sub &apos; 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)+&quot; &quot;+ GetErrorMessage(nCurrentAction), FALSE )
+ LogTestResult( GetDocFilter(g_CurrentDocTest or cFltNewDoc)+&quot; &quot;+ GetErrorMessage(g_CurrentTestCase), FALSE )
Close #FileChannel%
End If
Exit Sub &apos; 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, &quot;Java &quot;+ cMessageNewDoc, not IsNull (oObj) )
+ g_CurrentTestCase = cDocNew
+ oObj = createUnoService( cUnoJavaLoader )
+ LogTestResult( &quot;Java &quot;+ cMessageNewDoc, not IsNull (oObj) )
Print #FileChannel, &quot;---&quot;
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 = &quot;Close Database&quot;
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 = &quot;Automatical Test&quot;
-
+ 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 = &quot;Automatical Test&quot;
On Local Error GoTo DBERROR
- nCurrentAction = cLogfileFailed
+ g_CurrentTestCase = cLogfileFailed
FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest))
- nCurrentAction = cDBService
+ g_CurrentTestCase = cDBService
sCurrentMessage = cMessageDatabaseService + &quot; &quot; + cUnoDatabaseContext
oDBContext = CreateUnoService(cUnoDatabaseContext)
sDBName=oDBContext.ElementNames(0) &apos;Names of Databases
- nCurrentAction = cDBOpen
+ g_CurrentTestCase = cDBOpen
sCurrentMessage = cMessageDatabaseOpen
oDataSource = oDBContext.GetByName(sDBName)
sTable=oDataSource.Tables.ElementNames(0)
oDBConnection = oDBContext.GetByName(sDBName).GetConnection(&quot;&quot;,&quot;&quot;)
- LogTestResult( cDBOpen, &quot;Database &quot;+ cMessageDatabaseOpen, not IsNull (oDBConnection) )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseOpen, not IsNull (oDBConnection) )
if (IsNull(oDBConnection)) then
Close #FileChannel%
Exit Sub
@@ -70,18 +69,18 @@ Const sTestString = &quot;Automatical Test&quot;
&apos; Database is open now
- nCurrentAction = cDBService
+ g_CurrentTestCase = cDBService
sCurrentMessage = cMessageDatabaseService + &quot; &quot; + cUnoRowSet
oRowSet = createUnoService(cUnoRowSet)
if (IsNull(oRowSet)) then
- LogTestResult( cDBService, &quot;Database &quot;+ cMessageDatabaseService + &quot; &quot; + cUnoRowSet, not IsNull (oRowSet) )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseService + &quot; &quot; + cUnoRowSet, not IsNull (oRowSet) )
Exit Sub
else
- LogTestResult( cDBService, &quot;Database &quot;+ cMessageDatabaseService, TRUE )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseService, TRUE )
End If
- nCurrentAction = cDBInsert
+ g_CurrentTestCase = cDBInsert
sCurrentMessage = cMessageDatabaseInsert
oRowSet.ActiveConnection = oDBConnection
@@ -99,12 +98,12 @@ Const sTestString = &quot;Automatical Test&quot;
oRowSet.moveToCurrentRow()
bResult = (oRowSet.getString(5) = sTestString)
- LogTestResult( cDBInsert, &quot;Database &quot;+ cMessageDatabaseInsert, bResult )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseInsert, bResult )
&apos;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 = &quot;Automatical Test&quot;
oRowSet.next()
bResult = (nRowCount - oRowSet.RowCount = 1)
End If
- LogTestResult( cDBDelete, &quot;Database &quot;+ cMessageDatabaseDelete, bResult )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseDelete, bResult )
End If
&apos; read other record
- nCurrentAction = cDBSeek
+ g_CurrentTestCase = cDBSeek
sCurrentMessage = cMessageDatabaseSeek
oRowSet.first()
bResult = not (oRowSet.getString(5) = sTestString)
- LogTestResult( cDBSeek, &quot;Database &quot;+ cMessageDatabaseSeek, bResult )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseSeek, bResult )
- nCurrentAction = cDBClose
+ g_CurrentTestCase = cDBClose
sCurrentMessage = cMessageDatabaseClose
oDBConnection.Dispose()
- LogTestResult( cDBClose, &quot;Database &quot;+ cMessageDatabaseClose, True )
+ LogTestResult( &quot;Database &quot;+ cMessageDatabaseClose, True )
Print #FileChannel, &quot;---&quot;
Close #FileChannel%
Exit Sub &apos; Without error
DBERROR:
- If (nCurrentAction = cLogfileFailed) then
- LogTestResult( cLogfileFailed, "", False )
+ If ( g_CurrentTestCase = cLogfileFailed ) then
+ LogTestResult( "", False )
Exit Sub
else
- LogTestResult( nCurrentAction, &quot;Database &quot;+ sCurrentMessage, FALSE )
+ LogTestResult( &quot;Database &quot;+ sCurrentMessage, FALSE )
Close #FileChannel%
End If
Exit Sub &apos; 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 = &quot;Install Extension&quot;
const cMessageExtensionUninstall = &quot;Uninstall Extension&quot;
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 + &quot;$_TestExtension&quot;
+ Dim oTestExtension as Object, obj_null as Object
+ Dim sCurrentMessage as String
+ Dim bResult as Boolean
+ Dim sImplementationNameString as String
+ sImplementationNameString = cUnoSmoketestTestExtension + &quot;$_TestExtension&quot;
On Local Error GoTo EXTERROR
- nCurrentAction = cLogfileFailed
+ g_CurrentTestCase = cLogfileFailed
FileChannel% = OpenLogDat (GetLogFileName(g_CurrentDocTest))
sCurrentMessage = cMessageExtensionService
- nCurrentAction = cEXTService
+ g_CurrentTestCase = cEXTService
&apos;Create an implementation of com.sun.star.ucb.XCommandEnvironment which is needed for
&apos;adding the extension. The implementation is in
@@ -58,14 +57,14 @@ sImplementationNameString = cUnoSmoketestTestExtension + &quot;$_TestExtension&q
ctx = getDefaultContext
ext_mgr = ctx.getValueByName(&quot;/singletons/&quot; + cExtensionManager)
- LogTestResult( cEXTService, &quot;Extension &quot;+ cMessageExtensionService, not IsNull (ext_mgr) )
+ LogTestResult( &quot;Extension &quot;+ cMessageExtensionService, not IsNull (ext_mgr) )
if (IsNull(ext_mgr)) then
Close #FileChannel%
Exit Sub
End If
sCurrentMessage = cMessageExtensionInstall
- nCurrentAction = cEXTInstall
+ g_CurrentTestCase = cEXTInstall
&apos;Add the extension. We must provide a file URL here.
&apos;By passing &quot;user&quot; we determine that the actions we perform on
@@ -77,14 +76,14 @@ sImplementationNameString = cUnoSmoketestTestExtension + &quot;$_TestExtension&q
&apos;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, &quot;Extension &quot;+ cMessageExtensionInstall, bResult )
+ LogTestResult( &quot;Extension &quot;+ cMessageExtensionInstall, bResult )
if (not bResult) then
Close #FileChannel%
Exit Sub
End If
sCurrentMessage = cMessageExtensionUninstall
- nCurrentAction = cEXTUninstall
+ g_CurrentTestCase = cEXTUninstall
&apos;Remove the package
ext_mgr.removeExtension(&quot;org.openoffice.legacy.&quot; + cExtensionFileName, cExtensionFileName, &quot;user&quot;,obj_null, cmdEnv)
@@ -93,18 +92,18 @@ sImplementationNameString = cUnoSmoketestTestExtension + &quot;$_TestExtension&q
oTestExtension = createUnoService(cUnoSmoketestTestExtension)
&apos;The service must not be available anymore. Therefor isNull must return true.
- LogTestResult( cEXTUninstall, &quot;Extension &quot;+ cMessageExtensionUninstall, IsNull (oTestExtension) )
+ LogTestResult( &quot;Extension &quot;+ cMessageExtensionUninstall, IsNull (oTestExtension) )
Print #FileChannel, &quot;---&quot;
Close #FileChannel%
Exit Sub &apos; Without error
EXTERROR:
- If (nCurrentAction = cLogfileFailed) then
- LogTestResult( cLogfileFailed, "", False )
+ If ( g_CurrentTestCase = cLogfileFailed ) then
+ LogTestResult( "", False )
Exit Sub
else
- LogTestResult( nCurrentAction, &quot;Extension &quot;+ sCurrentMessage, False )
+ LogTestResult( &quot;Extension &quot;+ sCurrentMessage, False )
Close #FileChannel%
End If
Exit Sub &apos; With error