Link to home
Start Free TrialLog in
Avatar of IzzyTwinkly
IzzyTwinklyFlag for United States of America

asked on

Simple NUnit test doesn't run

Hi,

I am following this simple NUnit example, but it give me an error when I run it. "A project with an Output Type of Class Library cannot be started directly."
User generated image
In the example, I created 2 projects(both are Class Library type) with a class on each project. The structure of the solution and project references look like this.
User generated image
And this is the code I have for TellerTests.cs
User generated image
It seems that I need a normal class that has a Main method. But I am not sure, the author brought up this screen. I don't know how.
User generated image
I am using Visual Studio 2012 Ultimate version.

Thanks
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Try setting the start up project to be BankManager.Test and not BankManager.
Are you using F5 to try and run your tests? If so, you shouldn't be. NUnit should have a menu option to start tests. You shouldn't need to actually start your application in order to be able run your unit tests.
Avatar of IzzyTwinkly

ASKER

Hi Kaufmed, I am using Visual Studio2012 and where can I find that Nunit menu?

Hi Fremando, I made BankManager.Test as a start up project, but nothing happened. Should I create BankManger.Test project, should I create this as "Coded UI Test Project" or "Unit TestProject"? However, the author clearly said to create it as class library. =(
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That was it! I had to install "Visual Studio Test Adapter". In my case, Test Explorer itself was there, but the test method wasn't appeared under Test Explorer. Now it appears after I installed "Visual Studio Test Adapter".
Thank you so much! I just passed my first unit test!!!