Skip to content
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

Add support for ordered tests #25

Open
sbaid opened this issue Dec 9, 2016 · 25 comments
Open

Add support for ordered tests #25

sbaid opened this issue Dec 9, 2016 · 25 comments

Comments

@sbaid
Copy link
Contributor

sbaid commented Dec 9, 2016

Description

Is it possible to decide this based on telemetry data of ordered tests usage?

Steps to reproduce

What steps can reproduce the defect?
Please share the setup, sample project, target platform (desktop, core, uap)

Expected behavior

Share the expected output

Actual behavior

What is the behavior observed?

Environment

Please share additional details about the test environment.
Operating system, Build version of vstest.console, Package version of MSTest
framework and adapter

@sbaid
Copy link
Contributor Author

sbaid commented Dec 9, 2016

@harshjain2 Do we have telemetry data of usage of ordered tests, generic tests?

@sbaid
Copy link
Contributor Author

sbaid commented Dec 9, 2016

@pvlakshm to keep u in loop

@AbhitejJohn
Copy link
Contributor

I believe @pvlakshm has also filed a user voice item for this.

@pvlakshm
Copy link
Contributor

We should support ordered tests in a generic manner and not restrict it to only MSTest framework based tests - perhaps as yet another extension point offered by the test platform.

@pvlakshm pvlakshm mentioned this issue Apr 7, 2017
16 tasks
@divijkumar
Copy link

We have an app (on multiple platforms) where a lot of the code is in C++. We use a very thin cross-platform wrapper for writing unit tests. The wrapper internally uses CPPUnitTestFramework for unit testing on Windows.

Sometimes, when running the unit tests one of the tests will fail, and that will result in some of the tests that are executed after the failed test, to fail as well. Most of the times the fix is a trivial one, but time is spent in segregating the test which actually failed from those that failed as a result of some remnant of the earlier failed test.

We would like to know if there is a way to determine the order in which the unit tests are run inside Visual Studio. This will help us in determining the failing test quickly, and help resolve issues faster.

Moreover, it would be good to have a mechanism to control the order of the execution of the unit tests inside Visual Studio.

@AbhitejJohn
Copy link
Contributor

@divijkumar : Ideally tests should be isolated units and should not adversely affect other tests. They do so by ensuring that the right cleanup is done even if a test fails. When this is not possible for some reason, you could turn on diagnostic logs(link for the default test platform, link for the new cross plat test platform) to figure out what order they actually ran.
Yes, this issue should probably cover providing ordered test support for C++ based tests as well.

@rhundhausen
Copy link

I'm not a huge fan of ordered tests, but they do serve a purpose (e.g. integration testing by sequencing many unit tests). That said, one would expect the default behavior of VS 2017 to just work.

@JDCain
Copy link

JDCain commented Aug 9, 2018

I wanted to know if this was any plan for adding built in support for testorder to the roadmap.
We currently have some workarounds but they are rather ugly implementations with custom scripts reading a defined order and calling vstest.console.exe for each individual test.

@AbhitejJohn AbhitejJohn removed their assignment Jan 22, 2019
@melleck
Copy link

melleck commented Jan 30, 2019

Come on guys, it has been over 2 years now and there is still no update/fix0 on this issue? Ordered tests are now a norm especially for Selenium based GUI tests developed using VS C#. I had to ditch MSTest in favour of NUnit just because MSTest didn't support ordered tests.

@xdevs23
Copy link

xdevs23 commented Mar 12, 2019

What do you expect from Microsoft, they don't really care about this. I do need this feature but looks like I need to solve it differently.... I hate working with C#... and Microsoft products sigh

@PBoraMSFT
Copy link
Member

@JDCain - it's on the radar (which is why the issue remains open), but it's unlikely that we will get to it in CY19 Q2. We are open to taking contributions if anyone is interested.

singhsarab pushed a commit to singhsarab/testfx that referenced this issue Apr 8, 2019
@dondrakon
Copy link

Any update of this task?

@JDCain
Copy link

JDCain commented Apr 15, 2020

Any update of this task?

I ended up going to Xunit and writing a test dependency orderer. https://github.com/JDCain/Xunit.Extensions.TestDependency

@saiparth
Copy link

saiparth commented Sep 2, 2020

Any update on this?

@N-Olbert
Copy link

While not equivalent to ordered tests it seems that at least an alphanumerical execution order is defined behaviour according to docs and samples

@nalamTekhqs
Copy link

any update regarding this issue?

@deepasajin
Copy link

Any update on this ticket. I beleive we have an option to order the test using XML format. Any one tried that ?

@Haplois
Copy link
Contributor

Haplois commented Mar 4, 2021

@deepasajin, Ordered tests are not currently supported by MSTestV2; based on telemetry, it's not currently on our roadmap. Also, it is the best practice to avoid ordering tests.

@nalamTekhqs
Copy link

Thanks @Haplois for the update

@saiparth
Copy link

saiparth commented May 6, 2021

Hi @Haplois
Any plan to support external files?(if testnames are kept in external file) I may have 1000 tests which needs to be run in those order. I cant run parallelly or without order because application will not support that.
Ex: dotnet test --filter tests.csv
if not is there any limit for mentioning testname in this?if i create a file with 1000 test name, will that work?
Ex dotnet test --filter tests1,test2.....

@Haplois
Copy link
Contributor

Haplois commented May 6, 2021

@saiparth, providing a filter doesn't guarantee that tests will run in given order -- it is just for filtering which tests to run. There is a maximum limit set by the OS when using --filter (see: microsoft/vstest#2764). We have an unsupported and undocumented way of filtering tests using the .runsettings file. You can try using that with the understanding of it might break in the future. (see microsoft/vstest#2356 (comment))

@Haplois Haplois closed this as completed May 6, 2021
@N-Olbert
Copy link

N-Olbert commented Jan 3, 2023

@Evangelink Due to the conversation in #821 maybe this issue should be reopened

@Evangelink
Copy link
Member

Reopened for investigation if that's something we want to support.

@Evangelink Evangelink reopened this Jan 6, 2023
@Evangelink Evangelink changed the title MSTestv2 does not support orderedTests Add support for ordered tests Jan 16, 2023
@WhitWaldo
Copy link

I'd like to see support for ordered tests primarily to ensure that I can execute a set of smaller unit tests sequentially comprising a larger integration test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests