SPIKE [FAT-1635] mod-inn-reach: Using Inn-Reach sandbox environment and (or) mock server in integration tests
Preface
Integration testing (sometimes called integration and testing, abbreviated I&T) is the phase in software testing in which individual software modules are combined and tested as a group. Integration testing is conducted to evaluate the compliance of a system or component with specified functional requirements. (https://en.wikipedia.org/wiki/Integration_testing)
INTEGRATION TESTING is defined as a type of testing where software modules are integrated logically and tested as a group. A typical software project consists of multiple software modules, coded by different programmers. The purpose of this level of testing is to expose defects in the interaction between these software modules when they are integrated (https://www.guru99.com/integration-testing.html)
Possible solutions:
Have a dedicated Inn-Reach environment for integration testing
Shareable Inn-Reach environment
Pros
it's already present, there is no need to somehow set this up.
real system with real interaction and behavior.
up to date API definition – instant recognition of integration issues
Cons
more attention should be paid to setting up configuration data for a test as well as test flow data. the data shouldn't affect existing configuration or transactions on the server. this brings additional level of complexity into the tests.
carefully clean up all types of data added by tests. might be tricky in some cases (for instance removal option via API calls is not available)
karate tests have to executed at a specific time (to be defined) to not to overlap with regular testing activities on Rancher envs
this might require additional configuration/customization of karate job on Jenkins
could be unavailable due to some maintenance activities or issues on Inn-Reach side, although this should be a rare case
availability time might vary between hours up to several days
Investigation points / open questions
identify test execution time frame
talk to PO and the team to negotiate the time for test execution so that it doesn't effect PO acceptance testings and development
understand modifications to Jenkins jobs running the tests
collaborate with devops to figure out what should be done to execute the tests during custom defined period of time – [task]
creating central server with sandbox's secret keys in karate tests
investigate ways of storing and accessing the keys from the secret key store (AWS / Vault / other). should be discussed with devops – [task]
collect statistics about mod-inn-reach endpoints that are posting date into Inn-Reach system – [task]:
what the endpoint is –
name plus a related user story (if present)
what information is posted into Inn-Reach system
how this information can be removed from Inn-Reach system –
the knowledge is very important for clean up procedures (when test(s) is finished). if there is no easy way to remove the data then the possibility is high that the endpoint cannot be covered with karate tests.
the list of endpoints that cannot be tested should be documented or somehow highlighted in the statistics
try to implement different business scenarios (sort of PoC)
configuration
circulation action
circulation event processing
contribution
Mock server
Pros
managed on Folio side – total control on deployment and availability
expected to be faster than a real system
test execution takes less time due to preset nature of mocks. although it shouldn't be considered as a primary advantage.
there is no need to remove data created during test execution
depending on the test it might be required to simply restart the server or do nothing at all
no specific requirements related to test execution time frame, since it's going to be an independent environment
Cons
test development time higher due to necessity of defining mocked responses apart from writing test code
mocks complexity for combined flows (circulation/contribution) that includes sequential interaction with other Folio modules and Inn-Reach
returned mocks could depend on some business conditions raised by the flow
mock data could be dynamically changed depending on incoming request(s) and current step in the flow
potential inconsistency in behavior and returned data between real system and mock server
API of the real system could be changed – but this cannot be tracked down automatically to mock server
if API is changed mock(s) should be adjusted manually
additional resources required from maintenance and deployment perspectives
Investigation points / open questions
study existing solutions for mocking (mock servers) and choose the appropriate one – https://folio-org.atlassian.net/browse/FAT-1652
some candidates are:
wiremock (standalone) - https://wiremock.org/docs/
prism - https://meta.stoplight.io/docs/prism/ZG9jOjYx-overview
karate mocks - https://github.com/karatelabs/karate/tree/master/karate-netty
TBD
capabilities of interest
deployment options (docker, command line etc)
automatic mocking from provided API spec
supporting of dynamic/conditional content
TBD
find out if Inn-Reach API can be provided as standard API specification (Swagger/Open API, RAML etc)
right now we've only been given a pdf file which describes the API
understand modifications to Jenkins jobs running the tests
collaborate with devops to figure out what should be done to setup and deploy the mock server – https://folio-org.atlassian.net/browse/FAT-1653
try to implement different business scenarios (sort of PoC)
configuration
circulation action
circulation event processing
contribution