summaryrefslogtreecommitdiff
path: root/testautomation
diff options
context:
space:
mode:
authorJoerg Skottke [jsk] <jsk@openoffice.org>2010-07-19 14:27:24 +0200
committerJoerg Skottke [jsk] <jsk@openoffice.org>2010-07-19 14:27:24 +0200
commit5460371328f57e2462df37730cf04b1de1039ae4 (patch)
treee18a21f3d25c89986c8b6aff2e7f736c1bbfc78a /testautomation
parentcdaa85c5b73429a75c91c44b7e0a0bff061999f6 (diff)
jl154: #i113234 - Reworked tests that chaeck presence of scripts, implemanted compare functionality to ease finding lost scripts
Diffstat (limited to 'testautomation')
-rwxr-xr-xtestautomation/framework/required/f_programmability_dialogs.bas4
-rwxr-xr-xtestautomation/framework/required/includes/script_organizers.inc137
-rwxr-xr-xtestautomation/framework/required/includes/scripting_basics.inc74
-rwxr-xr-x[-rw-r--r--]testautomation/framework/required/includes/wizard_documentconverter.inc2
-rwxr-xr-xtestautomation/framework/tools/includes/wizards.inc143
-rw-r--r--testautomation/global/sid/e_all.sid2
-rwxr-xr-xtestautomation/global/tools/includes/optional/t_treelist_tools.inc9
7 files changed, 128 insertions, 243 deletions
diff --git a/testautomation/framework/required/f_programmability_dialogs.bas b/testautomation/framework/required/f_programmability_dialogs.bas
index 537a4693770f..41e682225f60 100755
--- a/testautomation/framework/required/f_programmability_dialogs.bas
+++ b/testautomation/framework/required/f_programmability_dialogs.bas
@@ -38,7 +38,6 @@ sub main
use "framework\required\includes\basic_organizer.inc"
use "framework\required\includes\basic_dialog_export.inc"
use "framework\required\includes\basic_dialog_i18n_import.inc"
- use "framework\required\includes\scripting_basics.inc"
use "framework\required\includes\script_organizers.inc"
call hStatusIn( "framework" , "f_programmability_dialogs.bas" )
@@ -47,8 +46,7 @@ sub main
call tUpdtBasicOrganizer()
call tUpdtDialogExport()
call tBasicDialogI18nImport()
- call tScripting() ' script organizer nodes if no documents are open
- call tUpdtScriptCount() ' script organizer nodes with one open document
+ call tUpdtScripts() ' script organizer nodes with one open document
call hStatusOut()
end sub
diff --git a/testautomation/framework/required/includes/script_organizers.inc b/testautomation/framework/required/includes/script_organizers.inc
index 6082a3313ce0..0725841b66ec 100755
--- a/testautomation/framework/required/includes/script_organizers.inc
+++ b/testautomation/framework/required/includes/script_organizers.inc
@@ -31,80 +31,99 @@
'*
'\******************************************************************************
-testcase tUpdtScriptCount
- dim sDialog as string
+testcase tUpdtScripts
printlog( "Resource test for macros and scripts / related dialogs" )
const SCRIPTING_DIALOGS = 5
-
- dim aScriptCount( SCRIPTING_DIALOGS )
- aScriptCount( 1 ) = 10 ' JavaScript
- aScriptCount( 2 ) = 14 ' BeanShell
-
- if ( lcase( gPlatform ) = "osx" ) then
- aScriptCount( 3 ) = 8 ' Python
- aScriptCount( 5 ) = 600 ' Run Macro
- else
- aScriptCount( 3 ) = 10 ' Python
- aScriptCount( 5 ) = 602 ' Run Macro
- endif
-
- if ( gOOo ) then
- aScriptCount( 4 ) = 585 ' Makro Organizer
- aScriptCount( 5 ) = aScriptCount( 5 ) - 1 ' Run Macro
- else
- ' Makro Organizer
- aScriptCount( 4 ) = 586
- endif
+ const DLG_JAVASCRIPT = "JavaScript"
+ const DLG_BEANSHELL = "BeanShell"
+ const DLG_PYTHON = "Python"
+ const DLG_BASIC_ORG = "BasicOrganizer"
+ const DLG_RUN_MACRO = "RunMacro"
+
+ ' This is the build specific part of the filename including substrings for
+ ' the productname, platform, and language. At a later point we add the dialog name.
+ ' Replace all blanks (spaces) with "-"
+ dim sDynamicPath as string
+ sDynamicPath = gProductName & "_" & gPlatform & "_" & gISOLang & "_"
+ hStringReplaceChar( sDynamicPath, " ", "-" )
+
+ ' This is where reference file is located, the filename is yet incomplete
+ dim sInputPath as string
+ sInputPath = gTesttoolPath & "/framework/required/input/scripts/" & sDynamicPath
+
+ ' This is where we store the reference file if differences are found.
+ dim sOutputPath as string
+ sOutputPath = gOfficePath & "/user/work/" & sDynamicPath
+
+ ' These contain the input and output paths (fully qualified)
+ dim sFileIn as string
+ dim sFileOut as string
+ ' Array that contains the scriptnames for all organizers
+ dim cScriptNamesList( 1000 ) as string
+
+ ' Holds the object of the treelist. Used to reduce the amount of code.
+ dim oTreeList as object
+
+ dim sDialog as string
dim iCurrentDialog as integer
- dim iCurrentScriptCount as integer
-
+
hInitSingleDoc()
for iCurrentDialog = 1 to SCRIPTING_DIALOGS
- printlog( "" )
- select case iCurrentDialog
- case 1: sDialog = "JavaScript"
- ToolsMacrosOrganizeMacrosJavaScript
- kontext "ScriptOrganizer"
- iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
- ScriptOrganizer.cancel()
- case 2: sDialog = "BeanShell"
- ToolsMacrosOrganizeMacrosBeanShell
- kontext "ScriptOrganizer"
- iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
- ScriptOrganizer.cancel()
- case 3: sDialog = "Python"
- ToolsMacrosOrganizeMacrosPython
- kontext "ScriptOrganizer"
- iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
- ScriptOrganizer.cancel()
- case 4: sDialog = "Makro Organizer"
- ToolsMacro_uno
- Kontext "Makro"
- hExpandAllNodes( MakroAus )
- iCurrentScriptCount = hGetScriptCount( MakroAus, MakroListe )
- Makro.close()
- case 5: sDialog = "Run Macro"
- ToolsMacrosRunMacro
- kontext "ScriptSelector"
- hExpandAllNodes( LibraryTreeList )
- iCurrentScriptCount = hGetScriptCount( LibraryTreeList, ScriptList )
- ScriptSelector.cancel()
+ ' Build complete filename and identify dialog for logging and case selection
+ select case ( iCurrentDialog )
+ case 1 : sDialog = DLG_JAVASCRIPT
+ case 2 : sDialog = DLG_BEANSHELL
+ case 3 : sDialog = DLG_PYTHON
+ case 4 : sDialog = DLG_BASIC_ORG
+ case 5 : sDialog = DLG_RUN_MACRO
end select
- printlog( sDialog )
+ sFileIn = convertpath( sInputPath & sDialog & ".txt" )
+ sFileOut = convertpath( sOutputPath & sDialog & ".txt" )
+ printlog( "File in.: " & sFileIn )
+ printlog( "File out: " & sFileOut )
+
+ printlog( "Open <" & sDialog & "> and access the treelist object" )
+
+ select case ( sDialog )
+ case DLG_JAVASCRIPT: ToolsMacrosOrganizeMacrosJavaScript
+ kontext "ScriptOrganizer"
+ oTreeList = Scriptlist
+ case DLG_BEANSHELL: ToolsMacrosOrganizeMacrosBeanShell
+ kontext "ScriptOrganizer"
+ oTreeList = ScriptTreeList
+ case DLG_PYTHON: ToolsMacrosOrganizeMacrosPython
+ kontext "ScriptOrganizer"
+ oTreeList = ScriptTreeList
+ case DLG_BASIC_ORG: ToolsMacro_uno
+ Kontext "Makro"
+ oTreeList = MakroAus
+ case DLG_RUN_MACRO: ToolsMacrosRunMacro
+ kontext "ScriptSelector"
+ oTreeList = LibraryTreeList
+ end select
- if ( aScriptCount( iCurrentDialog ) <> iCurrentScriptCount ) then
- warnlog( "Incorrect number of scripts for this dialog: '" + sDialog + "' expected:" + aScriptCount( iCurrentDialog ) + ", but is:" & iCurrentScriptCount )
- else
- printlog( "Number of scripts is ok" )
- endif
+ printlog( "Expand all nodes and retrieve all nodenames" )
+ hGetAllNodeNames( oTreeList, cScriptNamesList() )
+ printlog( "Compare to reference list, create new one if differences were found" )
+ hManageComparisionList( sFileIn, sFileOut, cScriptNamesList() )
+
+ printlog( "Close " & sDialog )
+ select case ( sDialog )
+ case DLG_JAVASCRIPT : ScriptOrganizer.cancel()
+ case DLG_BEANSHELL : ScriptOrganizer.cancel()
+ case DLG_PYTHON : ScriptOrganizer.cancel()
+ case DLG_BASIC_ORG : Makro.close()
+ case DLG_RUN_MACRO : ScriptSelector.cancel()
+ end select
+
next iCurrentDialog
hCloseDocument()
diff --git a/testautomation/framework/required/includes/scripting_basics.inc b/testautomation/framework/required/includes/scripting_basics.inc
deleted file mode 100755
index d5377c4873bd..000000000000
--- a/testautomation/framework/required/includes/scripting_basics.inc
+++ /dev/null
@@ -1,74 +0,0 @@
-'encoding UTF-8 Do not remove or change this line!
-'**************************************************************************
-' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-'
-' Copyright 2000, 2010 Oracle and/or its affiliates.
-'
-' OpenOffice.org - a multi-platform office productivity suite
-'
-' This file is part of OpenOffice.org.
-'
-' OpenOffice.org is free software: you can redistribute it and/or modify
-' it under the terms of the GNU Lesser General Public License version 3
-' only, as published by the Free Software Foundation.
-'
-' OpenOffice.org is distributed in the hope that it will be useful,
-' but WITHOUT ANY WARRANTY; without even the implied warranty of
-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-' GNU Lesser General Public License version 3 for more details
-' (a copy is included in the LICENSE file that accompanied this code).
-'
-' You should have received a copy of the GNU Lesser General Public License
-' version 3 along with OpenOffice.org. If not, see
-' <http://www.openoffice.org/license.html>
-' for a copy of the LGPLv3 License.
-'
-'/************************************************************************
-'*
-'* owner : joerg.skottke@sun.com
-'*
-'* short description : Quick short test for the scripting framework
-'*
-'\******************************************************************************
-
-testcase tScripting
-
- printlog( "Verify that the nodes <My Macros> and <OOo Macros> are present" )
-
- const ORGANIZER_ITEMS = 2
- const MAX_DIALOG_DELAY = 5
-
- hFileCloseAll()
-
- ToolsMacrosOrganizeMacrosBeanShell
-
- Kontext "ScriptOrganizer"
- if ( ScriptOrganizer.exists( MAX_DIALOG_DELAY ) ) then
- printlog( "Beanshell Script Organizer is present. Good" )
- if ( ScriptTreeList.getItemCount() <> ORGANIZER_ITEMS ) then
- warnlog( "The Treelist does not contain the expected number " & _
- "of items. Please verify that exactly " & ORGANIZER_ITEMS & " top-nodes exist" )
- endif
- hCloseDialog( ScriptOrganizer, "cancel" )
- else
- warnlog( "Script Organizer for Beanshell is missing" )
- endif
-
- ToolsMacrosOrganizeMacrosJavaScript
-
- Kontext "ScriptOrganizer"
- if ( ScriptOrganizer.exists( MAX_DIALOG_DELAY ) ) then
- printlog( "JavaScript Script Organizer is present. Good" )
- if ( ScriptTreeList.getItemCount() <> ORGANIZER_ITEMS ) then
- warnlog( "The Treelist does not contain the expected number " & _
- "of items. Please verify that exactly " & ORGANIZER_ITEMS & " top-nodes exist" )
- endif
- hCloseDialog( ScriptOrganizer, "cancel" )
- else
- warnlog( "Script Organizer for JavaScript is missing" )
- endif
-
-endcase
-
-
-
diff --git a/testautomation/framework/required/includes/wizard_documentconverter.inc b/testautomation/framework/required/includes/wizard_documentconverter.inc
index 7ba81116728b..110f9f311064 100644..100755
--- a/testautomation/framework/required/includes/wizard_documentconverter.inc
+++ b/testautomation/framework/required/includes/wizard_documentconverter.inc
@@ -59,7 +59,7 @@ testcase tUpdtWizardDocumentConverter
sTargetFile = hGetWorkPath()
sLogFile = sTargetFile & "Logfile.odt"
- stargetFile = sTargetFile & "docconv1" & hGetSuffix( "current" )
+ sTargetFile = sTargetFile & "docconv1" & hGetSuffix( "current" )
Kontext "DocumentConverter"
diff --git a/testautomation/framework/tools/includes/wizards.inc b/testautomation/framework/tools/includes/wizards.inc
index a140401c1202..39f72f3df901 100755
--- a/testautomation/framework/tools/includes/wizards.inc
+++ b/testautomation/framework/tools/includes/wizards.inc
@@ -31,117 +31,48 @@
'*
'\******************************************************************************
-function hOpenWizardWithMenu( cType as string ) as integer
+function hOpenWizard( cWizard as string ) as boolean
- const CFN = "hOpenWizardWithMenu::"
+ const CFN = "hOpenWizard(): "
+ const NUMBER_OF_RETRIES = 3
- '///<h3>Open a wizard via menu</h3>
- '///<i>Starting point: Any plain document</i><br>
- '///<i>Uses: framework/tools/input/menuentries.txt</i><br>
- '///<u>Input</u>:
- '///<ol>
- '///+<li>Name of Wizard (string). Known Wizards are:</li>
- '///<ul>
- '///+<li>&quot;LETTER&quot;</li>
- '///+<li>&quot;FAX&quot;</li>
- '///+<li>&quot;AGENDA&quot;</li>
- '///+<li>&quot;PRESENTATION&quot;</li>
- '///+<li>&quot;WEBPAGE&quot;</li>
- '///+<li>&quot;DOCCONV&quot;</li>
- '///+<li>&quot;EUROCONV&quot;</li>
- '///+<li>&quot;ADDRESS&quot;</li>
- '///+<li>&quot;MAILMERGE&quot;</li>
- '///</ul>
- '///</ol>
- '///<u>Returns</u>:
- '///<ol>
- '///+<li>Errorcode (integer)</li>
- '///<ul>
- '///+<li>0: The expected wizard is open</li>
- '///+<li>1: No wizard is open</li>
- '///+<li>2: The incorrect wizard is open</li>
- '///+<li>3: The requested wizard is unknown to this function</li>
- '///</ul>
- '///</ol>
- '///<u>Description</u>:
- '///<ul>
-
- dim iMainMenuPosition as integer ' position in the main menu
- dim iMenuPosition as integer ' the position of the menuentry
- dim iWizardMenuPosition as integer ' the position of the wizards menu
- dim iWizardID as integer ' a unique number to identify the wizard
- dim iWait as integer ' time of the wizard to open
- dim iOpen as integer ' identifier for the open dialog
- dim brc as boolean ' some multi purpose boolean returnvalue
-
- hOpenWizardWithMenu() = 0
-
- '///+<li>find out where in the menustructure the wizards are located</li>
- printlog( "Requested Wizard: " & cType )
- iWizardID = hGetWizardParams( cType , "ID" )
- iMainMenuPosition = hGetWizardParams( cType , "MAIN" )
- iMenuPosition = hGetWizardParams( cType , "SUB" )
- iWizardMenuPosition = 4 ' This is the "Wizards" menuentry below "File"
-
- try
- kontext "DocumentWriter"
- hUseMenu()
-
- '///+<li>Open the 'File' menu</li>
- printlog( CFN & "Open Menu at pos " & iMainMenuPosition )
- hMenuSelectNr( iMainMenuPosition )
- WaitSlot( 2000 )
-
- '///+<li>if we are in the filemenu the wizards are below a submenu</li>
- if ( iMainMenuPosition = 1 ) then
- printlog( CFN & "Select wizards-submenu at pos " & iWizardMenuPosition )
- hMenuSelectNr( iWizardMenuPosition )
- WaitSlot( 2000 )
- else
- printlog( CFN & "Wizard is not in File-Menu" )
- endif
-
- '///+<li>try to click the menuentry where we expect the wizard</li>
- printlog( CFN & "Select " & cType & " wizard at pos " & iMenuPosition )
- hMenuSelectNr( iMenuPosition )
- WaitSlot( 2000 )
- brc = true
- catch
- ' we end up here, when the menuitems could not be accessed
- printlog( CFN & "Error accessing menuentry for wizard" )
- hOpenWizardwithMenu() = 1
- brc = false
- endcatch
-
+ dim iTry as integer
+ dim brc as boolean : brc = false
+
+ if ( GVERBOSE ) then printlog( CFN & "Opening wizard" )
+
+ ' Call the wizard by slot
+ for iTry = 1 to NUMBER_OF_RETRIES
+ try
+ select case ( ucase( cWizard ) )
+ case "PRESENTATION" : FileAutopilotPresentation
+ case "FIRTSTIME" : FirstTimeWizard
+ case "MAILMERGE" : ToolsMailMergeWizard
+ case "EUROCONV" : FileWizardEuroConverter
+ case "DOCCONV" : FileWizardDocumentConverter
+ case "WEBPAGE" : FileWizardsWebPage
+ case "LETTER" : FileAutopilotLetter
+ case "AGENDA" : FileAutopilotAgenda
+ case "ADRESS" : FileAutopilotAddressDataSource
+ case "FAX" : FileAutopilotFax
+ case else :
+ warnlog( CFN & "Invalid wizard requested: " & cWizard )
+ hOpenWizard() = brc
+ exit function
+ end select
+
+ brc = true
+ exit for
+ catch
+ wait( 200 )
+ endcatch
+ next iTry
+
+ ' Print warning if slot was blocked.
if ( not brc ) then
- printlog( CFN & "Trying to open wizard using the slot" )
- select case iWizardId
- case 1 : FileAutopilotLetter
- case 2 : FileAutopilotFax
- case 3 : FileAutopilotAgenda
- case 4 : FileAutopilotPresentation
- end select
+ warnlog( CFN & "Failed to open requested wizard: " & cWizard )
endif
-
- '///+<li>wait for a wizard to open, iOpen is the number of the menuitem</li>
- iOpen = hWaitForWizard()
-
- '///+<li>Verify that the correct wizard is open. iOpen should match iMenuPosition</li>
- ' This works because the menu-positions are unique. BEWARE!
- if ( iOpen <> iWizardID ) then
-
- qaerrorlog( CFN & "Incorrect Wizard is open, did the menu-order change?" )
-
- hFinishWizard( 2 )
- hOpenWizardWithMenu() = 2
- else
-
- hOpenWizardWithMenu() = 0
-
- endif
- '///</ul>
-
end function
'*******************************************************************************
diff --git a/testautomation/global/sid/e_all.sid b/testautomation/global/sid/e_all.sid
index 866251e652ac..7d7d3863cde9 100644
--- a/testautomation/global/sid/e_all.sid
+++ b/testautomation/global/sid/e_all.sid
@@ -20,6 +20,8 @@ FileAutopilotPresentation SID_SD_AUTOPILOT
FileAutopilotAddressDataSource SID_ADDRESS_DATA_SOURCE
FirstTimeWizard service:com.sun.star.comp.desktop.FirstStart?start
FileWizardsWebPage service:com.sun.star.wizards.web.CallWizard?start
+' FileWizardDocumentConverter macro:///ImportWizard.Main.Main
+' FileWizardEuroConverter macro:///Euro.AutoPilotRun.StartAutoPilot
FileCloseAndReturn SID_CLOSEDOC
FileSaveCopy SID_SAVEASDOC
FileClose .uno:CloseDoc
diff --git a/testautomation/global/tools/includes/optional/t_treelist_tools.inc b/testautomation/global/tools/includes/optional/t_treelist_tools.inc
index 0c1d17e62c91..0b84f3e0210b 100755
--- a/testautomation/global/tools/includes/optional/t_treelist_tools.inc
+++ b/testautomation/global/tools/includes/optional/t_treelist_tools.inc
@@ -255,6 +255,15 @@ end function
'*******************************************************************************
+function hGetAllNodeNames( oControl as object , lsList() as string ) as integer
+
+ hExpandAllNodes( oControl )
+ hGetAllNodeNames() = hGetVisibleNodeNames( oControl, lsList() )
+
+end function
+
+'*******************************************************************************
+
function hGetVisibleNodeNames( oControl as object , lsList() as string ) as integer
'///<h3>Retrieve the names of all nodes in a treelist</h3>