A simple app with a Java backend and Angular frontend. This is the fifth project of my course as a full-stack Java / Angular developer with OpenClassrooms. The goal here is to write unit, integration and e2e tests for the app provided by Openclassrooms, with a code coverage requirement of 80%.
- Java 8
- Access to a MySQL server and a database
- Maven
- Git
- Postman for testing purposes
- Clone this repository on your local machine or server and go to directory
git clone https://github.com/wilzwert/savasana.git
cd savasana- Configuration
MySQL configuration by default :
database name = 'test'
user = 'user'
password = '123456'
You can change this configuration by editing the application.properties files located in :
back/src/main/resources
- Import the schema provided in ressources/sql/script.sql into your database
You can either use a GUI like PhpMyAdmin or load the file from command line :
mysql -u user -p database_name < resources/sql/script.sql- Install backend dependencies
Windows :
cd back
mvnw clean installLinux / unix :
cd back
mvn clean installOr directly in your favorite IDE
- Install frontend dependencies
cd front
npm installWindows :
cd back
mvnw spring-boot:runLinux / unix :
cd back
mvn spring-boot:runThis will make the API available on localhost:8080.
- run frontend
cd front
npm run startor
cd front
ng serve- With provided Postman collection : see ressources/postman/yoga.postman_collection.json
Import the collection in Postman : https://learning.postman.com/docs/getting-started/importing-and-exporting-data/#importing-data-into-postman
Then run the collection.
- Use the "real" frontend provided by OpenClassrooms, available by default on http://localhost:4200 once frontend application is started.
Unitary and integration tests are located in back/src/test/java/com.openclassrooms.starterjwt. Unitary tests classes names are suffixed by 'Test', integration tests classes names are suffixed by 'IT'.
cd back
Unitary tests are run with Maven Surefire Plugin.
mvn clean test
Jacoco report with code coverage is located in target/site/jacoco-ut/index.html
Integration tests are run with Maven Failsafe Plugin.
mvn clean verify
Jacoco report with code coverage is located in target/site/jacoco-merged/index.html
Unitary tests filenames are suffixed with .spec.ts.
Integration tests filenames are suffixed with .integration.spec.ts.
Launching tests:
npm run test
for following change:
npm run test:watch
Launch unitary and integration tests with coverage report generation
npm run test:coverage
Report is available here:
front/coverage/jest/lcov-report/index.html
End-to-end tests files are located in front/cypress/e2e.
Launching e2e tests manually with Cypress UI :
npm run e2e
Launching all e2e tests automatically in CLI (headless) with report generation :
"npm run e2e:ci"
Report is available here:
front/coverage/e2e/lcov-report/index.html