我有一些爲MsTest編寫的集成測試。集成測試具有以下結構:通過在OpenCover中調用函數來過濾代碼覆蓋率
[TestClass]
public class When_Doing_Some_Stuff
{
[TestInitialize]
protected override void TestInitialize()
{
// create the Integration Test Context
EstablishContext();
// trigger the Integration Test
When();
}
protected void EstablishContext()
{
// call services to set up context
}
protected override void When()
{
// call service method to be tested
}
[TestMethod]
public void Then_Result_Is_Correct()
{
// assert against the result
}
}
我需要誰喊它來過濾函數的代碼覆蓋率結果。也就是說,我希望只有在函數是從名爲「When」的函數調用的函數或應用了某個特定屬性的函數時纔會考慮覆蓋率。
現在,即使在系統中某方法被調用在一些測試中的EstablishContext部分,該方法爲訪問標記。
我相信是有這個沒有過濾器,我想作出改變自己,因爲OpenCover是...好..開放。但我真的不知道從哪裏開始。任何人都可以將我指向正確的方向嗎?
你決定實現這個功能嗎? – 2012-01-06 00:30:09