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

wheneverBlocking confuses with similar stub methods #486

Open
07jasjeet opened this issue Jul 12, 2023 · 0 comments
Open

wheneverBlocking confuses with similar stub methods #486

07jasjeet opened this issue Jul 12, 2023 · 0 comments

Comments

@07jasjeet
Copy link

07jasjeet commented Jul 12, 2023

Introduction

In the below screen shot, there are 3 stub methods which are almost same but differ in parameters supplied.

image

Problem

When a call to 2nd stub (testUsername) is executed, result of 3rd stub (testFamiliarUser) is returned. This is the main issue.

Variables

testUsername = "Jasjeet",
testFamiliarUser = "Jasjeettest",
testSomeOtherUser = "SomeOtherUser"

Analysis

  • When the 3rd stub is removed, the stub works as expected.

  • When the 1st stub is removed, the 3rd stub is again executed.

  • When 2nd stub (our target) is removed, rest of the stubs work fine as expected.

  • Now this is where things get interesting. When 2nd stub (with testUsername) and 3rd stub (with testFamiliarUser) interchange places, the stub with testUsername starts working but breaks the previously 3rd stub (with testFamiliarUser).

  • When 1st stub and 2rd stub interchange places the error still remains as initially, i.e., 1st and 3rd stubs work but 2nd doesn't.

  • When a new stub is declared with parameter as "JasjeetTesttttt", the 2nd stub (testUsername or "Jasjeet") starts working woohoo, but sadly 3rd stub (testFamiliarUser or "JasjeetTest") breaks and when called, result of 4th stub (the one we just declared) is returned.

  • Finally, according to my analysis, the problem occurs with stubs that have somewhat similar parameters. The stub that is declared second last in not considered, rest all are considered.

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