Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I customize the DUnit test case classes generated by the Test Case wizard?

After poking around in the files installed by Delphi, I have found a file

"C:\Program Files\Embarcadero\RAD Studio\7.0\ObjRepos\en\UnitTestFrameworks.xml"

This file has a number of sections for setting options that affect the test case code generated by the test case wizard that gets invoked when you create a new test case unit. Most of these options are self-explanatory but it would be great to see some documentation.

In particular, I'd like to:

  • add a second TestClassComment.

  • have multiple options in the wizard's test case base class combo box. I am able to change the value of the single item in this list by changing the value of the node in the UnitTestFrameworks.xml file but cannot get multiple items to appear in the list.

  • Markup the test class and methods with some attributes.

For the moment I'm only looking at the Delphi Win 32 personality.

Am I on the right track here? Is documentation available or failing that, does anyone have any tips?

like image 617
lukeck Avatar asked Oct 19 '11 03:10

lukeck


1 Answers

I don't think there is any documentation on this. If there is, David Intersimone at Embarcadero is who I'd ask for it.

Failing that, there are two options you might try.

  1. Create some "bare" unit tests with what you want and save them as templates
  2. Write your own wizard in Delphi to create unit tests

The unit tests are only text files, so the second option wouldn't be any harder than trying to hack the wizard. You could create your own unit test wizard in Delphi and hook it into the tools menu quite easily.

If you wanted to, you could have it read your class files to create test skeletons for all of your methods, or create a command line tool to generate them.

like image 50
Catharz Avatar answered Oct 19 '22 07:10

Catharz