1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: smoketest.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-07-10 15:39:30 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : "10ner/Smoke Test" from release engineering
38 '\******************************************************************************
41 '/// Open the smoketest aka 10er test document and run the included macro. ///'
42 '/// File: qa/qatesttool/framework/first/input/10erTest_680.sxw ///'
43 '/// The logfile of the test document is searched for "-> error" and "-> ok" ///'
44 '/// Right now there are 35 ok and no errors. ///'
45 '/// If errors occour, a warnlog is thrown. ///'
46 dim sLocation as string
49 dim lFiles(200) as string
51 dim iError, iOK as integer
53 sLocation = "framework/first/inc/smoketest.inc::"
55 'To avoid focus problems, go to backingwindow
56 if getDocumentcount <> 0 then
57 'After an resetApplication at least one document may be open.
58 printlog "closed one window " + getDocumentCount
62 'Delete temp dir of logs
63 sTemp = convertPath(gOfficePath + "user/temp/")
64 printlog "Going to delete ttt.*: " + GetFileList(sTemp,"ttt.*",lFiles())
65 printlog "Going to delete *.dat: " + GetFileList(sTemp,"*.dat",lFiles())
66 bTemp = KillFileList(lFiles())
68 for i = 1 to ListCount(lFiles())
69 qaErrorlog sLocation + "Can't delete file: " + i + ": '" + lFiles(i) + "'"
73 'Open the test document
74 call hFileOpen(convertPath(gTestToolPath + "framework/required/input/10erTest_680.sxw"))
75 'Security dialog might come up
76 kontext "SecurityWarning"
77 if SecurityWarning.exists(5) then
83 'Start the macro, that performs the test
84 'Tools->Macros->Run Macro...
85 'Check, if all three libraries are there, else close and try again...
87 Kontext "ScriptSelector"
88 if ScriptSelector.exists(10) then
89 x = LibraryTreeList.getItemCount
90 'There have to show up 3 libraries, else the document isn't loaded
92 printlog "Try again..."
96 Kontext "ScriptSelector"
97 x = LibraryTreeList.getItemCount
99 'Look for library '10erTest_680' and '10ERTEST_680'
101 sTemp = LibraryTreeList.getItemText(i)
102 'printlog "("+i+"/"+x+"): '" + sTemp + "'"
103 if (instr(sTemp,"10erTest_680")>0 OR instr(sTemp,"10ERTEST_680")) then
105 printlog "Found library ("+i+"/"+x+"): '" + sTemp + "'"
109 'Select the library and unfold it
110 LibraryTreeList.select(a)
111 LibraryTreeList.typeKeys("+")
112 ' LibraryTreeList.select("10erTest_680") ' not implemented right now :-(
113 'Go to 'Standard' and unfold
114 LibraryTreeList.typeKeys("<down>")
115 LibraryTreeList.typeKeys("+")
117 LibraryTreeList.typeKeys("<down>")
119 'Select macro name 'StartTestByOption'
120 x = ScriptList.getItemCount
122 sTemp = ScriptList.getItemText(i)
123 'printlog "("+i+"/"+x+"): '" + sTemp + "'"
124 if "StartTestByOptions" = sTemp then
126 printlog "Found macro ("+i+"/"+x+"): '" + sTemp + "'"
132 'Start the macro by pressing the button 'run'
134 ' sleep... at least 60 seconds
136 ' If macro fails for whatever reason, a message comes up
138 if active.exists() then
139 warnlog "#i87290# " + active.getText
141 call hCloseDocument()
145 'Path of the log file written by the macro
146 sTemp = convertPath(gOfficePath + "user/temp/log.dat")
148 'Wait until file exists, but not longer than ten minutes
149 while ((NOT fileExists(sTemp)) AND (a < 10))
150 printlog "waiting another minute until file exists - " + a
157 printlog "Log file exists: " + sTemp
158 'Wait until test finished, but not longer than ten minutes
159 'String at end, if finished: 'FINISHED' modified 10er sxw document from TBO!
162 call ListRead (lFiles(), sTemp)
163 while ((lFiles(ListCount(lFiles())) <> "FINISHED") AND (a < 10))
164 printlog "last line: '" + lFiles(ListCount(lFiles())) + "'"
168 call ListRead (lFiles(), sTemp)
173 printlog "Test document finished."
174 'Grep file for "-> error" & "-> ok"
175 a = ListCount(lFiles())
177 if inStr(lFiles(i), "-> error") > 0 then
178 if inStr("simpress Paste Object -> errorsdraw Paste Object -> error",lFiles(i)) > 0 then
184 elseif inStr(lFiles(i), "-> ok") > 0 then
190 qaErrorlog sLocation + "Smoketest/10-er Test failed: " + iError + " times."
192 printlog "Smoketest/10-er Test succeeded: " + iOK + " times."
194 warnlog sLocation + "Macro didn't finish in time (10 minutes)"
197 warnlog sLocation + "Macro didn't create log file in time (10 minutes)"
200 warnlog sLocation + "Macro not found: 'StartTestByOptions'"
203 warnlog sLocation + "Library not found: '10erTest_680' or '10ERTEST_680'"
206 warnlog sLocation + "'Run macro dialog' didn't came up"
210 'Close the document, else an error about the navigator will be thrown
211 if getDocumentcount > 0 then
212 call hCloseDocument()