KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > junit > testresults > ResultsWindowTest


1 /*
2  * ResultsWindowTest.java
3  *
4  * Created on September 12, 2006, 11:51 AM
5  *
6  */

7
8 package org.netbeans.test.junit.testresults;
9
10 import org.netbeans.jellytools.nodes.Node;
11 import org.netbeans.jemmy.operators.JPopupMenuOperator;
12 import org.netbeans.junit.NbTestCase;
13 import org.netbeans.junit.NbTestSuite;
14 import org.netbeans.test.junit.utils.ResultWindowOperator;
15 import org.netbeans.test.junit.utils.Utilities;
16
17 /**
18  *
19  * @author max.sauer@sun.com
20  */

21 public class ResultsWindowTest extends NbTestCase {
22     /** path to sample files */
23     private static final String JavaDoc TEST_PACKAGE_PATH =
24             "org.netbeans.test.junit.testresults";
25     
26     /** name of sample package */
27     private static final String JavaDoc TEST_PACKAGE_NAME = TEST_PACKAGE_PATH+".test";
28     
29     /**
30      * Adds tests to suite
31      * @return created suite
32      */

33     public static NbTestSuite suite() {
34         NbTestSuite suite = new NbTestSuite(ResultsWindowTest.class);
35         return suite;
36     }
37     
38     /** Creates a new instance of ResultsWindowTest */
39     public ResultsWindowTest(String JavaDoc testName) {
40         super(testName);
41     }
42     
43     /** Tests visiblility of results window */
44     public void testResultWindowOpened() {
45         //open Test package
46
Node n = Utilities.openFile(Utilities.TEST_PACKAGES_PATH +
47                 "|" + TEST_PACKAGE_NAME + "|" + Utilities.TEST_CLASS_NAME);
48         
49         JPopupMenuOperator jpmo = n.callPopup();
50         jpmo.pushMenu(Utilities.RUN_FILE);
51         Utilities.takeANap(4000);
52         ResultWindowOperator rwo = new ResultWindowOperator();
53         assertTrue("Junit Output window should be visible", rwo.isVisible());
54         rwo.close(); //close it
55
assertFalse("Junit Output window is visible," +
56                 "should be closed", rwo.isShowing());
57     }
58     
59     /**
60      * Test whether filter button inside results window is enabled
61      */

62     public void testFilterButtonEnabled() {
63         Node n = Utilities.openFile(Utilities.TEST_PACKAGES_PATH + "|"
64                 + TEST_PACKAGE_NAME + "|EmptyJUnitTest");
65         JPopupMenuOperator jpmo = n.callPopup();
66         jpmo.pushMenu(Utilities.RUN_FILE);
67         Utilities.takeANap(4000);
68         ResultWindowOperator rwo = new ResultWindowOperator();
69         assertTrue("Filter button should eb enabled",
70                 rwo.isFilterButtonEnabled());
71         
72     }
73     
74     
75     /**
76      * Test functionality of filter button
77      * Runs suite with three tests:
78      * one with both failing and succeeding tests
79      * one with only failing
80      * one with only succeeding
81      * (testresults.test.TestResultsSuite from JunitTestProject)
82      */

83     public void testPressFilterButton() {
84         Utilities.testWholeProject();
85         Utilities.takeANap(4000);
86         ResultWindowOperator rwo = new ResultWindowOperator();
87         rwo.pushFilterButton();
88
89         //TODO: Finish this test
90
}
91     
92     
93 }
94
Popular Tags