Creating Custom Functional Test Validations

By default WcfStorm does a field-by-field comparison of the actual and expected response of a functional test case. This behavior is appropriate for a large number of scenarios. However, in some cases however, you might want to have control the validation process. For example, let's say you have a WCF service that returns a GUID parameter which is generated everytime the method is invoked. If you've created a test case for this method, then the test case would always "fail" because the GUID in the expected response will never match the one coming from the actual response. Having full control on the validation process makes sense for such a scenario.

Controlling the validation process in WCFStorm is accomplished by creating a validation plugin that implements IFunctionalTestValidator. Below is the signature of IFuntionalTestValidator

PluginLoggingHandler LogMsg : This event is used for printing log messages to the log window of WCFStorm. There are 5 types of log messages (as shown in the enum PluginLogType). Each log type corresponds to a different color, Error = red, Success = blue, Info =black etc.)

boolOverrideDefaultValidation :
This property is used to indicate that the plugin will override (set to True) or supplement (set to False) the validation.

When the default validation is overriden, field-by-field matching will not be done and the status of the test case depends entirely on the custom validation(s). If set to false, the default validation will be executed together with all custom validations

Steps to create a custom validation plugin

Let's say we have the simple WCF service below and we'd like to write custom validations for the method "GetDataUsingDataContract". We'd like to validate that comp.StringValue is a concatenation of the stringValue and booleanValue input paramaters. For this, we'll create a custom validation.