Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:02:09+00:00 2026-06-03T06:02:09+00:00

In visual studio 2008 Professional, when I create a unit test for a method

  • 0

In visual studio 2008 Professional, when I create a unit test for a method (using the native vs studio framework and wizard), the generated test file stub is saved in the root directory of the test project.

When I later move the test file to a sub-directory, I cannot use the wizard to create more test stubs for other methods of the same class ( it will create a new empty file in the root and then silently fail )

How can I change this so the test project uses the same folder structure as my main project; so if a class is e.g. in project-root\model\xyz.cs, the corresponding test class is automatically generated in testproject-root\model\xyzTest.cs ?


edit:

Add the moment, this seems to be an unsolved bug with visual studio. Besides the workaround described in the answer below, another possibility is to simply rename the autogenerated test classes after moving the respective test class files. Then Visual Studio will at least not silently fail but recreate the old test class file in the root folder when generating another test method, and that test method can then be copy-pasted into the correct file

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:02:10+00:00Added an answer on June 3, 2026 at 6:02 am

    I just confirmed your problem, When adding more tests for the file I moved i just got the first 2 lines of the file generated.

    I’m guessing the wizard just doesn’t know how to look in subfolders to know what file to add it to, but errors when trying to generate a second class of the same name. (I’d guess if you rename any of the test files but leave them in the root it would also have this problem, but I didn’t test this idea)

    So I don’t think there is anyway around it if you want to continue to use the wizard. You should be able to move it to the root, use the wizard, and move it back right. That’s the best option I can think of.

    I’m thinking the test abilities were greatly improved in VS2010, I have not used that but maybe the fixed it for that version…

    This answer offers a solution, using a 3rd party code template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In attempting to create an initial, failing unit test in Visual Studio Professonal 2008's
I am writing some unit tests using visual studio 2008 professional edition. I learned
I'm using Visual Studio 2008 Professional at work. Recently, I got a new workstation.
I'm using Visual Studio 2008 Professional in C++ with Windows Form, I have a
I'm using pthread on Windows Form in Visual Studio 2008 Professional, But I'm getting
Using SQL, SQL server manager 2008, c-sharp.net 4.0 and ms visual studio professional 2010:
Running Visual Studio 2008 Professional it is possible to enable static code analysis using
I am using visual studio 2008 professional edition. In my solution I have about
I recently got a new workstation where I'm using Visual Studio 2008 Professional for
I'm using Visual Studio 2008 Professional Edition. I wrote an application for Windows Mobile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.