.netunit-testingvisual-studio-2012devexpresscoderush

Unable to run xUnit Test with Code Rush runner in VS 2012 without an exception


When I create a unit test project with DevExpress in VS2012 it fails right out of the box with an exception in Microsoft.VisualStudio.TestPlatform.Core. Adding an Assert so the Sub actually does something doesn't help. No amount of building/rebuilding the project helps, nor does Reloading DevExpress. The code is simple:

<TestClass()> Public Class UnitTest1
    <TestMethod()> Public Sub TestMethod1()
        Assert.IsTrue(True)
    End Sub
End Class

I'm guessing something is misconfigured, but I have no idea what. The exception and full output are below.

Testing started:  

Total tests: 1, filtered: 1  

Exception:  
Message: An error occurred while initializing the settings provider named 'RunConfiguration'.  
Error: Invalid settings 'RunConfiguration'. Unexpected XmlElement: 'SolutionDirectory'.  
Source: Microsoft.VisualStudio.TestPlatform.Core  
StackTrace:  
    at Microsoft.VisualStudio.TestPlatform.Core.RunSettings.<>c__DisplayClass2.<CreateLazyThrower>b__1()  
    at Microsoft.VisualStudio.TestPlatform.Core.TestPluginsFramework.LazyExtension`2.get_Value()  
    at Microsoft.VisualStudio.TestPlatform.Core.RunSettings.GetSettings(String settingsName)  
    at CR_VSTesting.Executor.Run(ExecuteTestData data, RunSettings settings, IEnumerable`1 testCases)  
    at CR_VSTesting.Executor.Execute(ExecuteTestData data)  
InnerException:  
Exception:  
Message: Invalid settings 'RunConfiguration'. Unexpected XmlElement: 'SolutionDirectory'.  
Source: Microsoft.VisualStudio.TestPlatform.ObjectModel  
StackTrace:  
    at Microsoft.VisualStudio.TestPlatform.ObjectModel.RunConfiguration.FromXml(XmlReader reader)  
    at Microsoft.VisualStudio.TestPlatform.Extensions.RunConfigurationSettingsProvider.Load(XmlReader reader)  
    at Microsoft.VisualStudio.TestPlatform.Core.RunSettings.LoadSection(XmlReader reader, SettingsProviderExtensionManager settingsExtensionManager, Boolean reload)  
No tests found.  
Duration : 0.8022362  

Solution

  • It looks like something in CodeRush v14.2.6.0 is conflicting with Visual Studio 2012. I confirmed that this works fine in 2013. Disabling the unit test functionality in CodeRush solves the issue. To disable this, go to DEVEXPRESS > Options... > Unit Testing, and then uncheck the "Enable Unit Tests Service" checkbox.