类是否有等效的TestPropertyAttribute可用?我想用一个属性标记一堆测试,而不必标记每个测试。
提前致谢。
Unfortunately there is none. We don't have a TestProperty equivalent at the class level.
刚刚发现这个使用了TestProperty类,在初始化时用来设置一个类成员。它设置了一个默认值,你用不同的设置标记测试[TestProperty("thing", "non-default")]
[ClassInitialize()]
public void InitializeClass(TestContext testContext)
{
// Changed by the [TestProperty("thing", "non-default")]
if (TestContext.Properties.Contains("thing"))
_thing = TestContext.Properties["thing"] as string;
else
_thing = "default";
}
进一步的解释在这里。