我們在VS 2010中成功運行了一些Silverlight單元測試。 我正在使用Silverlight單元測試框架(http://silverlight.codeplex.com)。在TFS 2010中運行Silverlight單元測試版本
例如:
/// <summary>
/// test the loading of the big org strucutre from the server
/// this operation has a timeout attached.
/// </summary>
[TestMethod]
[Asynchronous]
[TimeoutAttribute(60100)]
public void LoadOrgStructure()
{
_loadOrgStructureStart = getCurrentTicks();
OrgStructureMemberDAC.Instance.GetOrganisationStructure(new EventHandler<GetOrganisationStructureOrgStructureMemberVOCompletedEventArgs>(delegate(object s, GetOrganisationStructureOrgStructureMemberVOCompletedEventArgs e)
{
//only run the following code in time
if (getElapsedMilliseconds(_loadOrgStructureStart) <= 60000)
{
if (e.Error != null)
{
//Clientside error
throw e.Error;
}
else if (e.Result.Error != null)
{
//Serverside error
throw new AssertFailedException(e.Result.Error.Message);
}
else
{
Assert.IsNotNull(e.Result.Result); // there must be root elements
Assert.IsTrue(e.Result.Result.Count > 0);
Assert.IsNotNull(e.Result.Result[0].ChildMemberLstObj); //there must be childs
Assert.IsTrue(e.Result.Result[0].ChildMemberLstObj.Count > 0);
EnqueueTestComplete();
}
}
}));
}
當我在2010年VS運行該測試中,瀏覽器窗口中雙頭呆和測試成功運行。 現在我想用我的TFS-2010-Build運行這樣的異步測試。但是我不知道如何通過構建來開始這個測試。這可能嗎?