Cannot Add/Open a Test in a Visual Studio Project
When trying to open an existing test with the Visual Studio plugin, it is possible to receive the following message:
The operation could not be completed.
Take these steps first:
- Exclude the test from the project (right click it and select Exclude From Project).
- Save and close the solution.
- Close and restart Visual Studio.
- Reopen the solution.
- Add the test back to the project.
If that does not work, or only works temporarily, then follow these steps:
- Uninstall Test Studio.
- Uninstall Visual Studio.
- Install Visual Studio (and any applicable Service Packs).
- Install Test Studio.
When trying to open or add a test to a Solution, it is possible to receive the following message:
This issue can occur when you:
- Create a new, empty project/solution and try to add a test to it (before creating a test project in the solution).
- Attempt to add a test to a part of the solution that is not a Test Project.
- Attempt to open a test from source control.
A test cannot be within any part of the solution; it must be contained within a Test Project. This message will continue to display until you add a Test Project to the Solution, and then add the test to the newly created Test Project.
First add a Test Project that will contain the test, then add the test to the Test Project.
- Click File > Add > New Project.
- On the left column, click the Test option.
- Highlight Test Project.
- Click Add.
- Allow time for the test project to load.
- Right-Click the Test Project.
- Select Add, then choose New Test or Existing Item.
- Navigate to the folder that contains your test and .resx file (both will be required to add/use the test).
Click the Add button. The test and resource files are added to your test.
Note: If you forget to select the .resx file, you are prompted to locate it after adding the test file.
Click Yes, then use the browsing dialog to locate the correct .resx file (the name should match the test name, only the extensions differ).
If you click No, you are given this message:
If you choose to not add the file again (by clicking Yes), a new .resx file is generated (it contains the Storyboard images), but existing steps are not affected. Select No to use the above process to add an Existing Item to the test (and target the .resx file). If you have a code-behind file for the test, you will be asked to locate this as well (like the .resx file just mentioned). If you do not locate your code-behind file, the coded steps are deleted from the test entirely.