Testing With Codeception

Elentra uses Codeception as its integrated testing environment. It allows you to create and run unit tests, integration tests, and functional tests separately or together.
Unit tests are designed to run quickly and test small portions of code that have no external dependencies. For example, testing a function that takes a Models_User object and returns an array with the name, address, and email.
Integrations tests are for testing multiple units that work together. An example would be an API call to get a list of a given Learner's courses.
Functional tests will test the interaction of code that is in multiple integration tests, like a Learner's dashboard page that contains a list of courses, Message Centre, Assessments, etc.
Codeception test files are found in the /developers/tests section of your Elentra ME development environment, and basic configuration is in /developers/codeception.yml. Configuration for the individual kinds of tests can be found in /developers/tests/*.suite.yml

The Difference Between Unit and Integration Testing

Unit Testing
Integration Testing
Unit tests mock interactions with external dependencies (database, IO, etc.)
Integration tests use the real dependencies
Developers write unit tests
Testers or other QA professionals usually write integration tests
Unit tests provide precise feedback
Integration tests provide less precise feedback
It tests a unit without the need for other units to be complete
The units must all be complete
Developers run unit tests on their machines frequently
Developers run integration tests on their machines less frequently, or not at all
The CI server runs the unit test suite at each commit to the main branch or check-in
The CI server might run integration tests less often, as they need a more involving setup process and are slower to run
Unit tests are easier to write
Integration tests are harder to write
Unit tests can be run in any order, or even simultaneously
Integration tests usually required a strict order and can’t be run simultaneously
Unit tests are stable
Integration tests can experience instability due to reliance on remote resources and potential network conditions