I have created simple MS Unit Test Project. Assert.Equal(true, true).
When I want to run a test I receive a error from Resharper and Visual Studio.
"Unit test Runner failed to run tests
System.Xml.XmlException: An Error occured while parsing EnityName. Line 1, position 17."
Do I missing something.
Edit:
I can't add screenshot and I can't select text to copy. Ok I will write it the best I can.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.xml.XmlTextReaderImpl.Throw(String res,String arg)
at System.Xml.XmlText.ParseEnityName()
at System.Xml.XmlTextReaderImplparseEnityReference
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextLoader.ParsePartialContent(XmlNode parentNode,String innerxmltext, xmlNodeType nt)
at System.Xml.XmlElement.set_InnerXml(string value)
at Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingHelper.AppendOrModifyChild(XpathNavigator,String nodePatH,String nodeNAME,sTRING INNERxML)
at Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.UpdatedRunConfiguration(XPathNavigator, ArchitectureeffectivePlatform,FrameworkVersion effectiveFramework,String resultsDirectory,String solutionDirectory,String binariesRootDirectory)
Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.MergeRunSettingsAndFindCompatibleSource()
at JetBrains.ReSharper.UnitTestProvider.MSTest11.MsTest11Runner.Run(IRemoteTaskServer server,String assemblyLocation,String runConfigurationFilename,IUnitTestRun run)
To solve this problem you don't need to reinstall Visual Studio or Resharper.
The problem was in a file path to my projects. This would explains why other Unit Test projects were fine because there were in a different location.
I guess this a bug inside Visual Studio Unit Testing Framework. If you have unit test project inside folders with special charts like '&' then Visual Studio will crash or Resharper will return this message.
I wonder where I can report this bug.
I have just run into this problem too and followed the advice above.
First my path had a folder named ...\m&e...
Then I copied the whole project folder to a new location without an '&' in the path.
After that everything was working well.
Related
after updating SpecflowRunner to 3.5.8 and re-installing the Specflow Package 2017.2.1 my tests cannot be executed and are skipped instead. When I open the log file I find this Error message:
Error while unpacking executor: System.TypeLoadException: The method "Initialize" in type "TechTalk.SpecRun.Framework.TestAssemblyExecutor" of the assembly "TechTalk.SpecRun.Framework.Executor, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null" is not implemented.
(Sorry, I had to translate the message)
A friend of mine has the same versions, but everything runs smoothly. We both use Visual Studio 2017.
Did I miss something, a cache that has to be cleared or anything else?
You have probably some old leftover files from before the update in your obj and bin folder.
Close Visual Studio
delete the folders
start Visual Studio
Rebuild Solution
After that, you should be able to execute your tests again.
I was adding some code to a project and wanted to add a Google Test case for it, on the unit testing project called UnitTests. Everything was going fine, my test failed because of some silly copy+paste mistake I made but after I fixed it I couldn't run the test anymore because during the build stage I'd get this error
Error (active) E0145 member
"google::protobuf::internal::ExtensionSet::kMaximumFlatCapacity" may
not be initialized UnitTests
Which stems from google\protobuf\extension_set.h.
and
Error LNK1104 cannot open file '\UnitTests.exe'
I commented-out my new test and tried to rebuild but encountered the same issue.
Then I tried to change to a different branch in my local repository - one without any of that new code and building the unit tests project still resulted in the same issue.
What could be the problem?
I'm using Visual Studio 2017 if it could matter.
Thanks.
I'm looking for a solution to start my tests from command line.
I created a UnitTest Procjet in VisualStudio2017 for my .NET solution.
Added TestStack.White NuGet package to the project.
The test are running fluently when I start from the VisualStudio2017.
I would like to start it from Jenkins also. I think it is the easiest to do it from command line, so I add it to my pipeline configuration (Jenkinsfile)
stage('Run UI Tests') {
steps {
bat('"C:\\PATH_TO_MSTEST\\mstest" /testcontainer:PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
}
}
When I try to start it from cmd like I would do with with regular Unit Tests, it is not working.
It says:
Starting execution...
No tests to execute.
I build the project before I start 'Run UI Tests' stage.
Any ideas how to make it work? Could really find it on stackoverflow, github issues of TestStack nor other glory places on the web
Found a solution.
On my local developer machine it was working, the mstest version was 14
On the build agent machine the mstest version was 15, that was not working somehow (it had nothing to do with TestStack White, simply the unit tests were not working)
What I do is, calling vstest.console.exe instead of the mstest.
C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe
So, instead of
stage('Run UI Tests') {
steps {
bat('"C:\\PATH_TO_MSTEST\\mstest" /testcontainer:PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
}
}
My command in the Jenkinsfile was:
stage('Run UiTests') {
steps {
bat('"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe" PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
}
}
nunit3-console is great alternative to MSTEST. Please refer below link.
e.g.
nunit3-console \bin\Debug\Automation.dll --where "cat=Smoke-Tests"
https://github.com/nunit/docs/wiki/Console-Command-Line
I use Visual Studio adapter for Boost.Test. I built boost.test[v1.59] project using cmake.
I didn't have any compile problems but when I tried to run tests I got the output like below:
Executing: -> [BoostUnitTestSample]
filestream was found to be null when handling path: D:\Work\Project\dev\DesktopMSVC13_Project\src\ProjectTest\Debug\ProjectTest.exe.test.report.xml
Exception caught while running test batch D:\Work\Project\dev\DesktopMSVC13_Project\src\ProjectTest\Debug\ProjectTest.exe [BoostUnitTestSample]
(File 'D:\Work\Project\dev\DesktopMSVC13_Project\src\ProjectTest\Debug\ProjectTest.exe.test.report.xml' not found.)
========== Run test finished: 0 run (0:00:03,6081912) ==========
Everything goes fine if I add a boost.test project manually
My experience with the Boost.Test extension for Visual Studio (see comment) tells me that you forgot to set references to dependencies required to run the tests (typically DLLs). I think the message is rather created by the standard test execution engine than by Boost.Test extension. It is just a clumsy way of saying "oh, the test did not run, so I could find the results..."
I'm making use of the TestDriven.NET plugin for visual studio to run all my tests to check for code coverage with NDepend. All is working fine apart from my tests with a HostType attribute. These aren't getting run.
Does anybody knopw how to fix this or is there a specific reason for it?
Thanks in advance
If you look at the release notes for TestDriven.NET, they explicitly skip test with the HostType attribute. I'm not sure why they do this exactly.
I can actually not find another test runner outside of the built in runner in Visual Studio that will execute those tests, Resharper/dotCover gives me an Aborted message when running a specific test with a HostType
EDIT: Linked to release notes (look at item 3203) http://www.testdriven.net/downloads/releasenotes.html