rsocket-java icon indicating copy to clipboard operation
rsocket-java copied to clipboard

Add ability to mock an RSocket connection for better isolation & testability

Open mkheck opened this issue 4 years ago • 3 comments

Add ability to mock an RSocket connection within unit tests to isolate functionality to one end of an RSocket connection for testing.

Motivation

Without the ability to mock an RSocket connection in unit tests, unit tests effectively become integration tests. The (current) necessity to create both RSocket client and server within a unit test adds a large amount of indirectly-related code that falls outside of the scope of testing one end of the connection and its functionality.

Desired solution

Provide a mechanism to mock an RSocket connection.

Considered alternatives

Current solution is to create and configure both ends, RSocket client and server, prior to testing an RSocket client. This adds a considerable amount of code to even a simple test and reduces the clarity and concision of the test.

Additional context

N/A

mkheck avatar Sep 28 '20 15:09 mkheck

See https://github.com/spring-cloud/spring-cloud-contract/issues/1173

spencergibb avatar Sep 28 '20 15:09 spencergibb

If we're just talking about simple mocking it out then that's not enough. It would be great to have an option to teach this mock how to behave, store the mock definition in a file that can be shared. That means that the stubbed RSocket server should have an API to reach it and tell it how to behave. Having a http://wiremock.org but for RSocket would be fantastic.

marcingrzejszczak avatar Sep 28 '20 17:09 marcingrzejszczak

+1

cheatmenot avatar Jun 04 '22 14:06 cheatmenot