-
Notifications
You must be signed in to change notification settings - Fork 36
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
AssertFailedException - JustMock xUnit method occurrence intermittently fails. #151
Comments
Hello @adison88, thanks for letting us know about this problem. I suppose that is somehow related to async processing, but I am not certain enough. Could you please give a short code snippet that reproduces the issue. |
@ivo-stoilov Please refer to below snippet. Occurence for IBusiness4 fails with there's IBusiness3 method is being run as a part of another task.
|
Hello @adison88, I am unable to observe the issue using the latest JustMock NuGet (2021.2.511.1, see attached sample project). However, I meet another error:
It seems that the following arrangement fails:
since the task is able to call IBusiness3.Load by a chance. I will recommend you to enable debug trace for the failing test, rerun it and send us the produced output as a text file, Also it would be good to know which versions of JustMock and Xunit you are using. I look forward to your reply, so we can plan further steps in resolving the issue. |
Thanks for looking into it. I'll get you the logs soon once we reproduce the issue again on our side. Versions that are in use - JustMock - 2019.3.910.4 |
@ivo-stoilov Please find the attached trace and let me know if anything else is needed. |
Hello @adison88, looking at the log file did not help so much, it looks like it was produced by the test with code, which does not match the snippet you have already sent, the method signatures of the arrangements are different (in bold): Arrangements and expectations: I also tried to experiment with the sample project from the previous message by downgrading the JustMock and Xunit.Runner.VisualStudio versions to the corresponding ones, but with no luck. I am afraid that without stable reproduction it would be hard to identify the root cause of the issue. However, I encourage you to set up a minimal project (you can use sample one as a good starting point) that reproduces the problem. Any other relevant information that might help is also greatly appreciated. |
@ivo-stoilov Could you please try with below project if you can reproduce it? Our builds run with more than 6000 unit tests and in parallel so it's little challenging for us to reproduce it locally as the failure occurred intermittently. |
Hello @adison88, I think that the key to resolving this issue is parallel execution. It might be a surprise for you, but there is a good reason that JustMock is not fully supporting parallelism, please take a look at the following explanation. You can try to disable parallel execution at the assembly level to see whether it would fix the issue. I agree that it is a kind of trade-off, but I hope that now you have a better understanding of the current framework limitations. |
We are trying to run unit tests via xUnit and mocking method occurence using JustMockLite. Method under arrange is creating a underlying Task however, once in a while test fails with following error
The text was updated successfully, but these errors were encountered: