CodePress/function-test/function-test.md
Edwin Noorlander fcedacee5f Implement code quality improvements and testing infrastructure (v1.0.0)
- Remove unused functions (sanitizePageParameter, getAllPageNames, detectLanguage)
- Remove most debug error_log statements from production code
- Add structured logging system with Logger class (DEBUG/INFO/WARNING/ERROR levels)
- Implement version tracking system (version.php v1.0.0)
- Display version number in footer template
- Add comprehensive functional test suite (50+ tests, 92% pass rate)
- Add detailed improvement report with implementation status (VERBETER_RAPPORT.md)

Code quality improvements:
- 41 lines of unused code removed
- Cleaner, more maintainable codebase
- Professional logging infrastructure
- Version tracking for releases

Testing additions:
- Functional test plan with 20 categories
- Detailed test report with 50+ test cases
- 92% success rate on functional tests

Overall quality score improved from 96/100 to 98/100.
2025-11-24 16:37:39 +01:00

13 KiB

CodePress CMS Functional Testing Plan

Version: 1.0
Date: 24-11-2025
Test Environment: Development (localhost:8080)


📋 Test Scope

This document outlines comprehensive functional tests for CodePress CMS to verify all features work as expected.


1. Content Rendering Tests

1.1 Markdown Content

Test: Verify Markdown files render correctly with proper HTML conversion

Steps:

  1. Navigate to a Markdown page
  2. Verify headings render correctly
  3. Check lists (ordered/unordered)
  4. Verify code blocks
  5. Check links and images
  6. Test bold/italic formatting

Expected Result: All Markdown elements render as proper HTML


1.2 HTML Content

Test: Static HTML pages display correctly

Steps:

  1. Navigate to .html page
  2. Verify content displays
  3. Check custom CSS/styling
  4. Test embedded elements

Expected Result: HTML content displays within CMS layout


1.3 PHP Content

Test: Dynamic PHP pages execute and render

Steps:

  1. Navigate to .php page
  2. Verify PHP code executes
  3. Check dynamic data displays
  4. Test PHP functions work

Expected Result: PHP executes server-side and output displays correctly


2. Navigation Tests

2.1 Menu Generation

Test: Verify automatic menu generation from directory structure

Steps:

  1. Check top navigation menu exists
  2. Verify all directories appear as menu items
  3. Test nested directories show as dropdowns
  4. Verify menu items are clickable
  5. Check active page highlighting

Expected Result: Complete menu structure generated automatically


2.2 Breadcrumb Navigation

Test: Breadcrumb trail shows correct path

Steps:

  1. Navigate to nested page
  2. Verify breadcrumb shows full path
  3. Click breadcrumb items to navigate up
  4. Test home icon navigation

Expected Result: Breadcrumb accurately reflects current location


2.3 Homepage

Test: Default page loads correctly

Steps:

  1. Navigate to root URL
  2. Verify default page displays
  3. Check homepage link in navigation

Expected Result: Homepage (index) loads by default


3. Search Functionality

Test: Search finds content across pages

Steps:

  1. Enter search term in search box
  2. Submit search
  3. Verify results display
  4. Check result accuracy
  5. Test result links work

Expected Result: Relevant pages appear in search results


3.2 Search Edge Cases

Test: Search handles special cases

Steps:

  1. Search with empty query
  2. Search with no results
  3. Search with special characters
  4. Search with very long query

Expected Result: Graceful handling of edge cases


4. Multi-Language Support

4.1 Language Detection

Test: CMS detects and displays correct language

Steps:

  1. Check default language (nl)
  2. Switch to English (en)
  3. Verify language switcher works
  4. Check content in correct language displays

Expected Result: Language switching works seamlessly


4.2 Language-Specific Content

Test: Content filters by language prefix

Steps:

  1. Create nl.test.md and en.test.md
  2. Switch between languages
  3. Verify correct content displays
  4. Check menu items update

Expected Result: Only content for selected language shows


5. File Information

5.1 File Metadata

Test: File creation/modification dates display

Steps:

  1. Navigate to any page
  2. Check footer for file info
  3. Verify creation date
  4. Verify modification date
  5. Check file size (if displayed)

Expected Result: Accurate file metadata in footer


6. Guide System

6.1 Guide Page

Test: Built-in guide displays correctly

Steps:

  1. Click guide link in footer
  2. Verify guide content displays
  3. Check formatting
  4. Test navigation within guide
  5. Verify language-specific guide

Expected Result: Guide page accessible and readable


6.2 Empty Content Detection

Test: Guide shows when no content exists

Steps:

  1. Remove all content from content directory
  2. Navigate to site
  3. Verify guide displays automatically
  4. Check guide explains next steps

Expected Result: Helpful guide appears for empty sites


7. URL Routing

7.1 Clean URLs

Test: URL parameters work correctly

Steps:

  1. Test ?page=test/demo
  2. Test ?page=blog/post&lang=en
  3. Test ?search=query
  4. Test ?guide

Expected Result: All URL patterns route correctly


7.2 404 Handling

Test: Non-existent pages show proper error

Steps:

  1. Navigate to non-existent page
  2. Verify 404 error displays
  3. Check error message is user-friendly
  4. Verify navigation still works

Expected Result: Custom 404 page without sensitive info


8. Template System

8.1 Mustache Templating

Test: Template variables render correctly

Steps:

  1. Check page title in browser tab
  2. Verify site title in header
  3. Check breadcrumb generation
  4. Verify menu generation
  5. Test language variables

Expected Result: All template variables populate correctly


8.2 Content Types

Test: Different content types use correct templates

Steps:

  1. View Markdown page
  2. View HTML page
  3. View PHP page
  4. View directory listing
  5. Check each uses appropriate template

Expected Result: Content-specific templates applied


9. Theme/Styling

9.1 CSS Loading

Test: All stylesheets load correctly

Steps:

  1. Open page
  2. Check Bootstrap CSS loads
  3. Verify custom CSS loads
  4. Test responsive design
  5. Check mobile CSS

Expected Result: Complete styling on all devices


9.2 Custom Theme Colors

Test: Theme colors from config apply

Steps:

  1. Check header background color
  2. Verify navigation colors
  3. Test custom theme settings
  4. Verify colors match config

Expected Result: Theme configuration applied correctly


10. Performance

10.1 Page Load Speed

Test: Pages load within acceptable time

Steps:

  1. Measure homepage load time
  2. Test deep nested page
  3. Check large content page
  4. Test search results page

Expected Result: All pages load under 2 seconds


10.2 Caching

Test: Repeated requests are fast

Steps:

  1. Load page first time
  2. Load same page again
  3. Compare load times
  4. Check browser caching headers

Expected Result: Subsequent loads are faster


11. Security Features

11.1 Input Sanitization

Test: User input is properly escaped

Steps:

  1. Test XSS attempts in search
  2. Test path traversal in page param
  3. Test script injection in lang param
  4. Verify all inputs sanitized

Expected Result: All malicious input blocked/escaped


11.2 Access Control

Test: Protected files are inaccessible

Steps:

  1. Try accessing /content/ directly
  2. Try accessing /engine/ files
  3. Try accessing config.php
  4. Try accessing /vendor/

Expected Result: All sensitive paths return 403/404


11.3 Security Headers

Test: Proper security headers set

Steps:

  1. Check for CSP header
  2. Verify X-Frame-Options
  3. Check X-Content-Type-Options
  4. Verify X-XSS-Protection
  5. Check Referrer-Policy

Expected Result: All security headers present


12. Error Handling

12.1 Graceful Errors

Test: Errors don't crash the system

Steps:

  1. Trigger various error conditions
  2. Check error messages are generic
  3. Verify site remains functional
  4. Test navigation after error

Expected Result: Graceful error handling, no crashes


12.2 Missing Files

Test: Missing content files handled correctly

Steps:

  1. Reference non-existent file
  2. Check error message
  3. Verify 404 response
  4. Test recovery

Expected Result: Clean 404 without exposing system details


13. Configuration

13.1 Config Loading

Test: Configuration file loads correctly

Steps:

  1. Verify config.json is read
  2. Check default values apply
  3. Test custom config values
  4. Verify config hierarchy

Expected Result: Configuration applied correctly


13.2 Config Validation

Test: Invalid config handled gracefully

Steps:

  1. Test with missing config
  2. Test with invalid JSON
  3. Test with missing required fields
  4. Verify fallbacks work

Expected Result: Defaults used when config invalid


14. Content Directory Structure

14.1 Nested Directories

Test: Deep directory structures work

Steps:

  1. Create nested structure (3+ levels)
  2. Navigate to deep page
  3. Check menu generation
  4. Verify breadcrumbs
  5. Test all levels accessible

Expected Result: Unlimited nesting supported


14.2 Mixed Content Types

Test: Different file types in same directory

Steps:

  1. Place .md, .html, .php in same folder
  2. Verify all appear in menu
  3. Test navigation to each
  4. Check correct rendering

Expected Result: All content types coexist properly


15. Auto-Linking

Test: Content auto-links to other pages

Steps:

  1. Reference page titles in content
  2. Verify links created automatically
  3. Test link accuracy
  4. Check link format

Expected Result: Automatic internal linking works


Test: Auto-linking respects exclusions

Steps:

  1. Check existing links aren't double-linked
  2. Verify H1 headings not linked
  3. Test current page title not linked

Expected Result: Smart linking without duplicates


16. Mobile Responsiveness

16.1 Mobile Layout

Test: Site works on mobile devices

Steps:

  1. Open site on mobile viewport
  2. Test navigation menu (hamburger)
  3. Check content readability
  4. Test search functionality
  5. Verify touch interactions

Expected Result: Fully functional mobile experience


16.2 Tablet Layout

Test: Site adapts to tablet screens

Steps:

  1. View on tablet viewport
  2. Check layout adjustments
  3. Test navigation
  4. Verify content flow

Expected Result: Optimized tablet layout


17. Browser Compatibility

17.1 Modern Browsers

Test: Works in major browsers

Steps:

  1. Test in Chrome
  2. Test in Firefox
  3. Test in Edge
  4. Test in Safari
  5. Verify consistent behavior

Expected Result: Works in all modern browsers


18. Content Edge Cases

18.1 Special Characters

Test: Special characters in filenames/content

Steps:

  1. Test files with spaces
  2. Test files with special chars
  3. Test unicode content
  4. Test emoji in content

Expected Result: Special characters handled correctly


18.2 Large Content

Test: System handles large files

Steps:

  1. Create very large Markdown file
  2. Test rendering
  3. Check performance
  4. Verify no truncation

Expected Result: Large content renders completely


19. Static Assets

19.1 Asset Loading

Test: CSS/JS/Images load correctly

Steps:

  1. Check Bootstrap CSS loads
  2. Verify Bootstrap JS loads
  3. Test custom CSS
  4. Check icons load
  5. Verify images display

Expected Result: All assets load from /assets/


19.2 Asset Caching

Test: Static assets cached properly

Steps:

  1. Load page
  2. Check network tab
  3. Verify assets cached
  4. Test cache headers

Expected Result: Efficient asset caching


20. Demo Content

20.1 Demo Static Page

Test: demo-static.html displays correctly

Steps:

  1. Navigate to /test/demo-static
  2. Verify HTML content displays
  3. Check Bootstrap styling applies
  4. Test all HTML elements

Expected Result: Static demo page works perfectly


20.2 Demo Dynamic Page

Test: demo-dynamic.php executes correctly

Steps:

  1. Navigate to /test/demo-dynamic
  2. Verify PHP executes
  3. Check counter increments
  4. Test server info displays
  5. Verify table renders

Expected Result: Dynamic demo page functions correctly


Test Execution Template

For each test, record:

  • PASS - Feature works as expected
  • FAIL - Feature broken or incorrect
  • ⚠️ WARNING - Works but has issues
  • 🔄 SKIP - Not applicable/tested

Test Report Format

## Test Results - [Date]

### Summary
- Total Tests: X
- Passed: X
- Failed: X
- Warnings: X
- Skipped: X

### Failed Tests
1. [Test Name] - [Reason]
2. [Test Name] - [Reason]

### Warnings
1. [Test Name] - [Issue]

### Recommendations
- [Recommendation 1]
- [Recommendation 2]

Automation Suggestions

Consider automating these tests with:

  • Playwright/Puppeteer - Browser automation
  • PHPUnit - PHP unit tests
  • Cypress - E2E testing
  • Jest - JavaScript testing

Test Frequency

  • Before each release - Full test suite
  • Weekly - Critical path tests
  • After changes - Related feature tests
  • Monthly - Complete regression testing

Next Steps:

  1. Execute all tests systematically
  2. Document results
  3. Fix any failures
  4. Retest after fixes
  5. Update this document with findings