locked
MSTEST can't run with the setting file. e.g. '*.runsettings' has unknown format and cannot be converted to the current version. RRS feed

  • Question

  • I need to run mstest in command line environment. so I created a .runsettings file.

    <?xml version="1.0" encoding="utf-8"?>
    <RunSettings>
      <RunConfiguration>
        <TargetPlatform>x64</TargetPlatform>
      </RunConfiguration>
    	<MSTest> 
    		<DeleteDeploymentDirectoryAfterTestRunIsComplete>true</DeleteDeploymentDirectoryAfterTestRunIsComplete> 
    	</MSTest> 
    </RunSettings>

    The command line is like "mstest /testsettings:MyProgramTests.runsettings /testcontainer:"%TBIN%\myTests.dll""

    But, when I run it, I always got the following errors:

    Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
    Copyright (c) Microsoft Corporation. All rights reserved.

    Loading MyProgramTests.runsettings...
    MyProgramTests.runsettings
    The file 'MyProgramTests.runsettings' has unknown format and cannot be converted to the current version.

    I don't know the reason. Any help will be much appreciated.

    p.s:

    The reason that I need a .runsettings is that I have to specify the TargetPlatform to X64, otherwise my test code will crash when running to access a 3rd party DLL which is x64.

    • Moved by Jamles Hez Monday, March 30, 2015 10:18 AM
    Monday, March 30, 2015 3:13 AM

Answers

All replies

  • Hello Aha Yang,

    I think the case is more related to test forum, so I will move this case to Unit Test forum:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vsunittest

    Best regards,



    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 30, 2015 10:19 AM
  • Hi Aha Yang,

    >>The file 'MyProgramTests.runsettings' has unknown format and cannot be converted to the current version.

    Not use the command line, if you run it with the VS IDE, how about the result?

    If possible, please run it with Vstest.console command line.

    http://blogs.msdn.com/b/bhuvaneshwari/archive/2012/06/16/vstest-console-exe-commandline-test-runner.aspx

    Vstest.console.exe accepts the run settings in two formats:
      1..runsettings file which is the new settings format. .runsettings file can be used as configuration file for all test frameworks like Nunit, Vs unit, xunit and so on.
      2..testsettings file which was present in Visual Studio 2010 and is specific to Visual studio unit test framework.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Alex Ya Wednesday, April 8, 2015 1:25 AM
    Tuesday, March 31, 2015 8:24 AM
  • Hi Aha Yang,

    >>The file 'MyProgramTests.runsettings' has unknown format and cannot be converted to the current version.

    Not use the command line, if you run it with the VS IDE, how about the result?

    If possible, please run it with Vstest.console command line.

    http://blogs.msdn.com/b/bhuvaneshwari/archive/2012/06/16/vstest-console-exe-commandline-test-runner.aspx

    Vstest.console.exe accepts the run settings in two formats:
      1..runsettings file which is the new settings format. .runsettings file can be used as configuration file for all test frameworks like Nunit, Vs unit, xunit and so on.
      2..testsettings file which was present in Visual Studio 2010 and is specific to Visual studio unit test framework.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Hi, Jack,

    thanks a lot for your answer.

    1. I ran the command mstest under VS command environment, I don't know why it can't parse the .runsettings file

    2. As you suggestion, I changed to use vstest.console.exe. With the same .runsettings file, it could run successfully.

    However, vstest.console.exe doesn't support specify the result directory and customized result file name. e.g. AdTests.runsettings content is

    <?xml version="1.0" encoding="utf-8"?>
    <RunSettings>
    	<RunConfiguration>
    		<!-- Path relative to solution directory -->
    		<ResultsDirectory>$(TRES)\TestResults</ResultsDirectory>
    	</RunConfiguration>
    </RunSettings>

    My command is

    vstest.console.exe "%CBIN%\AdTests.dll" /Platform:"%Platform%" /logger:trx /settings:AdTests.runsettings

    TRES is my environment variable, it is our test result path. I use $(TRES) just want to specify the output directory. But the result is under local work folder\$(TRES)\TestResults.

    Furthermore, I want to use my predefined result file name such as AdTest.trx. vstest.console.exe doesn't support it.

    Thursday, April 2, 2015 9:46 AM
  • Hi Aha,

    Glad to receive your reply.

    Based on your issue, I just get some suggestions with the .runsettings, it seems that we couldn’t change the project path for the result folder in default.

    Reference:

    http://stackoverflow.com/questions/14483837/specifying-results-filename-for-vstest-console-exe

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/59446653-498c-49f3-8acb-98226a9b25b5/vstextexe-for-command-line-testing?forum=vstest

    So if you want to run your test using Mstest.exe and save this .trx result file in specify the result directory, I suggest you'd better create a .testsetting file to implement these functions.

    https://msdn.microsoft.com/en-us/library/ee256991.aspx?f=255&MSPPError=-2147217396

    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Alex Ya Tuesday, April 7, 2015 3:01 AM
    Friday, April 3, 2015 3:34 AM
  • Hi Aha,

    Glad to receive your reply.

    Based on your issue, I just get some suggestions with the .runsettings, it seems that we couldn’t change the project path for the result folder in default.

    Reference:

    http://stackoverflow.com/questions/14483837/specifying-results-filename-for-vstest-console-exe

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/59446653-498c-49f3-8acb-98226a9b25b5/vstextexe-for-command-line-testing?forum=vstest

    So if you want to run your test using Mstest.exe and save this .trx result file in specify the result directory, I suggest you'd better create a .testsetting file to implement these functions.

    https://msdn.microsoft.com/en-us/library/ee256991.aspx?f=255&MSPPError=-2147217396

    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    It seems that problem goes back to my original issue.

    Please reivew my first post. I used mstest.exe firstly but it failed with .runsettings. Then I used vstest.console.exe as you recommended.

    NOW, I can resolve the .trx file name issue by myself such as using scripts to for-loop and rename. But do you know how to use system environment variables in .runsettings file? such as I want to use my sys var %tres% in .runsettings.

    e.g. if I used the following in .runsettings, it can't work. in my environment, TRES is set to C:\TEMP

    ResultsDirectory>$(TRES)\TestResults</ResultsDirectory>
     

    Tuesday, April 7, 2015 3:35 AM
  • @ Aha,

    >> But do you know how to use system environment variables in .runsettings file? such as I want to use my sys var %tres% in .runsettings.

    I repro this issue in my side, it seems that it has this limitation for environment variables with the .runsettings file, it just create the folder under the solution directory.

    Maybe you could use the real folder:

    <ResultsDirectory>C:\TEMP\TestResults</ResultsDirectory>

    Of course, you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. You can send your idea there and people can vote.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 7, 2015 8:23 AM
  • @ Aha,

    >> But do you know how to use system environment variables in .runsettings file? such as I want to use my sys var %tres% in .runsettings.

    I repro this issue in my side, it seems that it has this limitation for environment variables with the .runsettings file, it just create the folder under the solution directory.

    Maybe you could use the real folder:

    <ResultsDirectory>C:\TEMP\TestResults</ResultsDirectory>

    Of course, you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. You can send your idea there and people can vote.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Yeah, I just did as you suggestion. I used C:\TEMP\TestResults as a temporary folder and deleted it after copying the .trx to my own folder.

    I think this thread is done. thank you very much.

    Wednesday, April 8, 2015 1:24 AM