Custom commands and conditions
It’s possible to develop your own conditions or commands in C#. To achieve this, you’ll need to create a C# library project and compile it as a library. At least one of the classes of your project should implement the interface ICustomCondition or ICustomCommand from the namespace NBi.Extensibility.Decoration and available in the nuget package NBi.Extensibility.
Development of custom extensions
This interface declares one method Execute() returning void.
The following custom condition, create a directory named temp:
This interface declares one method Execute() returning the result of the condition. The property IsValid is a boolean describing if the condition is successful (true) or not (false). The message is a string that will be displayed to explain why the condition is not met.
The following custom condition, returns true if the day of month is even, else returns false:
Referencing custom extensions
Once the custom condition is coded and built, you need to deploy the dll somewhere that your test-suite will be able to reach. In your test-suite your must reference the assembly by the mean of the xml attribute assembly-path and then specify the type implementing the ICustomCondition or ICustomCommand interface. Several types implementing this interface can sharethe same dll.
A set of parameters can also be defined. They will used during the construction of the object and the name of the parameters must match with the name of the constructor’s attribute.
All the attributes and the parameters’ value, enlisted above, accept literal values, and variables including formatting and inline transformations. at the exception of the parameter’s name which must be a literal value.