I am new to NUnit and confused with the SpecFlow Testing Framework and NUnit Testing Framework.
The existing project uses NUnit, something like this below. All the methods with [Test] attribute are displayed in the NUnit GUI (if I remove [Test] from the method, the test case is not display in NUnit GUI):
[TestFixture]
public class AccountTest
{
[Test]
public void TransferFunds()
{
Account source = new Account();
source.Deposit(200m);
}
[Test]
public void TransferWithInsufficientFunds()
{
}
}
When I code with SpecFlow in the same project, the SpecFlow framework is different, starting with [Given], [When], [Then]. And each SpecFlow scenario is displayed at the Nunit GUI.
What I am doing is replacing each [Test] method with one SpecFlow method. E.g.:
[Test]
public void TransferFunds()
{
Account source = new Account();
source.Deposit(200m);
}
Turns to
[Then(@"I Transfer Funds")]
public void ITransferFunds()
{
Account source = new Account();
source.Deposit(200m);
}
Here is my question:
It looks like SpecFlow does not recognize the NUnit attributes [Test] or [Setup]. To do the project with SpecFlow, do I need to get rid of all NUnit framework and replace with SpecFlow's framework?
I can see there is many articles talking about "SpecFlow + NUnit", but they are either with SpecFlow [Given], [When], [Then] or NUnit [Test], [TestCase]. How to make both work in one project or is my understanding of NUnit is totally wrong?
My question might be very entry level, thanks for the answers!