Chapter 1 : Backend API Development
Backend API Development
Build a Backend for your App.
Using development automation, build secure & scalable backend server with EasyManage API builder, use suitable database choice.
Data Modeling
Please refer to tutorial:
Testing - tests
- tests UT Unit Tests, IT Integration Tests
Unit Tests
Testing Frameworks and Tools Used
- JUnit
- Mockito
Unit Tests generated
emapi
project generates unit tests for -- Service Unit Test
- e.g.
emapi\lib\base-app\test\Product\ProductServiceUTest.java
- e.g.
- Controller Unit Test
- e.g. at
emapi\app\dbrest\test\Product\ProductDataRestControllerUTest.java
- e.g. at
- Service Unit Test
Integration Tests
- Testing Frameworks and Tools Used
- JUnit
- Mockito
- Using
@MockBean
- Using
info
Generated tests are based on this approach:
- Integration testing with @MockBean in Spring Boot involves replacing a real bean in the application context with a mock object. This allows for isolating and testing specific components of an application in integration tests.
- For integration tests focussing on integrating different layers of the application, with no mocking involved, below are provided:
Integration Tests generated
emapi
project generates integration tests for -- Controller
- e.g.
emapi\app\dbrest\test\Product\ProductRestApiITest.java
- e.g.
- Controller
Run Tests
Make sure properties are set,
<skipUTs>false</skipUTs>
<skipITs>false</skipITs>
To Run tests : Build project - verify
mvn clean verify
Surefire Report Aggregate
Generate Using command -
mvn surefire-report:report-only -Daggregate=true
- Report Location
emapi\target\site\surefire-report.html
- View Report Surefire Report for unit tests
Failsafe Report Aggregate
Generate Using command -
mvn surefire-report:failsafe-report-only -Daggregate=true
Report Location
emapi\target\site\failsafe-report.html
View Report Failsafe Report for integration tests