Asynchronous Tests

Some engine hosts (nodejs, phantomjs) provide asynchronous functionality, for performing tasks such as loading files or making web requests. While these types of boundary-crossing events are not appropriate for proper unit tests, they can be useful for targeted integration and smoke tests.

To indicate that a test requires asynchronous functionality, use the Async attribute. This is equivalent to specifying Fact.Asynchronous=true; e.g.: [Async] function SetsPageTitle(callback){ // Arrange var expected="My Page Title"; var target=""; // Act page.load(target, function(pageObject){ callback(function(){ var actual=pageObject.title; // Assert Assert.Equal(expected, actual); }); }) }

For more information, see the Asynchronous Tests page in the Engine section.