我看到很多人在談論術語SUT,但不明白他們爲什麼使用這個術語。什麼是SUT,它從哪裏來的?
SUT是你想測試的嗎?
這個詞來自哪裏?意思是什麼?
例如在這個測試中,我的SUT是什麼?
[TestMethod]
public void UsersAction_should_return_IndexAction()
{
const long id = 1;
UsersViewModel viewModel = new UsersViewModel()
{
SelectedUsers = new long[] { 1, 2, 3, 4 }
};
ActionResult result = _controller.Users(id, viewModel);
result.AssertActionRedirect().ToAction("Index");
}
當然,嘲笑和存根並不是被測系統的一部分。這不是SUT的定義,也不能解釋爲什麼這個術語甚至存在。正確的定義由xUnit Test Patterns提供,你可以在這裏找到(http://xunitpatterns.com/SUT.html)。 –