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