I have an existing asp.net web application that I'm updating to include some MVC pages. I have successfully upgraded the web app to recognize my MVC controllers/views/... I can even get my test page to display correctly: hooray!
However, I am having trouble figuring out how to add a test project so that I can add my unit tests for the new pages. Does anyone have a suggestion on how to achieve this goal?
If you are using MSTest right click on the solution and Add -> New Project.... Select Test Project type. In the newly created project reference the project containing the controllers and start adding unit tests.
If you are using some 3rd party unit testing framework such as NUnit you could add a project of type Class Library and then add the unit tests to this class library.
Related
I'm currently looking at using SpecFlow in conjunction with Xamarin Studio for writing BDD tests for cross-platform mobile apps.
I've been using the Xamarin Studio add-in developed here https://github.com/mikeyjones/SpecFlow to integrate SpecFlow into the IDE.
What I need to be able to do is add some extra steps into the process when a new feature file is created, namely to create a new file to hold additional code I need in the feature class.
So I would end up with,
NewFeature.feature
NewFeature.feature.cs (code-behind defining partial class)
NewFeature.cs (where I add additional code to the partial class)
I also need to be able to add some additional code to the template that creates the step definitions for the feature.
The above repo contains the code that is currently producing the new files but I'm struggling to understand how this works in order to figure out how to integrate with it to add my own additions.
Can anyone point me in the right direction to achieve this?
I am working on custom multi solution project structure having
1. 4 class library projects
2. One MVC 4 Web application.
I have built multi solution structure into VSIX package.Till here everything is fine.
Upon VSIX installation,I can see my multi solution project type in Visual studio 2012 projects.
When I try to create on out of it, it will display a following error while creating for every images present in "\Content\themes\base\images" in MVC 4 application
"The file ui-bg_flat_75_ffffff_40x100.png could not be found within the project templates.Continuing to run, but resulting project may not be build properly"
Although I have all the images as a apart of WEb Project templates.
Any suggestions
Verify that the images within the project template have Build Action set to Content and Include in VSIX set to True. Also, verify in your vstemplate file that the image is included as a ProjectItem and within the proper folder.
Or, if you have JQuery UI included as a Nuget package you can just install the package as a part of your template. Then, you don't even need to include the images with your vsix. http://docs.nuget.org/docs/reference/packages-in-visual-studio-templates
I am working on a HUGE vs2003 website. Is there a quick snippet tool that i could use to connect to my dev database and test out different pieces of my code instead of running website over and over again??
Well, just because you're building a web site doesn't mean that all your code has to be in a web site project. You can create a class library which your web site depends on, and then maybe a console app to make calls to that class library for test purposes.
Ideally, however, you'd have unit tests instead of ad hoc testing. You could create those unit tests with NUnit or various other test frameworks. (Using .NET 1.1 will limit which versions of those test frameworks you can use, admittedly.)
When creating a new MVC Project in VS2008 Professional (SP1 installed), I do not get prompted for a Unit Test project.
I have searched and found this solution (Creating new ASP.Net MVC project - Unit Test Dialog does not show up) BUT I have already installed the Testing Tools and still no Unit Test dialogue appears.
Any ideas?
I ended up formatting my pc, reinstalling Windows 7 and VS08 SP1 and MVC
Ultimately, the unit test project that is automagically added is just a class library project with the proper references added. Instead of worrying why the dialog doesn't pop up, add a class library project to your solution that references your testing framework. You'll end up with the results you want.
I am using Visual Web Developer 2008 Express with ASP.NET MVC 1.0.
I would like to use MbUnit as a test framework so how would I set this up as a unit test project for an ASP.NET MVC web application?
File -> New -> Project -> Windows -> Class Library
Add a reference to MbUnit.dll (or whatever the name of their library is)
Add a reference to your ASP.NET MVC project
Add a new class file and your test code
The only problem you'll run into now is running the tests. For that you might try something like TestDriven.net or ReSharper.
FYI The latest nUnit includes the features that MbUnit set out to add to unit testing. nUnit also has better integration with VS and various add-ons I believe.