0N/AHow to create regression tests for JavaBeans
0N/A============================================
0N/A
0N/AAll regression tests are developed to run under JavaTest 3.2.2.
0N/A
0N/A
0N/A
0N/ATEST HIERARCHY
0N/A--------------
0N/A
0N/AYou should choose an appropriate folder from the following list:
0N/A - The Beans folder contains tests for the java.beans.Beans class
0N/A - The EventHandler folder contains tests for the java.beans.EventHandler class
0N/A - The Introspector folder contains tests for introspection
0N/A - The PropertyChangeSupport folder contains tests for the bound properties
0N/A - The VetoableChangeSupport folder contains tests for the constrained properties
0N/A - The PropertyEditor folder contains tests for all property editors
0N/A - The Statement folder contains tests for statements and expressions
0N/A - The XMLDecoder folder contains tests for XMLDecoder
0N/A - The XMLEncoder folder contains tests for XMLEncoder
0N/A - The Performance folder contains manual tests for performance
0N/A - The beancontext folder contains tests for classes
0N/A from the java.beans.beancontext package
0N/A
0N/A
0N/A
0N/ANAME CONVENTIONS FOR TEST CLASSES
0N/A---------------------------------
0N/A
0N/AUsually a class name should start with the "Test" word
0N/Afollowed by 7-digit CR number. For example:
0N/A Beans/Test4067824.java
0N/A
0N/AIf your test contains additional files you should create
0N/Aa subfolder with the CR number as its name. For example:
0N/A Introspector/4168475/Test4168475.java
0N/A Introspector/4168475/infos/ComponentBeanInfo.java
0N/A
0N/AIf you have several tests for the same CR number you should also
0N/Acreate a subfolder with the CR number as its name. For example:
0N/A XMLEncoder/4741757/AbstractTest.java
0N/A XMLEncoder/4741757/TestFieldAccess.java
0N/A XMLEncoder/4741757/TestSecurityManager.java
0N/A XMLEncoder/4741757/TestStackOverflow.java
0N/A
0N/AEvery JAR file should contain source files for all class files. For example:
0N/A XMLDecoder/4676532/test.jar#test/Test.class
0N/A XMLDecoder/4676532/test.jar#test/Test.java
0N/A
0N/A
0N/A
0N/AUSEFUL UTILITY CLASSES
0N/A----------------------
0N/A
0N/AFor Introspector tests you can use the BeanUtils class.
0N/AThis class provides helpful methods to get
0N/Aproperty descriptors for the specified type.
0N/A
0N/A
0N/AFor XMLEncoder tests you can use the AbstractTest class.
0N/AThis class is intended to simplify tests creating.
0N/AIt contains methods to encode an object to XML,
0N/Adecode XML and validate the result.
0N/AThe validate() method is applied to compare
0N/Athe object before encoding with the object after decoding.
0N/AIf the test fails the Error is thrown.
0N/A1) The getObject() method should be implemented
0N/A to return the object to test.
0N/A This object will be encoded and decoded
0N/A and the object creation will be tested.
0N/A2) The getAnotherObject() method can be overridden
0N/A to return a different object to test.
0N/A If this object is not null it will be encoded and decoded.
0N/A Also the object updating will be tested in this case.
0N/AThe test() method has a boolean parameter,
0N/Awhich indicates that the test should be started in secure context.