|
1 How to create regression tests for JavaBeans |
|
2 ============================================ |
|
3 |
|
4 All regression tests are developed to run under JavaTest 3.2.2. |
|
5 |
|
6 |
|
7 |
|
8 TEST HIERARCHY |
|
9 -------------- |
|
10 |
|
11 You should choose an appropriate folder from the following list: |
|
12 - The Beans folder contains tests for the java.beans.Beans class |
|
13 - The EventHandler folder contains tests for the java.beans.EventHandler class |
|
14 - The Introspector folder contains tests for introspection |
|
15 - The PropertyChangeSupport folder contains tests for the bound properties |
|
16 - The VetoableChangeSupport folder contains tests for the constrained properties |
|
17 - The PropertyEditor folder contains tests for all property editors |
|
18 - The Statement folder contains tests for statements and expressions |
|
19 - The XMLDecoder folder contains tests for XMLDecoder |
|
20 - The XMLEncoder folder contains tests for XMLEncoder |
|
21 - The Performance folder contains manual tests for performance |
|
22 - The beancontext folder contains tests for classes |
|
23 from the java.beans.beancontext package |
|
24 |
|
25 |
|
26 |
|
27 NAME CONVENTIONS FOR TEST CLASSES |
|
28 --------------------------------- |
|
29 |
|
30 Usually a class name should start with the "Test" word |
|
31 followed by 7-digit CR number. For example: |
|
32 Beans/Test4067824.java |
|
33 |
|
34 If your test contains additional files you should create |
|
35 a subfolder with the CR number as its name. For example: |
|
36 Introspector/4168475/Test4168475.java |
|
37 Introspector/4168475/infos/ComponentBeanInfo.java |
|
38 |
|
39 If you have several tests for the same CR number you should also |
|
40 create a subfolder with the CR number as its name. For example: |
|
41 XMLEncoder/4741757/AbstractTest.java |
|
42 XMLEncoder/4741757/TestFieldAccess.java |
|
43 XMLEncoder/4741757/TestSecurityManager.java |
|
44 XMLEncoder/4741757/TestStackOverflow.java |
|
45 |
|
46 Every JAR file should contain source files for all class files. For example: |
|
47 XMLDecoder/4676532/test.jar#test/Test.class |
|
48 XMLDecoder/4676532/test.jar#test/Test.java |
|
49 |
|
50 |
|
51 |
|
52 USEFUL UTILITY CLASSES |
|
53 ---------------------- |
|
54 |
|
55 For Introspector tests you can use the BeanUtils class. |
|
56 This class provides helpful methods to get |
|
57 property descriptors for the specified type. |
|
58 |
|
59 |
|
60 For XMLEncoder tests you can use the AbstractTest class. |
|
61 This class is intended to simplify tests creating. |
|
62 It contains methods to encode an object to XML, |
|
63 decode XML and validate the result. |
|
64 The validate() method is applied to compare |
|
65 the object before encoding with the object after decoding. |
|
66 If the test fails the Error is thrown. |
|
67 1) The getObject() method should be implemented |
|
68 to return the object to test. |
|
69 This object will be encoded and decoded |
|
70 and the object creation will be tested. |
|
71 2) The getAnotherObject() method can be overridden |
|
72 to return a different object to test. |
|
73 If this object is not null it will be encoded and decoded. |
|
74 Also the object updating will be tested in this case. |
|
75 The test() method has a boolean parameter, |
|
76 which indicates that the test should be started in secure context. |