Update ooo320-m1
[ooovba.git] / testautomation / tools / run_tests / run_tests.vbs
blob10e69c976f413ff9203858a8978d6fc450d9baab
1 '*************************************************************************
2 '*
3 '* OpenOffice.org - a multi-platform office productivity suite
4 '*
5 '* $RCSfile: run_tests.vbs,v $
6 '*
7 '* $Revision: 1.1 $
8 '*
9 '* last change: $Author: andreschnabel $ $Date: 2008/04/05 09:02:23 $
11 '* The Contents of this file are made available subject to
12 '* the terms of GNU Lesser General Public License Version 2.1.
15 '* GNU Lesser General Public License Version 2.1
16 '* =============================================
17 '* Copyright 2005 by Sun Microsystems, Inc.
18 '* 901 San Antonio Road, Palo Alto, CA 94303, USA
20 '* This library is free software; you can redistribute it and/or
21 '* modify it under the terms of the GNU Lesser General Public
22 '* License version 2.1, as published by the Free Software Foundation.
24 '* This library is distributed in the hope that it will be useful,
25 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
26 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 '* Lesser General Public License for more details.
29 '* You should have received a copy of the GNU Lesser General Public
30 '* License along with this library; if not, write to the Free Software
31 '* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 '* MA 02111-1307 USA
34 '########################################################################
36 ' Owner : andreschnabel@openoffice.org
38 ' short description : run several testscripts on windows
40 ' - list of scripts to run is read from stdin
41 ' - this script has been tested on WindowsXP and may run on Win2003
42 ' and Windows Vista
43 ' - the script does *not* Support Win9x / WinME or WindowsNT
44 ' - before you start the script set sLocation and sTestTool
45 ' - run this script with:
46 ' cscript.exe runtests.vbs <list_of_testscripts
48 '########################################################################
51 ' set location of testscripts (the 'qatesttool' directory)
52 sLocation = "c:\testautomation\"
54 ' set location of TestTool
55 ' (full path including executable 'testtool.exe')
56 sTestTool = "c:\Testtool\testtool.exe"
59 '------------------------------------------------------------------------
60 '--- the main script starts here ---
61 '------------------------------------------------------------------------
62 Dim oFSO ' AS FileSystemObject
63 Dim oStdIn ' As TextStream
64 Dim WshShell ' as WScript.Shell
65 Dim oExec ' as WshExec
67 ' get Objects for Scripting
68 Set oFSO = CreateObject ("Scripting.FileSystemObject")
69 Set oStdIn = WScript.StdIn
70 Set WshShell = CreateObject("WScript.Shell")
73 '--- platform specific settings
74 ' Read Environment and do Windows Version specific stuff
75 ' nothing done yet
78 '--- if sLocation is not set manuall try to get the location form testtoolrc
79 If not oFSO.FolderExists(sLocation) Then
80 '--- Read Location from testtool.ini
81 WScript.Echo "Read Location from testtool.ini - not implemented yet"
82 End If
84 '--- set location of close-office file
85 ' (see cvs)
86 sExitOfficeBas = sLocation & "global\tools\resetoffice.bas"
88 '--- if sTestTool is not set manuall try to get the location form testtoolrc
89 If not oFSO.FileExists(sTestTool) Then
90 '--- Read testtool path from testtool.ini
91 WScript.Echo "Read testtool path from testtool.ini - not implemented yet"
92 End If
95 WScript.Echo "****************************************************"
96 WScript.Echo "************ STARTING ************"
97 WScript.Echo "****************************************************"
99 'echo "My name is: " $USER
101 ' test if location exists
102 If oFSO.FolderExists(sLocation) Then
103 WScript.Echo "using scripts from " & sLocation
104 Else
105 WScript.Echo "test scripts not found at " & sLocation
106 WScript.Echo "Please set sLocation in this script"
107 WScript.Quit 1
108 End If
110 ' test if testtool.bin exists
111 If oFSO.FileExists(sTestTool) Then
112 WScript.Echo "using testtool from " & sTestTool
113 Else
114 WScript.Echo "testtool not found at " & sTestTool
115 WScript.Echo "Please set sTestTool in this script"
116 WScript.Quit 1
117 End If
119 i = 0
120 '--- Main loop
121 While Not oStdIn.AtEndOfStream
123 WScript.echo "Running soffices' processes: "
124 '# kill office, if exists
125 '`$KILLOFFICEALL`
126 ' *************-> have this line modified, because an error in
127 ' *************-> testtool.exe. (the soffice processes are not
128 ' *************-> killed in resetoffice.bas)
129 ' *************-> 2009/07/06
130 ' *************-> wolfgang pechlaner (wope@openoffice.org)
131 WshShell.Run "tskill soffice", 1, true
132 WScript.Sleep 1000
134 sTestCase = oStdIn.ReadLine
136 WScript.echo " "
137 WScript.Echo "****************************************************"
138 WScript.Echo "running " & sTestCase
139 sTest = sLocation & sTestCase
140 WScript.echo "*** -> " & sTest
142 If not oFSO.FileExists( sTest ) Then
143 WScript.Echo " Could not run " & sTest
144 WScript.Echo " File not found"
145 Else
146 ' first run is the real test ...
147 Set oExec = WshShell.Exec("""" & sTestTool & """ & -run & """ & sTest & """" )
148 WScript.Sleep 1000
150 If oExec.Status = 0 Then
151 WScript.Echo " Successfully started"
152 Else
153 WScript.Echo " There might be something wrong with starting the Testtool!"
154 End If
156 '--- wait until Testtool has finished & closed
157 While oExec.Status = 0
158 WScript.Sleep 1000
159 i = i+1
160 Wend
161 End If
162 'run the office exit script!
163 WScript.Echo " trying to kill the previous office process"
164 WshShell.Run """" & sTestTool & """ -run """ & sExitOfficeBas & """", 1, true
166 Set oExec = Nothing
167 Wend
169 WScript.Echo "Duration:" & i & "sec "