A test handler for a given type of components.
More...
|
| TComponent | Form |
| | The form or datamodule which will be tested. More...
|
| |
A test handler for a given type of components.
- The method TComponentHandler::Accepts controls which components will be tested, it can be overriden to change the default behaviour.
◆ TComponentHandler() [1/2]
| TComponentHandler::TComponentHandler |
( |
const TClass |
ComponentClass, |
|
|
const string |
Suitename = '' |
|
) |
| |
Creates a handler instance.
This constructor will create a handler instance which will by default generate a test for every component in the form (or datamodule) which is a subtype of the given component class.
- Parameters
-
| ComponentClass | the component class which will be accepted (and tested). |
| Suitename | optional test suite name |
◆ TComponentHandler() [2/2]
| TComponentHandler::TComponentHandler |
( |
| ) |
|
Creates a handler instance.
This constructor will create a handler instance which will by default generate a test for every component in the form (or datamodule) which is a subtype of TComponent.
◆ Accepts()
| Boolean TComponentHandler::Accepts |
( |
const TComponent |
Component | ) |
|
|
protected |
This methods decides if the passed component should be included in the test suite.
The default implementation checks if the component class is a subclass of the handled class. This method may be overriden to add more filter conditions.
- Parameters
-
| Component | the component to be checked |
Referenced by GetSuite().
◆ AddFormTests()
| TComponentHandler::AddFormTests |
( |
| ) |
|
|
protected |
Adds tests for the form to the test suite.
- To add tests for the form, overwrite the empty default declaration of this method.
Referenced by GetSuite().
◆ AddTest()
| TComponentHandler::AddTest |
( |
const ITest |
Test | ) |
|
|
protected |
this method is a shortcut for CurrentSuite.AddTest(...));
- Parameters
-
| Test | the test that will be added to the CurrentSuite |
◆ AddTests()
| TComponentHandler::AddTests |
( |
| ) |
|
|
protected |
Adds all component tests for the component to the test suite.
- If you write a new component handler, you have to provide an implementation of this method.
Example:
procedure TMenuItemHandler.AddTests;
begin
inherited;
CurrentSuite.AddTest(TMenuItemTest.Create(CurrentComponent));
end;
Referenced by GetSuite().
◆ CheckEvents()
| TComponentHandler::CheckEvents |
( |
const string * |
Events | ) |
|
|
protected |
Checks for assigned event handlers.
procedure TCustomClientDataSetTestHandler.AddTests(const SubComponent: TComponent);
begin
inherited;
end;
◆ CheckProperties()
| TComponentHandler::CheckProperties |
( |
const string * |
Properties | ) |
|
|
protected |
Checks for assigned properties.
procedure TDbAwareComponentTestHandler.AddTests(const
SubComponent: TComponent);
begin
end;
◆ CheckUnassignedEvents()
| TComponentHandler::CheckUnassignedEvents |
( |
const string * |
Events | ) |
|
|
protected |
Checks for unassigned event handlers.
- See also
- CheckEvents
◆ CheckUnassignedProperties()
| TComponentHandler::CheckUnassignedProperties |
( |
const string * |
Properties | ) |
|
|
protected |
◆ Exclude()
Exclude a component class from tests Example:
OpenCTF.Add((TComponentNameTests.Create)
.Exclude(TLabel)
.Exclude(TFrame)
.Exclude(TPanel)
);
- Parameters
-
| ExcludedClass | the class to be excluded from tests |
◆ Handles()
| Boolean TComponentHandler::Handles |
( |
const TComponent |
Form | ) |
|
|
protected |
Form filter method.
This method decides if the handler will generate test cases for the given form.
The default implementation always returns True.
If you write a component handler, you can overwrite this method to allow only special form classes to be processed.
For example, a component handler for visual components can overwrite this method and check if the passed parameter is a subclass of TCustomForm:
Result :=
Form is TCustomForm;
- Parameters
-
| Form | The form (or datamodule) to be tested. |
◆ Form
The form or datamodule which will be tested.
- See also
- GetForm For reading
-
SetForm For writing
Referenced by GetSuite().