Data-Driven Tests

Tests can be parameterized and executed multiple times with different sets of data, by setting Fact.Data to an array of values.

Each value will be passed into the fact method as an argument, e.g.: function FactoryStrategiesReturnCorrectTargets(data){ // Arrange var expected=data.value; var target=new data.targetClass(); // Act var actual=target.create(); // Assert Assert.Equal(expected, actual); }

If a test with data is marked asynchronous, the asynchronous callback will be passed in as the first argument, and the data argument will be passed in second: function SetsPageTitle(callback,data){ // Arrange var expected=data.title; var target=data.url; // Act page.load(target, function(pageObject){ callback(function(){ var actual=pageObject.title; // Assert Assert.Equal(expected, actual); }); }) }