The purpose of this repository is to demonstrate a TestPyramid implementation, with different automated test layers in action. For the purpose of this demonstration, we have built a web application (backed by http services) which is the application under testing.
The application we have is a scaled-down version of shopping-cart which has login and coupon-validation features.
The application itself has two functional components,
- A web application layer (simply the UI layer) >> Code is in frontend folder
- A service layer consisting of two micro-services,
- User service which provides user authentication >> Code is in user_service folder
- Coupon service which provides coupon validation >> Code is in coupon_service folder
We have built 4 layers of automated testing. They are,
- End-to-End (E2E) tests written as cucumber scenarios tagged as @e2e, located at ui-tests/features folder
- Stubbed tests written as cucumber scenarios tagged as @stub, located at ui-tests/features folder
- Service API (or simply Integration) tests written as JUnit tests, located within each individual service
- User service >> UserServiceTest.java
- Coupon service >> CouponServiceTest.java
- Unit tests written as JUnit tests, needless to say, are also bundled within each corresponding service
- User service
- Coupon service
To start the servers, for convenience, we have added a bash-script up
in frontend, user_service, coupon_service folders which will execute the necessary commands to start the corresponding server.
[sample-test-pyramid/user_service]$ ./up
[sample-test-pyramid/coupon_service]$ ./up
[sample-test-pyramid/frontend]$ ./up
For details of how to build or run the tests, refer to the individual README.md files in the corresponding folders,