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
  • Test Granularity
  • File Naming Conventions
  1. Developers
  2. Troubleshooting & Guides
  3. Testing With Codeception
  4. Functional Testing

Functional Testing Best Practices

Test Granularity

Since one class can have multiple tests (and a functional test which tests all the methods/buttons/links on a page can have an excessive number of tests) it's a good practise to break the files down as granularly as possible.

For example, a Codeception test will check the Events Admin page. This page has multiple tabs:

  • setup

  • content

  • history

  • attendance

  • statistics

Each tabbed display has multiple fields that need to be tested. To put all tests into one file would make it difficult to maintain the test file, and time consuming to test if the developer wanted to focus on a single tab. By breaking these down into multiple files, it makes development and amendments much more streamlined.

/functional
  /events
    EventsSetupCest.php
    EventsContentCest.php
    EventsHistoryCest.php
    EventsAttendanceCest.php
    EventsStatisticsCest.php

Codeception will recursively test all files in each directory.

In the event that a specific feature on a page requires extensive tests, it is recommended that it be put in a separate file for clearly readability.

File Naming Conventions

Codeception functional tests are to be named with 'Cest' at the end of the file name.

example:

EventsSetupCest.php will be a Codeception test for the Setup tab on the Events page

CoursesCest.php will be a Codeception test for the Courses page

PreviousFunctional TestingNextIntegration Testing

Last updated 2 years ago