diff options
author | Liu Zhe <liuzhe@apache.org> | 2012-07-10 05:44:43 +0000 |
---|---|---|
committer | Liu Zhe <liuzhe@apache.org> | 2012-07-10 05:44:43 +0000 |
commit | 41e30e1dc27b82e7fbd6741b085182b022f2aa9b (patch) | |
tree | d12da646ec7708d40905bcaed91e5b1b16ed0a4a /test | |
parent | 428f563b9be76afbfd5fc56177acb038c15a2456 (diff) |
#120234# - testcommon enhancement: uno api test support, multiple instances support.
Replaced AppUtil.initApp to VclApp.start.
Notes
Notes:
ignore: vclauto
Diffstat (limited to 'test')
-rw-r--r-- | test/testoo/src/testcase/BVTFileType.java | 20 | ||||
-rw-r--r-- | test/testoo/src/testcase/BVTFunction.java | 24 | ||||
-rw-r--r-- | test/testoo/src/testcase/LongRun.java | 10 | ||||
-rw-r--r-- | test/testoo/src/testcase/SayHelloToOO.java | 23 | ||||
-rw-r--r-- | test/testoo/src/testcase/SmokeTest.java | 19 | ||||
-rw-r--r-- | test/testoo/src/testcase/TestSample.java | 12 |
6 files changed, 54 insertions, 54 deletions
diff --git a/test/testoo/src/testcase/BVTFileType.java b/test/testoo/src/testcase/BVTFileType.java index 0504ec957563..fa608ddcefd4 100644 --- a/test/testoo/src/testcase/BVTFileType.java +++ b/test/testoo/src/testcase/BVTFileType.java @@ -33,10 +33,9 @@ import static testlib.UIMap.*; import java.awt.Rectangle; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.openoffice.test.common.FileUtil; @@ -53,13 +52,14 @@ public class BVTFileType { @Rule public Log LOG = new Log(); - - /** - * @throws java.lang.Exception - */ @Before public void setUp() throws Exception { - initApp(); + app.start(); + } + + @After + public void tearDown() throws Exception { + app.close(); } /** @@ -241,6 +241,7 @@ public class BVTFileType { String text = "Hello Openoffice"; app.dispatch("private:factory/simpress?slot=6686"); PresentationWizard.ok(); + sleep(1); impress.click(0.01, 0.01); typeKeys(text); sleep(2); @@ -436,9 +437,4 @@ public class BVTFileType { // Close the file to avoid the app closing the Elements window automatically app.dispatch(".uno:CloseDoc", 3); } - - @AfterClass - public static void afterClass() { - app.kill(); - } } diff --git a/test/testoo/src/testcase/BVTFunction.java b/test/testoo/src/testcase/BVTFunction.java index 585181bb537d..d01b39659c3c 100644 --- a/test/testoo/src/testcase/BVTFunction.java +++ b/test/testoo/src/testcase/BVTFunction.java @@ -34,14 +34,13 @@ import static testlib.UIMap.*; import java.awt.Rectangle; import java.io.File; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.openoffice.test.common.FileUtil; import org.openoffice.test.common.GraphicsUtil; -import org.openoffice.test.common.SystemUtil; import testlib.CalcUtil; import testlib.Log; @@ -55,12 +54,14 @@ public class BVTFunction { @Rule public Log LOG = new Log(); - /** - * @throws java.lang.Exception - */ @Before public void setUp() throws Exception { - initApp(); + app.start(); + } + + @After + public void tearDown() throws Exception { + app.close(); } @@ -77,14 +78,10 @@ public class BVTFunction { FileUtil.deleteFile(exportTo); submitSaveDlg(exportTo); assertTrue("PDF is exported?", new File(exportTo).exists()); - - // Via toolbar - app.dispatch("private:factory/swriter", 3); assertTrue(toolbox(".HelpId:standardbar").exists(5)); button(".uno:ExportDirectToPDF").click(); assertEquals("PDF - Portable Document Format (.pdf)", FileSave_FileType.getSelText()); FileSave.cancel(); - } /** @@ -112,7 +109,7 @@ public class BVTFunction { //Create a new text document and launch a Wizards dialog which need JVM work correctly. app.dispatch("private:factory/swriter", 3); - File tempfile=new File(app.getUserInstallation(),"user/template/myAgendaTemplate.ott"); + File tempfile=new File(oo.getUserInstallation(),"user/template/myAgendaTemplate.ott"); FileUtil.deleteFile(tempfile); sleep(3); app.dispatch("service:com.sun.star.wizards.agenda.CallWizard?start"); @@ -768,9 +765,4 @@ public class BVTFunction { // Verify if the calculated result is equal to the expected result assertEquals("The calculated result", expectedResult, CalcUtil.getCellText("B1")); } - - @AfterClass - public static void afterClass() { - app.kill(); - } } diff --git a/test/testoo/src/testcase/LongRun.java b/test/testoo/src/testcase/LongRun.java index 9b263ec07ebc..8f22d8de3541 100644 --- a/test/testoo/src/testcase/LongRun.java +++ b/test/testoo/src/testcase/LongRun.java @@ -28,6 +28,7 @@ import static testlib.UIMap.*; import java.awt.Rectangle; import java.awt.image.BufferedImage; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; @@ -50,7 +51,12 @@ public class LongRun { */ @Before public void setUp() throws Exception { - initApp(); + app.start(); + } + + @After + public void tearDown() throws Exception { + app.close(); } Rectangle rect = new Rectangle(400, 200, 60, 60); @@ -129,7 +135,7 @@ public class LongRun { saveNewDrawing("draw_saveas.std"); long end = System.currentTimeMillis(); LOG.info("Iterator: " + i + ", Elapsed Hours: " + ((end - start) / 3600000)); - SystemUtil.execScript("ps -eo vsz,rss,comm | grep soffice.bin", false); + SystemUtil.execScript("ps -eo vsz,rss,comm | grep soffice.bin"); } } diff --git a/test/testoo/src/testcase/SayHelloToOO.java b/test/testoo/src/testcase/SayHelloToOO.java index 6eab662ab4de..1897643b04b8 100644 --- a/test/testoo/src/testcase/SayHelloToOO.java +++ b/test/testoo/src/testcase/SayHelloToOO.java @@ -27,6 +27,7 @@ import static org.junit.Assert.*; import static testlib.AppUtil.*; import static testlib.UIMap.*; +import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -50,17 +51,25 @@ public class SayHelloToOO { @Rule public Log LOG = new Log(); + /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception + * Do some setup task before running test + * @throws Exception */ @Before public void setUp() throws Exception { - initApp(); + //Start OpenOffice + app.start(); + } + + /** + * Clean task after testing + * @throws Exception + */ + @After + public void tearDown() throws Exception { + //Close OpenOffice + app.close(); } /** diff --git a/test/testoo/src/testcase/SmokeTest.java b/test/testoo/src/testcase/SmokeTest.java index f5aaf071e8c3..b0a5d68171b9 100644 --- a/test/testoo/src/testcase/SmokeTest.java +++ b/test/testoo/src/testcase/SmokeTest.java @@ -30,7 +30,7 @@ import static testlib.UIMap.*; import java.io.File; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -43,11 +43,17 @@ public class SmokeTest { public Log LOG = new Log(); File smoketestOutput; + @Before public void setUp() throws Exception { - initApp(true); - smoketestOutput = new File(app.getUserInstallation(), "user/temp"); - deleteFile(smoketestOutput); + app.getOpenOffice().cleanUserInstallation(); + app.start(); + smoketestOutput = new File(oo.getUserInstallation(), "user/temp"); + } + + @After + public void tearDown() throws Exception { + app.close(); } @Test @@ -66,9 +72,4 @@ public class SmokeTest { assertTrue("No Error", !smoketestlog.contains("error") && !testclosurelog.contains("error")); } - - @AfterClass - public static void afterClass() { - app.kill(); - } } diff --git a/test/testoo/src/testcase/TestSample.java b/test/testoo/src/testcase/TestSample.java index 82ab630f82e1..0b844df7618a 100644 --- a/test/testoo/src/testcase/TestSample.java +++ b/test/testoo/src/testcase/TestSample.java @@ -24,14 +24,10 @@ package testcase; -import static org.openoffice.test.vcl.Tester.sleep; -import static testlib.AppUtil.fullPath; -import static testlib.AppUtil.handleBlocker; -import static testlib.AppUtil.initApp; -import static testlib.AppUtil.openStartcenter; -import static testlib.AppUtil.submitOpenDlg; -import static testlib.AppUtil.submitSaveDlg; +import static org.openoffice.test.vcl.Tester.*; +import static testlib.AppUtil.*; import static testlib.UIMap.*; + import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -121,7 +117,7 @@ public class TestSample { */ @Before public void setUp() { - initApp(); + app.start(); FileUtil.deleteFile(fullPath("temp")); File temp = new File(fullPath("temp")); |