Elentra Platform Technical Documentation
  • Introduction
  • Reporting Issues
    • Security Notices
  • Administrators
    • Server Requirements
    • Application Server
      • Shibboleth Single Sign-on
      • Installing Supervisor
      • Branded API Setup
      • Installing Mailhog
    • Database Server
  • Developers
    • Getting Started
    • Overview
    • Contributions
      • Request for Change
      • Jira and GitHub Details
      • Coding Standards
      • Quickstart Guide
      • Code Review
    • Database
    • Dataviews for Analytics
    • Global Namespace
    • Elentra ACL
    • Authentication Methods
    • Compatibility Matrix
    • Elentra ME Versions
    • Elentra Settings
    • Elentra Deployment
    • Elentra API
    • Elentra JS
    • Feature Configuration
      • Event Resource Integration
      • Microsoft Teams Integration
    • Troubleshooting & Guides
      • New developer features in Elentra ME 1.22
      • Testing With Codeception
        • Unit Testing
          • Unit Testing Best Practises
          • Writing Unit Testable Code
          • PHPUnit Testing for API
          • PHPUnit Json String Compare Function
        • Functional Testing
          • Functional Testing Best Practices
        • Integration Testing
          • Integration Testing Best Practices
      • Upgrading elentra-developer Docker
      • VS Code Setup
      • Using XDebug in VSCode
      • Upgrading PHP
      • Switching Databases
      • Creating a new virtual host
      • Logging In
      • Composer
      • Curriculum Tag Selector
      • Performance Issues
      • Docker
      • Seed Data Generation
      • Fail Fast Programming
      • Advanced Custom Exception Classes
    • Support
  • Upgrade Guides
    • Upgrading to ME v28.0
    • Upgrading to ME 1.27
    • Upgrading to ME 1.26
    • Upgrading to ME 1.25
    • Upgrading to ME 1.24
    • Upgrading to ME 1.23
    • Upgrading to ME 1.22
    • Upgrading to ME 1.21
    • Upgrading to ME 1.20
    • Upgrading to ME 1.19
    • Upgrading to ME 1.18
    • Upgrading to ME 1.17
    • Upgrading to ME 1.16
    • Upgrading to ME 1.15
Powered by GitBook
On this page
  1. Developers
  2. Troubleshooting & Guides

Testing With Codeception

PreviousNew developer features in Elentra ME 1.22NextUnit Testing

Last updated 1 year ago

Elentra uses 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

Codeception