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

Tests may behave differently in Release configuration #326

Open
timbussmann opened this issue Nov 19, 2024 · 0 comments
Open

Tests may behave differently in Release configuration #326

timbussmann opened this issue Nov 19, 2024 · 0 comments

Comments

@timbussmann
Copy link

I've noticed that some tests which fail in Debug configuration no longer fail in our CI pipeline as the tests in the pipeline are running in Release configuration. Code optimizations applied in release config can lead to validations not properly working anymore.

I have a demo repro available here: https://github.com/timbussmann/ArchUnitNetRepro:

The problem is that due to async state machine optimizations, this code:

public async Task DoSomethingAsync()
    {
        await service.SomeAsyncMethod();
    }

does not violate the following assertion anymore since the actual call has been extracted into the async state machine:

Classes().Should().NotCallAny(MethodMembers().That().AreDeclaredIn(typeof(ExampleService)))

I'm aware that this isn't necessarily ArchUnit.NET's fault, but it's a problem one can easily run into without noticing for a long time, making the tests less useful.

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

No branches or pull requests

1 participant