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

Assertion arguments should be passed in the correct order #2371

Closed
Evangelink opened this issue Feb 19, 2024 · 2 comments · Fixed by #2556
Closed

Assertion arguments should be passed in the correct order #2371

Evangelink opened this issue Feb 19, 2024 · 2 comments · Fixed by #2556

Comments

@Evangelink
Copy link
Member

Evangelink commented Feb 19, 2024

Summary

The standard assertions library methods such as AreEqual and AreSame expect the first argument to be the expected value and the second argument to be the actual value.

Having the expected value and the actual value in the wrong order will not alter the outcome of tests, (succeed/fail when it should) but the error messages will contain misleading information.

This rule raises an issue when the actual argument to an assertions library method is a hard-coded value and the expected argument is not. We assume that a literal, constant or variable/field/property containing expected in its name is the expected value and that any variable containing actual is the actual value.

Category: Assertion
Enabled by default: True
Default severity: Info

AB#1992481

@testplatform-bot
Copy link
Contributor

✅ Successfully linked to Azure Boards work item(s):

@fforjan
Copy link

fforjan commented May 24, 2024

@Evangelink you were asking for some inputs, a code fix for this rule would be welcome ! We have 600 of this issue in our code base, it will be good to have a code fix to allow us to quickly fix it instead of manually fixing it !

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

Successfully merging a pull request may close this issue.

3 participants