我们在VS 2010中成功运行了一些Silverlight单元测试。我正在使用Silverlight单元测试框架(http://silverlight.codeplex.com)。
例如:
例如:
/// <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();
}
}
}));
}
当我在VS 2010中运行这个测试时,一个浏览器窗口会打开并且测试成功运行。 现在我想使用我的TFS-2010-Build来运行这样的异步测试。但是我不知道如何使用构建开始此测试。这可能吗?