KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > junit > pkgtestcreation > PkgCreateTestTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * PkgCreateTestTest.java
22  *
23  * Created on August 2, 2006, 1:39 PM
24  */

25
26 package org.netbeans.test.junit.pkgtestcreation;
27
28 import org.netbeans.jellytools.Bundle;
29 import org.netbeans.jellytools.EditorOperator;
30 import org.netbeans.jellytools.NbDialogOperator;
31 import org.netbeans.jellytools.NewFileWizardOperator;
32 import org.netbeans.jellytools.nodes.Node;
33 import org.netbeans.jemmy.operators.JButtonOperator;
34 import org.netbeans.jemmy.operators.JCheckBoxOperator;
35 import org.netbeans.jemmy.operators.JPopupMenuOperator;
36 import org.netbeans.jemmy.operators.JTextFieldOperator;
37 import org.netbeans.junit.NbTestSuite;
38 import org.netbeans.test.junit.testcase.JunitTestCase;
39 import org.netbeans.test.junit.utils.Utilities;
40
41 /**
42  *
43  * @author ms159439
44  */

45 public class PkgCreateTestTest extends JunitTestCase {
46     
47     /** path to sample files */
48     private static final String JavaDoc TEST_PACKAGE_PATH =
49             "org.netbeans.test.junit.pkgtestcreation";
50     
51     /** name of sample package */
52     private static final String JavaDoc TEST_PACKAGE_NAME = TEST_PACKAGE_PATH+".test";
53     
54     /**
55      * Creates a new instance of PkgCreateTestTest
56      */

57     public PkgCreateTestTest(String JavaDoc testName) {
58         super(testName);
59     }
60     
61     /**
62      * Adds tests to suite
63      * @return created suite
64      */

65     public static NbTestSuite suite() {
66         NbTestSuite suite = new NbTestSuite(PkgCreateTestTest.class);
67         return suite;
68     }
69     
70     /**
71      * Creates tests for whole package
72      */

73     public void testCreateTestForPackage() {
74         //open sample package
75
Node n = Utilities.openFile(Utilities.SRC_PACKAGES_PATH +
76                 "|" + TEST_PACKAGE_NAME);
77         Utilities.pushCreateTestsPopup(n);
78         NbDialogOperator ndo = new NbDialogOperator(CREATE_TESTS_DIALOG);
79         Utilities.checkAllCheckboxes(ndo);
80         ndo.btOK().push();
81         Utilities.takeANap(Utilities.ACTION_TIMEOUT);
82         
83         //Compare TestClassTest
84
ref(filter.filter(new EditorOperator(Utilities.TEST_CLASS_NAME + "Test.java").getText()));
85         compareReferenceFiles();
86         
87         //compare the created test suite TestSuite.java
88
// compareReferenceFiles(Utilities.openFile(Utilities.TEST_PACKAGES_PATH +
89
// "|" + TEST_PACKAGE_NAME + "|" + "TestSuite").getPath(),
90
// getGoldenFile().getParent() + "Suite.pass",
91
// getWorkDirPath() + getName() + ".diff"
92
// );
93

94 // Utilities.deleteNode(Utilities.TEST_PACKAGES_PATH +
95
// "|" + TEST_PACKAGE_NAME);
96

97     }
98     
99 }
100
Popular Tags