Question

I'm executing my test-dlls using the vstest.console.exe (the future mstest.exe) as a process in my application. I want to know if there's any possibility to send parameters or datasource from my application to the testmethod.

I've been searching for something like:

vstest.console.exe /Tests:DoSomething parameters.xml

or

vstest.console.exe /Tests:DoSomething /params:3,2,1

It would be even better if I could send these parameters to the constructor of the test class.

Is this possible?

Was it helpful?

Solution

I haven't seen any commands that make this happen. Official command line documentation: http://msdn.microsoft.com/en-us/library/vstudio/jj155796.aspx

You could author your tests to load from an external file (xml, ini, etc.) or source (db) which would simulate this. If the application were to generate the data, the test methods could load it and use the data during execution.

I've been doing something similar where I generate a setting file containing various information for a web application to be tested, it then launches the test and the tests load from that data file and use the settings for parameters.

OTHER TIPS

You can use the parameter /Settings: to load parameters from a XML config file (*.runsettings).

In this answer you see a good example: https://stackoverflow.com/a/56846722/789423

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top