This API was created with the assumption it would be linked up with a user interface for users to retrieve only the latest prices of selected instruments/currencies from a Foreign Exchange price feed and to be able to store them to access later. This API parses CSV data of various prices and modifies them accordingly by adding a margin adjustment to the bid prices and ask prices.
This was created using the following tech stack:
![](https://user-images.githubusercontent.com/37534696/172996666-3ee29d3f-a565-4c82-a581-f9f23c58a85b.png)
I created separate test files for the PriceController and PriceService
I attempted to use Mockito as part of my testing process, but this created many errors. Mockito appears to be used with dummy/mock data, but in this case I already had data to use and test. Due to time constraints I removed my Mockito code to keep my code clean, and chose to do continue my unit tests in JUnit. Unit Testing was done with JUnit to test the following cases:
Integration Testing done with Postman to ensure that all REST endpoints worked effectively.
Proposed strategy for E2E testing:
For E2E automation testing I think Mockito and Postman would be ideal test automation frameworks to use. Mockito can be used to automate all unit tests with mock data and mock objects. Postman can be used to automate the integration testing of the API so that removes the task of always manually refreshing Postman each time the API is altered. With API testing we need to analyze certain factors when sending the request and retrieving a response, such as data accuracy, HTTP status codes, response times, error codes in case the API returns any errors, and authorization checks. Spring Boot itself also the option to integrate Selenium for automation testing. Selenium is primarily used for web automation so this would be used when the entire FX trading application has been fully completed with both the API and the frontend user interface.
Possible Improvements
I would have liked to use Mockito effectively for my unit testing and would have liked to make my API more RESTful, to effectively handle responses, requests and any errors with HTTP status codes.