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