Job Search
  |  Blog
  |  Contact
  |  Site Map
  |  Home
  |  

Unit Test succeeds, but Load Test always fails in VSTS 2008

Blog Date: Monday, June 2, 2008 - Discuss below!

Recent Blogs

<< Back

TFS, Team Foundation Server Explorer error on VS 2008 always disconnects 5/20/2008

New Forums and Blogs for Everyone! 5/22/2008

Never pay retail again - from CNN 5/23/2008

 More Blogs...
 

IT Jobs Hiring


Business Intelligence Programmer Analyst North Chicago, IL

.NET Developer - PROVEN, Inc. San Diego, CA

College Students, Recent Grads, Spend Your Summer Here (University of Miami) Miami, FL

More jobs...
 

I have been working with data-driven unit tests in Visual Studio, which are great (see below).

When a unit test is run by itself, a separate application domain is created in the test process for each unit test assembly. There is some overhead associated with marshalling tests and test results across the application domain boundary, so when running unit tests in a load test, the application domain is not created by default.   This provides some performance boost in terms of the number of tests per second that the test process can execute before running out of CPU.   The only drawback is that if the unit test depends on an app.config file, this doesn’t work without creating the app domain.   In this case, you can enable the creation of app domain for the unit tests: in the Load Test editor’s Run Setting’s properties set the property “Run unit tests in application domain” to True.

[DataSource("System.Data.SqlClient",
    "Data Source=(local);Initial Catalog=MY_DATABASE;User ID=testuser;Password=testuser",
    "_Test_Values", DataAccessMethod.Sequential), TestMethod]
public void GetDataDatasourceRunSvc()
{
    MyService target = new MyService();
    RequestContract args = new RequestContract();
    ResponseContract actual = null;
    try
    {
        // Set variables from the datasource
        // **************************************************************
        string correlationID = TestContext.DataRow["CorrelationID"].ToString();
 
        ...
 
        // Run unit test
        // **************************************************************
        actual = target.GetDataList(args, dataAccess);
    }
    catch (System.Exception ex)
    {
        Logging.Instance.Write(LogOutput.Xml, ex);
    }
 
    Assert.AreNotEqual(0, actual.Data.Count);
}

 

 



Monday, June 02, 2008 3:52:12 PM