Asynchronous Tests

Some javascript hosts provide asynchronous execution of certain APIs and sub-structures, such as file I/O operations, and http:// requests. It can be useful to write integration tests against these operations, targeted specifically at each host.

If a fact is marked asynchronous (Fact.Asynchronous=true;), the fact method will be passed a callback delegate, which must be invoked as the Assert phase of the test, e.g. 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); }); }) }