1How to create regression tests for JavaBeans 2============================================ 3 4All regression tests are developed to run under JavaTest 3.2.2. 5 6 7 8TEST HIERARCHY 9-------------- 10 11You 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 27NAME CONVENTIONS FOR TEST CLASSES 28--------------------------------- 29 30Usually a class name should start with the "Test" word 31followed by 7-digit CR number. For example: 32 Beans/Test4067824.java 33 34If your test contains additional files you should create 35a subfolder with the CR number as its name. For example: 36 Introspector/4168475/Test4168475.java 37 Introspector/4168475/infos/ComponentBeanInfo.java 38 39If you have several tests for the same CR number you should also 40create 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 46Every 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 52USEFUL UTILITY CLASSES 53---------------------- 54 55For Introspector tests you can use the BeanUtils class. 56This class provides helpful methods to get 57property descriptors for the specified type. 58 59 60For XMLEncoder tests you can use the AbstractTest class. 61This class is intended to simplify tests creating. 62It contains methods to encode an object to XML, 63decode XML and validate the result. 64The validate() method is applied to compare 65the object before encoding with the object after decoding. 66If the test fails the Error is thrown. 671) 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. 712) 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. 75The test() method has a boolean parameter, 76which indicates that the test should be started in secure context. 77