testdev/ite/test/com.nokia.testfw.test/src/com/nokia/testfw/test/framework/WizardTestCase.java
author Johnson Ma <johnson.ma@nokia.com>
Tue, 30 Mar 2010 14:39:29 +0800
changeset 1 96906a986c3b
permissions -rw-r--r--
contribute ITE to symbian foundation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     1
/*
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     5
 * under the terms of the License "Symbian Foundation License v1.0"
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     8
 *
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    11
 *
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    12
 * Contributors:
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    13
 *
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    14
 * Description:
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    15
 *
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    16
 */
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    17
package com.nokia.testfw.test.framework;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    18
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    19
import org.eclipse.jface.wizard.IWizard;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    20
import org.eclipse.jface.wizard.WizardDialog;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    21
import org.eclipse.swt.widgets.Display;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    22
import org.eclipse.swt.widgets.Shell;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    23
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    24
import junit.framework.TestCase;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    25
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    26
/**
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    27
 * This abstract is for Composite testing. It will create a WizardDialog to hold
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    28
 * target composite.
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    29
 * <P>
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    30
 * user need to implement the getWizard method to create the target wizard for
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    31
 * test
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    32
 * 
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    33
 * @author Kevin Wang
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    34
 * 
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    35
 */
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    36
public abstract class WizardTestCase extends TestCase {
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    37
	protected WizardDialog dialog;
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    38
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    39
	/**
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    40
	 * Sets up the fixture, for example, open a network connection. This method
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    41
	 * is called before a test is executed.
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    42
	 */
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    43
	protected void setUp() throws Exception {
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    44
		Shell shell = Display.getDefault().getActiveShell();
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    45
		dialog = new WizardDialog(shell, getWizard());
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    46
		dialog.setBlockOnOpen(false);
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    47
	}
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    48
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    49
	/**
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    50
	 * Tears down the fixture, for example, close a network connection. This
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    51
	 * method is called after a test is executed.
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    52
	 */
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    53
	protected void tearDown() throws Exception {
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    54
	}
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    55
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    56
	protected abstract IWizard getWizard();
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    57
96906a986c3b contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    58
}