Smoke Testing

Elaboration

Smoke testing is a superficial level of testing conducted by developers to make sure that all the functions of application work. They do not go into the finer details of the app, focusing rather on the major functionalities. Smoke tests can be either executed manually or be automated.
Typically these tests are run after the deployment process to check application status and in the worst case can trigger process responsibility for rollback application to the previous version. The major mission of smoke test tests is exposing integration issues and uncovering problems early. Also, it provides some level of confidence that changes to the software have not adversely affected major areas.

My solution

In my repository (https://github.com/tarnawski/smoke-test) you can find a prepared configuration for Behat (http://docs.behat.org) and Behat API Extension (https://behat-api-extension.readthedocs.io) which help with the automatic testing. Sample tests are located in the /feature folder.

Here an example test case wrote using Gherkin language:

Feature: Checking the Associator API operation
  In order check application work correctly
  As a client
  I need to get application status

  Scenario: Get status of application
    Given the "Content-Type" request header contains "application/json"
    When I request "/v1/status"
    Then the response code is 200
    And the response body contains JSON:
    """
    {
      "status": "Success",
      "version": "1.0"
    }
    """

 

Locally you can run the tests with one command using Docker containers:

docker run --rm --interactive --tty --volume $PWD:/app composer install && bin/behat

But please! Automate your work! You can use GitLab CI for this:

image: composer:latest

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
  - vendor/

before_script:
- composer install --no-progress --no-suggest

smoke-tests:
  script:
  - bin/behat -f progress