incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1359489 - in /incubator/ooo/trunk/main/test/testoo/src/testcase: BVTFileType.java BVTFunction.java LongRun.java SayHelloToOO.java SmokeTest.java TestSample.java
Date Tue, 10 Jul 2012 06:44:43 GMT
Author: liuzhe
Date: Tue Jul 10 06:44:43 2012
New Revision: 1359489

URL: http://svn.apache.org/viewvc?rev=1359489&view=rev
Log:
#120234# - testcommon enhancement: uno api test support, multiple instances support.
Replaced AppUtil.initApp to VclApp.start.

Modified:
    incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFileType.java
    incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFunction.java
    incubator/ooo/trunk/main/test/testoo/src/testcase/LongRun.java
    incubator/ooo/trunk/main/test/testoo/src/testcase/SayHelloToOO.java
    incubator/ooo/trunk/main/test/testoo/src/testcase/SmokeTest.java
    incubator/ooo/trunk/main/test/testoo/src/testcase/TestSample.java

Modified: incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFileType.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFileType.java?rev=1359489&r1=1359488&r2=1359489&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFileType.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFileType.java Tue Jul 10 06:44:43
2012
@@ -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,15 +52,16 @@ 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();
+	}
+	
 	/**
 	 * Test New/Save a text document
 	 * @throws Exception
@@ -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();
-	}
 }

Modified: incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFunction.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFunction.java?rev=1359489&r1=1359488&r2=1359489&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFunction.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/BVTFunction.java Tue Jul 10 06:44:43
2012
@@ -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();
-		
+		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();
-	}
 }

Modified: incubator/ooo/trunk/main/test/testoo/src/testcase/LongRun.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/LongRun.java?rev=1359489&r1=1359488&r2=1359489&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/LongRun.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/LongRun.java Tue Jul 10 06:44:43 2012
@@ -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,9 +51,14 @@ 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);
 	Condition condition = new Condition() {
 		@Override
@@ -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");
 		}
 	}
 

Modified: incubator/ooo/trunk/main/test/testoo/src/testcase/SayHelloToOO.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/SayHelloToOO.java?rev=1359489&r1=1359488&r2=1359489&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/SayHelloToOO.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/SayHelloToOO.java Tue Jul 10 06:44:43
2012
@@ -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,20 +51,28 @@ 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();
+	}
+	
+	/**
 	 * Implement the case
 	 */
 	@Test

Modified: incubator/ooo/trunk/main/test/testoo/src/testcase/SmokeTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/SmokeTest.java?rev=1359489&r1=1359488&r2=1359489&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/SmokeTest.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/SmokeTest.java Tue Jul 10 06:44:43 2012
@@ -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,13 +43,19 @@ 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
 	public void testMacro() {
 		testFile("TestExtension.oxt");
@@ -66,9 +72,4 @@ public class SmokeTest {
 		assertTrue("No Error", !smoketestlog.contains("error") && !testclosurelog.contains("error"));
 
 	}
-	
-	@AfterClass
-	public static void afterClass() {
-		app.kill();
-	}
 }

Modified: incubator/ooo/trunk/main/test/testoo/src/testcase/TestSample.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/TestSample.java?rev=1359489&r1=1359488&r2=1359489&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/TestSample.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/TestSample.java Tue Jul 10 06:44:43
2012
@@ -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"));



Mime
View raw message