18

Whenever I try to run tests on Test Explorer from Visual Studio 2012, SOME test are being categorized as "External", even though the Group By is set as "Group By Project" enter image description here

Then the source code is not recognized

Jorge Alvarado
  • 2,664
  • 22
  • 33
  • What type of tests you have in External? What test framework you use? – Spock Nov 01 '13 at 09:08
  • it's just unit test, being run with MS Test, the problem is very random, sometimes I need to restart visual studio and run the tests again, and then everything is back again in their original category – Jorge Alvarado Nov 01 '13 at 14:41
  • http://stackoverflow.com/questions/14922597/why-are-scenario-outlines-shown-as-external-in-the-vs-2012-test-explorer the accepted answer here also works well. – Ian Robertson Nov 17 '16 at 13:33

3 Answers3

15

This is due the pdb file is not included in the compilation. If you're compiling in a solution configuration other than debug you must ensure that pdb is included.

To achieve that you must open the advanced build setting:

  • Right click on project and select properties
  • Click on build tab
  • Check that your configuration is selected in the "Configuration" dropdown
  • Click on advanced button.

In the new window you must select "pdb-only" in the debug info dropdown.

  • You can specify either option other than none. And I must say, it would have been the last thing I was going to suspect. – Tanveer Badar Aug 06 '15 at 13:31
  • This tipped me off to my problem - my project was set to no debug info, but that was because when I added it to my solution, the configuration was set to "Release" for some reason, instead of Debug like the rest of the solution. Something to check for others who might wonder why their debug symbols weren't enabled. – mdryden Dec 18 '17 at 19:03
  • 1
    In my env - VS 2017 version 15.6.6 - this also happens if you choose any of debug information generation options. And it's not related to the combined length of the full name of the class and the test method either since that is clearly shorter than 254 chars in my case as well. There must be yet another reason. – Manfred Apr 14 '18 at 23:18
  • Hmmm for me it's set to "full". – Vin Shahrdar Jun 19 '19 at 19:07
3

This was happening for me but only when the combined length of the namespace, class, and test method exceeded 254 chars. (MS-Test, Visual Studio 2013 12.0.40629.00 Update 5)

namespace MyTests.HaveLong.Complicated.NamespaceAsWell.AsMuchAs.EightyFive.Chars.IfThatMatters
{
    [TestClass]
    public class A_Long_ClassName_MayAlso_Contribute_ToThe_Issue_ThisOneIs_EightyFive_Characters_Long
    {
        [TestMethod]
        public async Task This_IsAMsTest_TestMethod_WithAnEightyFive_CharacterName_WhichWillShow_UnderExternal()
        {
        }
        [TestMethod]
        public async Task This_IsAMsTest_TestMethod_WithAnEightyFour_CharacterName_WhichWontShowUnderExternal()
        {
        }
    }
}
inchbuie
  • 241
  • 3
  • 4
1

I tried the accepted solution, it did not change anything, so I reverted it and suddenly everything got fixed for me after this. VS2017.

psfinaki
  • 1,814
  • 15
  • 29