|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package com.nokia.testfw.codegen.ui.wizard; |
|
18 |
|
19 import java.io.File; |
|
20 |
|
21 import org.eclipse.core.resources.IFolder; |
|
22 import org.eclipse.core.resources.IProject; |
|
23 import org.eclipse.jface.viewers.StructuredSelection; |
|
24 import org.eclipse.jface.wizard.IWizard; |
|
25 import org.eclipse.jface.wizard.IWizardPage; |
|
26 import org.eclipse.ui.PlatformUI; |
|
27 |
|
28 import com.nokia.testfw.test.framework.WizardTestCase; |
|
29 import com.nokia.testfw.test.utils.ProjectUtils; |
|
30 import com.nokia.testfw.test.utils.TestUtils; |
|
31 |
|
32 public class NewTestCaseWizardTest extends WizardTestCase { |
|
33 IProject targetProject; |
|
34 |
|
35 protected void setUp() throws Exception { |
|
36 targetProject = ProjectUtils.getTargetProject("testProject"); |
|
37 if (targetProject == null) { |
|
38 // targetProject.delete(true, true, new NullProgressMonitor()); |
|
39 String projectPath = (new File("resource/HelloWorld")) |
|
40 .getCanonicalPath(); |
|
41 String bldInfPath = "Bld.inf"; |
|
42 targetProject = ProjectUtils.createTargetProject("testProject", |
|
43 projectPath, bldInfPath); |
|
44 } |
|
45 ProjectUtils.selectProject(targetProject); |
|
46 super.setUp(); |
|
47 } |
|
48 |
|
49 SUTNewTestWizard wizard; |
|
50 |
|
51 protected IWizard getWizard() { |
|
52 wizard = new SUTNewTestWizard(); |
|
53 wizard.init(PlatformUI.getWorkbench(), new StructuredSelection( |
|
54 targetProject)); |
|
55 return wizard; |
|
56 } |
|
57 |
|
58 public void testCreateTestSuitePerform() { |
|
59 wizard.setShowChooseProjectPage(true); |
|
60 dialog.open(); |
|
61 TestUtils.delay(3000); |
|
62 IWizardPage currentPage = dialog.getCurrentPage(); |
|
63 dialog.showPage(currentPage.getNextPage()); |
|
64 TestUtils.delay(3000); |
|
65 currentPage = dialog.getCurrentPage(); |
|
66 dialog.showPage(currentPage.getNextPage()); |
|
67 TestUtils.delay(3000); |
|
68 currentPage = dialog.getCurrentPage(); |
|
69 dialog.showPage(currentPage.getNextPage()); |
|
70 TestUtils.delay(3000); |
|
71 dialog.getShell().getDisplay().syncExec(new Runnable() { |
|
72 public void run() { |
|
73 wizard.performFinish(); |
|
74 } |
|
75 }); |
|
76 dialog.close(); |
|
77 TestUtils.delay(3000); |
|
78 |
|
79 IFolder testfolder = targetProject.getFolder("tsrc"); |
|
80 assertTrue(testfolder.exists()); |
|
81 } |
|
82 |
|
83 public void testCreateTestCasePerform() { |
|
84 wizard.setShowChooseProjectPage(false); |
|
85 dialog.open(); |
|
86 TestUtils.delay(3000); |
|
87 IWizardPage currentPage = dialog.getCurrentPage(); |
|
88 dialog.showPage(currentPage.getNextPage()); |
|
89 TestUtils.delay(3000); |
|
90 currentPage = dialog.getCurrentPage(); |
|
91 dialog.showPage(currentPage.getNextPage()); |
|
92 TestUtils.delay(3000); |
|
93 currentPage = dialog.getCurrentPage(); |
|
94 dialog.showPage(currentPage.getNextPage()); |
|
95 TestUtils.delay(3000); |
|
96 currentPage = dialog.getCurrentPage(); |
|
97 if (currentPage instanceof LocationAndPropertyPage) { |
|
98 ((LocationAndPropertyPage) currentPage).setShowPreviewChanges(true); |
|
99 dialog.updateButtons(); |
|
100 } |
|
101 dialog.showPage(currentPage.getNextPage()); |
|
102 TestUtils.delay(3000); |
|
103 dialog.getShell().getDisplay().syncExec(new Runnable() { |
|
104 public void run() { |
|
105 wizard.performFinish(); |
|
106 } |
|
107 }); |
|
108 dialog.close(); |
|
109 TestUtils.delay(3000); |
|
110 |
|
111 IFolder testfolder = targetProject.getFolder("tsrc"); |
|
112 assertTrue(testfolder.exists()); |
|
113 } |
|
114 |
|
115 } |