Share via


Known-Issues and workarounds for Orcas (Beta1): Inheritance

Issue #1: Inheritance of Test Classes is not supported when the base class is in a different assembly

Workaround
Place all the classes which will use inheritance in the same test project so that they end up in the same assembly.

Issue #2: No inheritance for Test Class Attributes [ ClassInitialize ] and [ ClassCleanup ]

Instructions

Add ClassInitialize and ClassCleanup methods to the derived class, and call the base classes implementation.

Here's some sample code. In the base class, you have:

[TestClass]

public class MyBase

{

[ClassInitialize]

public static void BaseClassInit(TestContext testContext)

{

//do something

}

}

From derived class:

[TestClass]

public class MyDerived

{

[ClassInitialize]

public static void DerivedClassInit(TestContext testContext)

{

MyBase.BaseClassInit(testContext);

}

}

 

Hope this is helpful,

David Gorena Elizondo

[MSFT] VSTT

Comments

  • Anonymous
    May 27, 2007
    雖然 Orcas beta1 並沒有中文版, 英文版在這個月初已經可以 download 了, 我相信應該已經開始有人 playing this beta, 所以分享一些 quality tools teams

  • Anonymous
    July 19, 2007
    雖然 Orcas beta1 並沒有中文版, 英文版在這個月初已經可以 download 了, 我相信應該已經開始有人 playing this beta, 所以分享一些 quality tools teams