This is an automated email from the ASF dual-hosted git repository.
cmarcum pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new 7d8592c79c Fix TestFormulaDocs to run against AOO41X, make
parameterized, and fix late screenshots (#149)
7d8592c79c is described below
commit 7d8592c79cfa104063570593e943fed55296950b
Author: Carl Marcum <[email protected]>
AuthorDate: Sun May 29 15:47:07 2022 -0400
Fix TestFormulaDocs to run against AOO41X, make parameterized, and fix late
screenshots (#149)
updated TestFormulaDocs test to be a parameterized test to better see which
document failed.
Fixed late screenshots on failures.
Added timeout for dialog hangs when running tests against AOO41X branch due
to some BASIC bug fixes for i112383 [1] and it's commit [2] and i117960 [3] and
it's commit [4] not being back-ported to AOO41X.
[1] https://bz.apache.org/ooo/show_bug.cgi?id=112383
[2] 323c350
[3] https://bz.apache.org/ooo/show_bug.cgi?id=117960
[4] 725d867
---
.../source/fvt/uno/sc/formula/TestFormulaDocs.java | 70 ++++++++++++++--------
1 file changed, 45 insertions(+), 25 deletions(-)
diff --git a/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
b/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
index b72624cdf0..ad14ba96a1 100644
--- a/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
+++ b/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
@@ -23,11 +23,18 @@ package fvt.uno.sc.formula;
import static org.junit.Assert.*;
-import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Arrays;
+import java.util.Collection;
+
import org.openoffice.test.common.Testspace;
import org.openoffice.test.common.Logger;
@@ -50,43 +57,57 @@ import com.sun.star.util.XModifiable;
import java.util.logging.Level;
-
+@RunWith(Parameterized.class)
public class TestFormulaDocs {
+ private String filename;
+ private String type;
+
+ @Parameters
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][]{
+ // test documents
+ {"uno/sc/fvt/FormulaTest1.ods",
"FormulaTest1.ods"},
+
{"uno/sc/fvt/StarBasicYearMonthDateHourMinuteSecondTests.ods",
"StarBasicYearMonthDateHourMinuteSecondTests.ods"},
+ {"uno/sc/fvt/StarBasicCLng.ods",
"StarBasicCLng.ods"},
+ {"uno/sc/fvt/DGET on formulas.ods", "DGET on
formulas.ods"},
+ {"uno/sc/fvt/Basic Line as variable and Line
Input.ods", "Basic Line as variable and Line Input.ods"}
+ });
+ }
+
@Rule
public Logger log = Logger.getLogger(this);
- UnoApp unoApp = new UnoApp();
+ static UnoApp unoApp = new UnoApp();
XComponent scComponent = null;
+ /**
+ * Clean class after testing
+ *
+ * @throws Exception
+ */
+ @AfterClass
+ public static void afterClass() {
+ unoApp.close();
+ }
+
@Before
public void setUp() throws Exception {
+ unoApp.close(); // moved here from tearDown because stopping
app there causes a late screenshot
unoApp.start();
}
- @After
- public void tearDown() throws Exception {
- unoApp.close();
+ public TestFormulaDocs(String filename, String type) {
+ this.filename = filename;
+ this.type = type;
}
- /**
- * Test evaluation of formulas in a sample document
- *
- * @throws Exception
- */
-
- @Test
- public void testFormulaDocs() throws Exception {
- testOneDoc( "uno/sc/fvt/FormulaTest1.ods");
- testOneDoc(
"uno/sc/fvt/StarBasicYearMonthDateHourMinuteSecondTests.ods");
- testOneDoc( "uno/sc/fvt/StarBasicCLng.ods");
- testOneDoc( "uno/sc/fvt/DGET on formulas.ods");
- testOneDoc( "uno/sc/fvt/Basic Line as variable and Line
Input.ods");
- }
-
- public void testOneDoc( String filename) throws Exception {
+ // FIXME: only needs a timeout for running tests against AOO41X due to
fixes for i112383 and i117960 present in trunk
+ // haven't been backported to AOO41X yet and causes these tests to hang
on an error dialog.
+ @Test(timeout = 15000)
+ public void testOneDoc() throws Exception {
// open the spreadsheet document
- String sample = Testspace.prepareData( filename);
+ String sample = Testspace.prepareData(filename);
// enable macros
PropertyValue prop = new PropertyValue();
prop.Name = "MacroExecutionMode";
@@ -146,7 +167,7 @@ public class TestFormulaDocs {
}
}
- assertTrue( (""+nFailCount+" of "+nTestCount+" tests failed"),
nFailCount==0);
+ assertTrue( (""+nFailCount+" of "+nTestCount+" tests failed for
" + type), nFailCount==0);
XModifiable modified = (XModifiable)UnoRuntime.queryInterface(
XModifiable.class, scDoc);
modified.setModified( false);
@@ -154,4 +175,3 @@ public class TestFormulaDocs {
}
}
-