Set Location of Visual Studio 2015 Unit Test Projects - visual-studio

When I right click a function and click "Create Unit Tests" Visual Studio 2015 decides to create a new Unit Test Project in the root directory of my solution. This means that if I want to create unit tests for all my code, I will end up having dozens of Unit Test Projects in the root of my solution - which makes things messy.
I created a Folder in my Solution called "Tests" and I want all new Test Projects to automatically end up inside this folder. How do I do this? Is it possible to set the location of where Unit Test Projects are created?

Related

Cannot Create NUnit Unit Test From File On Visual Studio 2022 community

I have a solution file which contains two project, one is main project and the other is an unit test project.
I had them install both NuGet Package NUnit and NUNit3TestAdapter
However, I still cannot create nunit unit test near the function I want to test by the mouse right click event
As you can see, only MSTestV2 framework is detected.
My question is: How can I use the NUnit framework to create unit tests in Visual Studio 2022 Community?
The TestGenerator extension has not been released for x64 which VS2022 yet.
What you do is to use command line tools:
Create a new folder for your test projects.
The run :
dotnet new nunit
This will create a new NUnit test project.
Add this project to your solution and add a project reference from there test project to your other project "to be tested", and off you go :-)

MSTest V2: 'Test mix' section in Load test wizard not finding the unit test

I'm trying to use my unit test for load testing as well. When I click 'Add...' button, visual studio prompts with a message 'There are no tests available to pick' (as shown in below image).
I can execute the unit test successfully from VS2017.
Without seeing the solution structure I can't really tell.
Make sure the web test is present in same project as the load test.
Also make sure the project which you have created inside the solution is indeed a "Web Performance and Load Test Project".
Can you do the following :
1) Rebuild Solution
2) Clean / Build Solution
3) Renamed the coded Web Test
4) Restarted Visual Studio
5) Restarted Computer.

Visual Studio 2010 Test Projects

I have a solution with some test projects containing unit tests.
When I run all tests, I would like to execute one project at a time, i.e., all the unit tests of the first project, then all the unit tests of the second project, ecc.
Is it possible with Visual Studio 2010?
What you can do is set multiple startup projects. To do so:
In the Project menu, under Properties, expand Common Properties to select Startup Project. From here you can select Multiple Startup Projects, after which you will be capable of debugging more than one project at once.
Hopefully this helps you.

On Visual Studio 2013 sp 4: Add New Items screen, I Cant Find All The items related to Test Template

I had installed Visual Studio Ultimate Edition 2013 Service Pack 4 with Group License Key. I did this for my job . When I go to add new items to the project on the New items menu. Under the installed Visual C#. I see Test but i'm missing Basic Unit Test, Load Test, Coded UI Test Map, Web Porformance test. I only see these three items Items when I click on new project. I see Coded UI Test Project, Unit Test Project, and Web Performance Load test.
Why don't I see those other items associated with test like basic unit test, coded UI test, load test, unit test, web performance test, coded UI test map.
Is my license does not allow me to see this or is this due to installation or something else. I thought 2013 ultimate would have all this.
Thanks
I found out that you have to open and create a coded U.I project to be given those options any other type of project that you start that isn't a coded U.I project then you are only given Unit test, coded UI, and load test projects as options.

Visual Studio and Google Test: Forcing Re-Run of Test Project When Dependencies Change

I have a set of Google Test-based unit tests for a native C++ DLL I'm developing. The DLL is in its own project, and the test project is dependent upon it. The test project has a Post-Build Event script that runs the tests.
My problem: Whenever the test project gets rebuilt, it runs the tests as expected. However, making a change to the dependent DLL does not always cause the test project to be rebuilt. Specifically, it seems that if none of the DLL's header files change, Visual Studio decides that the test project doesn't need to be rebuilt.
Is there any way to force Visual Studio to rebuild the test project, or to run the post-build event, whenever the DLL gets rebuilt?
I can force the tests to be re-run by right-clicking one of the files in the test project and choosing the Compile menu item, then doing a build. I'd prefer to eliminate that manual-and-often-forgotten step.
I suspect I could get the result I want if I were to include the DLL project's source files in my test project, but I'd really like to run the tests against the actual DLL.
Related but unhelpful question: How to setup Google C++ Testing Framework (gtest) on Visual Studio 2005

Resources