我看到很多人在谈论术语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)。 –