Test classes
- Last Updated: January 16, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Whenever you develop or revise a class, you should test it. A common way to test a class is to write a procedure that creates instances of the class and executes every constructor and method, and the destructor. It is useful to keep a record of your test results, typically in a log file. This enables you to compare test results when you modify a class. '
Note: A best practice is to create a separate project for your test procedures that has
the same folder structure as your application.
- Write code to set up the class test.
- Specify a
usingstatement for the class for the test. - Define a variable of the class type.
- Open the output file for writing test results.
- Specify a
- Test the class.
- Create multiple instances of the class, assigning its reference to the variable.
- Make sure every constructor is called.
- Pass a range of values to fully test the constructors.
- Call each method of the class using the reference.
- Pass a range of values to fully test the methods.
- Write relevant data to the output file.
- End the class test
- Delete each instance when you no longer require it.
- Close the output file.