Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for naming unit and integration test methods?

I've recently inherited an application that is written by different people at different times and looking for guidance on how to standardize.

like image 449
HDave Avatar asked May 18 '10 20:05

HDave


1 Answers

Assuming NUnit:

[Test]
public void ObjectUnderTest_StateChanged_Consequence()
{
    Assert.That(tra_la_la);
}

[Test]
public void ObjectUnderTest_Behaviour_Consequence()
{
    Assert.That(tra_la_la);
}

for example:

[Test]
public void WifeIsTired_TakeWifeToDinner_WifeIsGrateful()
{
    Assert.That(tra_la_la);
}

[Test]
public void WifeIsTired_MentionNewGirlfriend_WifeGetsHalf()
{
    Assert.That(tra_la_la);
}
like image 91
Duncan Avatar answered Oct 02 '22 15:10

Duncan