-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to triger the MSTestV2 programatically? #821
Comments
Have you tried the vstest console wrapper? Or is that something you want to avoid as well? https://github.com/nohwnd/vstest-examples/blob/main/PartioningTests/Program.cs#L73 in mstestv2 tests are ordered based on method names btw. |
i tried like this - https://github.com/saiparth/consoleRunner but its not discovering tests. |
@nohwnd |
@saiparth Support for ordered tests in the future seems to be unlikely (see #25 (comment)). We fixed our (few) tests which really require ordering by merging them into a single test method which executes them sequentially. |
@N-Olbert
since my framework was using Mstest V1, I thought of continuing MstestV2 |
@saiparth Is it something you are still interested in having? |
Yes, Is there solution? |
Not sure, I need to look into it. I just wanted to confirm there was a need for it. Could you confirm the kind of usage you would like to achieve? Because depending on them, there might be a need to use Test Platform (or not). |
I am looking for support of orderedtest in MSTEST V2. There was an option in V1 which displayed all unit test in project and we could generate a xml file by picking specific testcase. Good thing was execution order was same as test names in external file even though it was the list was not alphabetical order. Using some tools we can run the test from external files. But it wont execute in the order that we mention. Its not possible to mention the execution order for the test using attributes due to various reasons. The tests would execute randomly. Some of the test wont support parallel execution and we need sequential execution. Also the test list may not be in alphabetical order |
I will make tests but I fear that to run in order you would need to call MSTest n times with 1 test per call. |
@Evangelink Since you were interested in this issue and seem make a roadmap for MSTest v3 and v4.... are there any plans to fix the main reason for this request and provide a way to specify the execution order of the tests (by an attribute, a custom IComparer-instance that has to be registered somewhere or whatever). Even if the corresponding issue #25 has already been closed, I think this is an important feature for integration and acceptance testing. In fact this lack of functionality is the main reason i would struggle to use MSTest in a new project. |
Hey @N-Olbert. Yes, I'd like to work on a feature to give users the ability to have better control on the order of their tests but I haven't yet given enough thoughts to suggest something now. For sure, it won't be part of v3, I will see if it could fit v4. |
I had a quick look and sadly with current architecture, there is no way for you to control the order. As I said previously, you would need to make a lot of calls with 1 assembly and a filter to match only 1 test of that assembly. As for the programmatically doing the calls, you can:
Let me know if you need more information. |
Hey there, as you may have noticed we are about to start shipping MSTest runner and this runner will greatly facilitate most of the requests open in this issue. Please look at the code and let us know what you think. |
I am using specflow with MsTestV1. I am using orderedTest to run. Since V2 does not support orderedTests, is there any way to Triger the tests programmatically in V2. I checked the unit tests, I dint get it
I am trying like this
https://social.msdn.microsoft.com/Forums/vstudio/en-US/ccd08ce1-a86b-4965-af68-1db8cd7d6715/how-to-execute-test-methods-programmatically-using-c-may-be-using-reflection?forum=vsunittest
For V2 I refered this. but not getting it
https://github.com/microsoft/testfx/blob/master/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestExecutorTests.cs
I dont want to run using command line..the test name will be in a list,I have to invoke them.
The text was updated successfully, but these errors were encountered: