Skip to content

Conversation

@ARMS2025
Copy link

We are researchers and analyzed the test doubles (mocks) in the test code of the project. In our analysis of the project, we observed that

  • 1 stubbing for the getCapability method is created in QueryTest.initQueryObject and is stubbed with argument
    "platformName", but in actual execution, it is called with argument "automationName", resulting in mismatched stubbings. This mismatch occurred in tests: returnsAValidSelectElement, returnsAValidSelectElement, returnsDefaultLocator, returnsChromeLocatorIfSet, checkAlternateLocatorIsCaseInsensitiveWithUpper, checkAlternateLocatorIsCaseInsensitiveWithLower, returnsWebElement ,returnsWebElementList, findMobileElementThrowsUnsupportedOperationExceptionIfPlatformIsNotAMobileType, findMobileElementThrowsUnsupportedOperationExceptionIfPlatformIsAGenericName,

In this pull request, we propose a solution to resolve the mismatch stubbing.

Mismatched stubbing occurs when a mocked method is stubbed with specific arguments in a test but later invoked with different arguments in the code, potentially causing unexpected behavior. Mockito recommends addressing these issues, (https://www.javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/exceptions/misusing/PotentialStubbingProblem.html)

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

Successfully merging this pull request may close these issues.

1 participant