xref: /trunk/test/testgui/source/fvt/gui/AOOTest.java (revision daaa1af4)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 package fvt.gui;
23 
24 import static org.junit.Assert.*;
25 import static testlib.gui.AppTool.*;
26 import static testlib.gui.UIMap.*;
27 
28 import org.junit.After;
29 import org.junit.AfterClass;
30 import org.junit.Before;
31 import org.junit.BeforeClass;
32 import org.junit.Rule;
33 import org.junit.Test;
34 import org.openoffice.test.common.Logger;
35 
36 import testlib.gui.AppTool;
37 import testlib.gui.SCTool;
38 
39 /**
40  * If AOO is not installed in the default directory, please specify the system
41  * property in your command line. <br/>
42  * -Dopenoffice.home=
43  * "Your OpenOffice installation directory which contains soffice.bin"
44  *
45  */
46 public class AOOTest {
47 
48 	/**
49 	 * Add Log to enable the following capabilities. 1. Take a screenshot when
50 	 * failure occurs. 2. Log any detail information.
51 	 */
52 	@Rule
53 	public Logger log = Logger.getLogger(this);
54 
55 	/**
56 	 * Do some setup task before running class
57 	 *
58 	 * @throws Exception
59 	 */
60 	@BeforeClass
beforeClass()61 	public static void beforeClass() {
62 		app.clean();
63 	}
64 
65 	/**
66 	 * Clean class after testing
67 	 *
68 	 * @throws Exception
69 	 */
70 	@AfterClass
afterClass()71 	public static void afterClass() {
72 		app.stop();
73 	}
74 
75 	/**
76 	 * Do some setup task before running test
77 	 *
78 	 * @throws Exception
79 	 */
80 	@Before
setUp()81 	public void setUp() throws Exception {
82 		app.stop();
83 		app.start();
84 	}
85 
86 	/**
87 	 * Clean task after testing
88 	 *
89 	 * @throws Exception
90 	 */
91 	@After
tearDown()92 	public void tearDown() throws Exception {
93 		// stopping app here causes a late screenshot
94 		// moved to setUp
95 	}
96 
97 	/**
98 	 * Implement test steps
99 	 */
100 	@Test
testHello()101 	public void testHello() {
102 		AppTool.newSpreadsheet();
103 		typeKeys("Hello");
104 		String result = SCTool.getCellInput("A1");
105 		assertEquals("assert cell A1 contents", "Hello", result);
106 	}
107 
108 }
109