开发者

Running Silverlight unit tests in TFS 2010 build

We have some Silverlight unit tests running successfully in VS 2010. I am using the Silverlight unit test framework (http://silverlight.codeplex.com).

For Example:

/// <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 AssertFailedExce开发者_如何转开发ption(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();
            }
        }
    }));
}

When I run this test in VS 2010, a browser window is openend and the test is running successfully. Now I want to run such asynchronous tests with my TFS-2010-Build. But I don´t know how I can start this test with the build. Is this possible?


Yes it's possible. Take a look at the following solution : How to run Silverlight automated tests on TFS build server?

It explain how to combine StatLight(an open source tool used to run Silverlight tests) and a TFS 2010 custom activity to run Silverlight test on continuous integration and notify you when a test fail.


I have found various solutions using generic test wrappers or modifying the workflow to use StatLight, but it all feels like one big hack. I haven't seen any official guidance from the product group either on this which leads me to believe they haven't figured it out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜