Executing Test Suites

  • Updated

The classes required for Test Suite execution reside in the InRule.Runtime.Testing assembly.

See Executing a Simple Test Suite for a sample

API Documentation


This class handles the RuleSession and RuleServiceConnection generation for each TestDef that is executed.  It handles the construction of a RuleSessionState from either a TestScenario or discrete EntityState Data States.

  • TestingSessionManager() - The constructor of this class requires an instance of an IConnectionFactory implementation.  This ensures that a new RuleServiceConnection is created for each Test execution, and its correct EndPoint overrides are used.
  • CreateTestingSession() - This method takes a Runtime RuleApplicationReference parameter.  If there is only a RuleApplicationDef available, wrap it in an InMemoryRuleApplicationReference instance. It also must be passed a TestDef parameter in order for the DataState mapping retrieval.  There is also an out parameter of rootEntityId.  This is the EntityStateId integer identified from the root context of a TestScenario.


This class is the entry-point for Test execution.  Its constructor must be passed an instance of the TestingSessionManager for RuleSession management, and a valid TestSuiteDef to execute against.  There is an optional constructor overload that also accepts a Runtime RuleApplicationReference instance which can be used if the TestSuiteDef has no ActiveRuleApplicationDef.

  • ExecuteAllTests() - This method will execute all Tests within the Test Suite, returning a collection of Test results.
  • ExecuteTests() - This method will execute Tests based on the overload parameters passed in.  It will execute: A single folder, a list of folders, a list of tests, or a list of folders and tests, returning a collection of Test results. 


This class represents an immutable collection of TestResults.  It can only be created from one of the RegressionTestingSession’s Execute methods.  A list of TestResults can be enumerated from this class.  The SaveAs() and LoadFrom() methods can be used to load and save the TestResults into a zip file.  In addition to the TestResultCollection.xml file stored within the zip file, the TestSuiteDef files and the RuleApplicationDef.xml are also stored.  This will provide an accurate audit trail of which Rule Application was executed against which Test Suite in order to produce the results.

Note: Any instance of this class should be explicitly disposed after use to ensure any temporary files it created are cleaned up.


This class gives an overview of the result of all the Assertions executed in the Test.  The Passed property will only be true if all the AssertionResults in its collection also passed.  Other properties of interest:

  • RuntimeErrorMessage - This property will contain the error messages of any errors generated, or exceptions thrown during rule execution for this Test.  It may also contain errors generated from the Assertion processing after the rule execution has run.
  • RuleExecutionLog - This will be populated with the RuleExecutionLog generated from the ApplyRules() or RuleSet.Execute() when the rules were executed.  Its output is optional based on the Boolean setting stored in the TestSuiteSettingsDef.
  • XmlRuleTrace - This will contain a StringBuilder instance of the XML version of the RuleTrace generated during rule execution.  Its output is optional based on the Boolean setting stored in the TestSuiteSettingsDef, and also if any TraceFrameTypes are specified in the irVerify options.  Currently these options are only accessible from the hidden irVerify options here: InRule.Runtime.Testing.UserSettings.CurrentTesterOptions.TraceFrameTypes.


This class represents the result of each AssertionDef executed in a Test.  The ExpectedValue and ActualValue fields will contain the values in culture-invariant format.  For culture-specific data, use the FormattedExpectedValue and FormattedActualValue properties.

Was this article helpful?

0 out of 0 found this helpful



Please sign in to leave a comment.