Oct
12
Written by:
QCTO Blog
Monday, October 12, 2009
The major focus for 1.9 to date has been to add support for automated testing of object type methods. This beta release offers the first glimpse of this functionality; you should now be able to define tests for constructors, static methods, and member procedures and functions.
You should also very much expect to encounter bugs, as this feature involves substantial changes to Test Builder, Test Editor and the test code generator.
So if you want to test object type methods, please install and try out this beta version.
DO NOT, HOWEVER, USE THIS VERSION IN PLACE OF YOUR PRODUCTION INSTALLATION OF CODE TESTER. IT IS NOT YET STABLE ENOUGH.
We have not yet updated the Help document for 1.9. You will find below some high very high level guidance on how to use these new features. We very much want and need your feedback on how we have implemented object type support. User feedback has already caused us to consider changes in the UI design.
Many thanks for your interest and support!
Steven Feuerstein
PRELIMINARY HELP FOR OBJECT TYPE SUPPORT
There are three main areas of enhancement:
- Test methods of an object type
- Specify values for attributes of object type parameters
- Testing the contents of an object type
You will find brief descriptions of each of these areas below.
Test methods of an object type.
A method is a procedure or function defined in an object type specification. A method can be static, a constructor, or a member (which uses SELF either implicitly or explicitly in its parameter list). Then there are specialized members, such as MAP and ORDER.
When you ask to create a New Test, you will now see object types listed, in addition to packages, procedures and functions. When you pick an object type, all the methods of that type will appear in the drop down at the top of Test Builder. You then pick the method and start defining your tests.
In other words, it works just the same as testing subprograms of packages - but of course there are some differences.
If you are testing a member method, then all the attributes of the type are presented as inputs and possibly outcomes as well (if SELF is IN only, they will not be available as outcomes).
If you are testing a constructor, then we do not show you the attributes, only the parameters.
Specify values for attributes of object type parameters
Prior to 1.9, if you had a parameter or return of object type, then you could only provide initialization and cleanup code for the input, and then write your own custom code to test the contents of the type. No longer!
Now, if your input or outcome is an object type, you can open the Properties Window for that type and you will see a grid of attributes. You can then assign values to each attribute.
Here are the current limitations on this implementation (and they will remain in place unless we hear loud and widespread complaints):
- You cannot specify multiple values (random value generation, lists, queries) for attributes.
- If an attribute of the OT is itself a complex type (another OT, a nested table, a varray), then you can only provide initialization and cleanup code to populate that attribute. In other words, the grid of attributes is only supplied for the top level of attributes.
Testing the contents of an object type
You can now perform equality checks for an object type. That is, does the object type returned by the program match an expected object type?
If you have a MAP or ORDER method defined for the object type, this is *always* used to do the comparison.
If you do not have a MAP or ORDER method defined for the object type, Code Tester generates an equality comparison function that compares for equality each attribute whose type allows such a comparison. That is, nested object types, varrays, XMLtype attributes will all be ignored.