![](/img/trans.png)
[英]TestInitialize and TestCleanup not running before and after each DataRow of a DataTestMethod
[英]MSTest - Can [DataRow] values be accessed in TestInitialize and TestCleanup?
我有這樣的測試:
[DataTestMethod]
[DataRow("example1")]
[DataRow("example2")]
public void Test_Example(string name)
{
// test logic
}
我們的日志記錄系統目前在基礎[TestClass]
中的單個[TestCleanup]
方法中實現。
我可以通過TestContext
屬性訪問測試方法的名稱,但不包括有關datarow參數的任何信息。
是否有可能以某種方式獲得這些價值? 在[TestCleanup]
或[TestInitialize]
會很好。
您是否查看了TestContext對象上的DataRow屬性? 這可能就是你所追求的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.