Validating a list of values

Example with a static list of values

var countries = new List
{
  "Australia",
  "Canada",
  "France",
  "Germany",
  "United Kingdom",
  "United States"
};

foreach(var country in countries)
{
  SetComment($"{country}"); 

  SetParameter("Country", country); 

  await ExecuteAsync();
}

Example with values from a datasource

// Query the available sales territories from the ERP. The first parameter is the name of the datasource, and the second one is the query.
var salesTerritories = QueryTable("AW ERP", "SELECT TerritoryID, Name FROM Sales.SalesTerritory ORDER BY TerritoryID");

// Loop through the sales-territories.
foreach(DataRow salesTerritory in salesTerritories.Rows)
{
  // Extract ID and Name of the current sales territory.
  var salesTerritoryId = (int)salesTerritory["TerritoryID"];
  var salesTerritoryName = salesTerritory["Name"].ToString();

  // Write a comment to the test-result to show the current sales-territory.
  SetComment($"Sales Territory: {salesTerritoryName} ({salesTerritoryId})");

  // Push sales-territory-parameter to the probe-queries.
  SetParameter("SalesTerritoryId", salesTerritoryId);

  // Execute the test.
  await ExecuteAsync();
}
Table of Contents