You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Introduction
In the below screen shot, there are 3 stub methods which are almost same but differ in parameters supplied.
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 (withtestFamiliarUser
) interchange places, the stub withtestUsername
starts working but breaks the previously 3rd stub (withtestFamiliarUser
).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.
The text was updated successfully, but these errors were encountered: