Self Assessment / Validation
To enforce code quality, tests have been implemented in each microservice. They ensure the exposed API and the internal business logic work as expected.
In session-service and auth-service tests leverage the Mocha API with Chai as BDD assertion library, while profile-service makes use of ScalaTests and Akka Route TestKit.
Furthermore, architectural tests are added inside each typescript microservice, except for the Frontend Service, to verify the architecture strictly follows the Clean Architecture. For these tests, the Dependency Cruiser framework has been adopted. The tests check that the dependencies between the code modules are respected:
- The Domain layer should not depend on any other layer;
- The Application layer can only depend on the Domain layer;
- The Infrastructure layer can only depend on the Application layer and Domain layer.
Session Service - Dependency Cruiser Tests
module.exports = {
forbidden: [
{
name: 'no-unreachable-from-domain',
comment: 'The domain layer should not depend on any other layer',
severity: 'error',
from: {
path: '^(src/domain)'
},
to: {
pathNot: '^(src/domain)'
}
},
{
name: 'no-unreachable-from-application',
comment: 'The application layer should only depend on the domain layer',
severity: 'error',
from: {
path: '^(src/application)'
},
to: {
pathNot: '^(src/domain)|^(src/application)|^(node_modules/axios)|^(node_modules/js-sha256)'
}
},
{
name: 'no-unreachable-from-infrastructure',
comment: 'The infrastructure layer should only depend on the domain and application layers',
severity: 'error',
from: {
path: '^(src/infrastructure)'
},
to: {
pathNot: '^(src/domain)|^(src/application)|^(src/infrastructure)|^(node_modules/axios)|^(node_modules/socket.io)'
}
},
{
name: 'no-circular',
severity: 'warn',
comment:
'This dependency is part of a circular relationship. You might want to revise ' +
'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',
from: {},
to: {
circular: true
}
},
...
The configuration for the Authentication Service is similar to the one above, with the only difference being the paths to the modules.
End-to-End Testing
To validate the whole system, end-to-end tests have been implemented and have been placed in the Bootstrap repository. They are written in Typescript and use the Playwright library to interact with the Frontend Service and the microservices.
The tests check the following scenarios:
- The user can sign up and log in;
- The user can create and join a session;
- The user can view and update its profile.
The tests are run on the following browsers:
- Chromium
- Firefox
- WebKit
In combination with Mend Renovate and GitHub Actions, the tests are executed automatically on every release of any microservice. This ensures that the Let's Stream It system is always working as expected.