End the test
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
When you finish testing or if you want to test a different constructor, you should first delete the instance using the following syntax:
delete object <instance name>.
Here is all the code for our example test procedure for the Emp class. Notice at the bottom of the file that we delete EmpInstance and close the output file.
block-level on error undo, throw.
using Enterprise.HR.Emp.
// define the variable for holding the Emp instance
define variable EmpInstance as Emp no-undo.
// define the variable for holding the phone numbers extent
define variable Phones as character extent 3 no-undo.
// set up the file for writing data
output to "/testResults/log/test-Dept.out".
// create an initialize an Emp instance
EmpInsatnce = new Emp ().
assign Phones[1] = "617-284-5937"
Phones[2] = "508-394-3928"
Phones[3] = "508-294-3927".
Emp:Initialize(99,
"John",
"Doe",
"123 Main Street",
"01730",
Phones,
50,
"Senior Developer").
Message "*********testInitialize()************" skip.
EmpInstance:FirstName " "
EmpInstance:LastName " , "
EmpInstance:JobTitle skip
"Emp # " EmpInstance:EmpNum "- Vacation hours: "
EmpInstance:VacationHours skip
EmpInstance:Address " "
EmpInstance:PostalCode skip
"Phones: " EmpInstance:Phones[1] " "
EmpInstance:Phones[2] "" EmpInstance:Phones[3] " " .
delete object EmpInstance.
output close.