-
Notifications
You must be signed in to change notification settings - Fork 261
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
MS Test 2.2.4 - 2.2.10: Tests fail because DynamicData gets only structs with default values #1094
Comments
After further investigation my initial suspicion about the test cases getting mixed seems to be wrong. It seems like the structs are not passed correctly between the factory and the test method. All Vector2D structs that the test method receives, get the default value Vector(0.0, 0.0). |
I found the solution here: #905 (comment). Adding
restores the old behaviour. |
Added a comment at #905 (comment). |
Sorry for the inconvenience caused by this, the solution you found is the correct one. |
I just tried to upgrade to v3, and at the same time took out |
Hi @dgasaway, Would you mind opening a new issue with a repro of what's not working for you please? |
@Evangelink My problem is what @gdir22 described so well in this very issue. The only solution suggested here so far is to use |
@dgasaway I don't think it will be possible to have I have created a separate task to track the fact that we need to use a better serialization mechanism for this need as the current solution causes too many issues (see #1462). |
Description
Hi,
I have a strange problem with MS Test versions 2.2.4 - 2.2.10. In my actual project a have a lot of unit tests that use DynamicData to fetch the test cases from a method. Up to MS Test 2.2.3 this worked fine. With MS Test 2.2.4 - 2.2.10 some (not all) of these tests fail,
because the test cases are mixed upbecause all structs have default values. This seems to happen when structs are involved,but I'm not sure about that.Steps to reproduce
I have prepared a minimal solution here: https://github.com/gdir22/Vector
There a four branches in the project:
Just switch the branches, build the solution and run the unit tests.
Expected behavior
All tests should pass.
Actual behavior
If Vector2D is a struct and MS Test version 2.2.10 (or any version after 2.2.3) is used, some of the test cases of the test method Vector2D_op_Multiplication_Vector2D_Vector2D___valid_Vector2D___double_scalar_product fail. They fail deterministically (always the same cases fail). If you debug the failing tests you will notice that
the arguments of the test cases are mixedall structs have default values.The arguments that the factory method sends are not the arguments that the test method receives.
The two other test methods, that are structured in the same way, don't show this behaviour. They pass in all combinations as expected.The same happens here.Environment
Windows 10 21H2, Visual Studio 2019 or 2022, MS Test 2.2.10
The text was updated successfully, but these errors were encountered: