Automatic Component Tests for Delphi VCL Applications

The OpenCTF component test framework helps to build automatic tests for all (visual and non-visual) VCL components in a Delphi application. It is based on the DUnit framework.

How does it work?

  • OpenCTF iterates over the Forms and DataModules and dynamically creates test cases for the components
  • Customized test classes detect which components have to be tested, and configure the test steps

OpenCTF screenshot

How can it help me?

OpenCTF provides an easy way to build automatic quality checks for large projects where many components have to pass repeated tests.

Here are some examples:

  • detect missing or wrong property values – e.g. Buttons without assigned Actions, DataSources without associated DataSet
  • detect unassigned event handlers – e.g. missing OnExecute event
  • check that all DataSets can be opened
  • check the tab order
  • find invisible components (e.g. invisible TabSheets which better should be hidden at runtime)

Is it easy to use?

Creating and customizing tests for your specific needs is very easy:

  • Adding OpenCTF tests to a DUnit test suite requires only one or two lines of code
  • Writing your own custom component tests is simple, many examples are included in the source distribution

Hosted on Sourceforge

Source example

program OneFormTest;
{$APPTYPE CONSOLE}
uses
  OpenCTF,
  OpenCTFRunner,
  ctfTestActnList,
  ctfTestControls,
  ctfTestMenus,
  TestForm in 'TestForm.pas' {Form1};
begin
  // Register Form classes
  OpenCTF.RegisterFormClasses([TForm1]);
  // run the tests
  OpenCTFRunner.Run;
end.
Advertisements

One thought on “Automatic Component Tests for Delphi VCL Applications

  1. Pingback: Some links to Delphi Unit Testing history « The Wiert Corner – irregular stream of stuff

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s