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

Was this helpful?

  1. Use Cases

Post Deployment Tests

SVRUnit can also be used to test different files and requirements on your server after a deployment.

Just imagine that you need to test that your .env file exists, or that your cache folder has the correct permission.

There's plenty of things you can do here.

Because SVRUnit allows you to install it with Composer, it is recommended to install it directly as dependency. You can of course also use the PHAR file for this.

composer require svrunit/svrunit

Now create a XML configuration file that specifies a single YML test file (or more...)

<svrunit>  
  <testsuites>   
      
      <testsuite name="Post Deployment Tests">         
         <file>./post_deployment_tests.yml</file>      
      </testsuite>   
        
  </testsuites>
</svrunit>

Last but not least, we need the specification of our tests in the YAML file.

file_exists:

  - name: ".env file is deployed"
    file: "/var/www/html/.env"
    expected: true
        
  ....
  ....

That's it!

You can now manually run your tests, or even use your CI/CD pipeline for this.

php vendor/bin/svrunit --configuration=deployment_tests.xml  

PreviousVerify Server for ProjectNextUnit Test Docker Image

Last updated 2 years ago

Was this helpful?