SVRUnit
  • Welcome
  • Installation
    • Installation
    • First Run
  • Use Cases
    • Verify Server
    • Verify Server for Project
    • Post Deployment Tests
    • Unit Test Docker Image
    • Testing your frameworks
  • Configuration
    • Configuration
  • Commands
    • list:suites
    • list:groups
    • test
  • Assertions
    • Command
    • Directory Exists
    • File Exists
    • File Content
    • File Permissions
    • PHP INI
    • PHP Modules
  • Reports
    • HTML Report
    • JUnit Report
  • Resources
    • svrunit.com
    • Github
Powered by GitBook
On this page
  • Expecting
  • Not Expecting
  • Expecting AND conditions
  • Expecting OR conditions
  • Setup / Teardown

Was this helpful?

  1. Assertions

Command

Use this assertion type to run any free command and verify its output with your expected value.

This is based on "string contains" assertions.

Expecting

Use this type of assertion to verify against an expected output of the command.

commands:
  - name: "NVM can switch Node version"
    command: "nvm use 14 && echo SVRUNIT: $(node -v)"
    expected: "SVRUNIT: v14."

Not Expecting

Use this type if you do not want your output to show the provided value.

commands:
  - name: "Xdebug not Corrupted"
    command: "php -v"
    not_expected: "zend_mm_heap corrupted"

Expecting AND conditions

Use this type if you do not want your output to show the provided value.

commands:
  - name: "Verify PHP 7.4 and OPcache v7.4"
    command: "php -v"
    expected_and:
      - "PHP 7.4"
      - "OPcache v7.4"

Expecting OR conditions

Use this type if you do not want your output to show the provided value.

commands
  - name: "Verify any of the allowed PHP versions"
    command: "php -v"
    expected_or:
      - "PHP 8.1"
      - "PHP 8.0"
      - "PHP 7.4"

Setup / Teardown

This test also offers separate command options as setup and teardown routine. Commands provided with these options, will be run prior and/or after the actual command of this test.

commands:
  - name: "..."
    command: "...."
    expected: "..."
    setup: "mkdir -p test_assets"
    teardown: "rm -f test_assets"
PrevioustestNextDirectory Exists

Last updated 2 years ago

Was this helpful?