Views:

Overview

This article will detail how to trigger a North52 Test Runner remotely. This article will focus on PowerShell, but you can use the method to trigger it from C# or other techniques as required.

In this article it is assumed that you have installed North52 already and have a license for TestShield.

Basic Steps

The North52 Configuration record has 2 fields called: 

  1. Command
  2. Command Parameter

The Command field allows you to select from a variety of different North52 options, but in this instance we are interested in the Start Test Runner command. In order to execute a Test Runner you need to know it's name. 

In the below example I am attempting to start a North52 Test Runner with the name Demo Calculator Tests - Sync and Async.

 

PowerShell example

1. Retrieve the North52 Configuration Record

Once you have established a connection to your environment from PowerShell you will need to first retrieve the North52 Configuration record's GUID using something like the below code:

$n52config_qry = New-Object Microsoft.Xrm.Sdk.Query.QueryExpression("north52_configuration")

$n52config_qry.ColumnSet = New-Object Microsoft.Xrm.Sdk.Query.ColumnSet("north52_name", "north52_configurationid", "north52_fm_licensekey", "north52_configurationname", "north52_command", "statecode", "statuscode")

$n52config_qry.AddOrder("north52_name", [Microsoft.Xrm.Sdk.Query.OrderType]::Ascending);

$n52config_response = $conn.RetrieveMultiple($n52config_qry)

 

2. Retrieve the Guid of the Test Runner based on its name

Next we retrieve the GUID of the Test Runner based on its name

$n52testrunner_qry = New-Object Microsoft.Xrm.Sdk.Query.QueryExpression("north52_testrunner");

$n52testrunner_qry.ColumnSet = New-Object Microsoft.Xrm.Sdk.Query.ColumnSet("north52_name");

$n52testrunner_qry.AddOrder("north52_name", [Microsoft.Xrm.Sdk.Query.OrderType]::Ascending);

$n52testrunner_qry.Criteria.AddCondition("north52_name", [Microsoft.Xrm.Sdk.Query.ConditionOperator]::Equal, $testrunnername);

$n52testrunner_response = $conn.RetrieveMultiple($n52testrunner_qry);

$testrunnerid = $n52testrunner_response.Entities[0].id;

 

3. Execute Test Runner

Finally we update the North52 Configuration Record to execute the Test Runner

$n52configupdate = New-Object Microsoft.Xrm.Sdk.Entity("north52_configuration");

$n52configupdate.Id = $n52configid;$n52configupdate.Attributes["north52_command"] = [Microsoft.Xrm.Sdk.OptionSetValue]217890032;

$n52configupdate.Attributes["north52_commandparameter"] = "{$testrunnerid}|10000|5";

$conn.Update($n52configupdate)

 

When the update to the North52 Configuration record completes the Test Runner will be triggered and begin executing.