• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💨 Smoke testing tool written in PHP

Cigar

Build Status Coverage Status SensioLabsInsight

A smoke testing tool inspired by symm/vape

Similar tools include:

Installation

Install via composer:

composer require brunty/cigar --dev

Pull via docker:

docker pull brunty/cigar

To use

Create a .cigar.json file that contains an array of json objects specifying the url, status, (optional) content, and (optional) content-type to check.

[
  {
    "url": "http://httpbin.org/status/418",
    "status": 418,
    "content": "teapot"
  },
  {
    "url": "http://httpbin.org/status/200",
    "status": 200,
    "content-type": "text/html"
  },
  {
    "url": "http://httpbin.org/status/304",
    "status": 304
  },
  {
    "url": "http://httpbin.org/status/500",
    "status": 500
  }
]

When installed via composer:

Run vendor/bin/cigar to have it check each of the URLs return the status code expected.

When pulled via docker:

Run docker run -v $(pwd):/app --rm brunty/cigar to have it check each of the URLs return the status code expected.

> vendor/bin/cigar                                           
✓ http://httpbin.org/status/418 [418:418] teapot
✓ http://httpbin.org/status/200 [200:200] [text/html:text/html] 
✓ http://httpbin.org/status/304 [304:304] 
✓ http://httpbin.org/status/500 [500:500] 

The format of the lines in the output is:

pass/fail url [expected_code:actual_code] [optional_expected_content-type:optional_actual_content-type] optional_text

If all tests pass, the return code $? will be 0 - if any of them don't return the expected status code, the return code will be 1

Quiet test mode

If you wish to suppress the output of the test run, pass the --quiet option to the command: vendor/bin/cigar --quiet

Alternative configuration files

If you wish to use an alternative configuration file, use the vendor/bin/cigar -c file.json or vendor/bin/cigar --config=file.json options when running the command.

Passing a base URL to check against

If you wish to check a file of URLs relative to the root of a site against a base URL, you can do so with by using vendor/bin/cigar -u http://httpbin.org or vendor/bin/cigar --url=http://httpbin.org

Your configuration file can then contain URLs including:

  • Full absolute URLs as before (cigar won't use the base URL when checking an absolute URL)
[
  {
    "url": "http://httpbin.org/status/418",
    "status": 418,
    "content": "teapot"
  }
]
  • URLs relative to the base url that you've specified, either with or without a leading slash.
[
 {
   "url": "/status/418",
   "status": 418,
   "content": "teapot"
 },
 
 {
   "url": "status/418",
   "status": 418,
   "content": "teapot"
 }
]

Disabling SSL cert verification

If you wish to run the tool without checking SSL certs, use the -i or --insecure option to the command: vendor/bin/cigar -i or vendor/bin/cigar --insecure

Only use this if absolutely necessary.

Passing Authorization header

If you wish to add the Authorization header, use the -a or --auth option to the command: vendor/bin/cigar -a "Basic dXNyOnBzd2Q=" or vendor/bin/cigar --auth="Basic dXNyOnBzd2Q="

Passing custom header

If you wish to add any custom header(s), use the -h or --header option to the command: vendor/bin/cigar -h "Cache-control: no-cache" or vendor/bin/cigar --header="Cache-control: no-cache"

Command help & command version

If you want to see all the available options for Cigar, use the command: vendor/bin/cigar --help

If you wish to see what version of Cigar you're using, use the command: vendor/bin/cigar --version

Contributing

This started as a small personal project.

Although this project is small, openness and inclusivity are taken seriously. To that end a code of conduct (listed in the contributing guide) has been adopted.

Contributor Guide

More Repositories

1

awesome-checker-services

✅ List of links to the various checkers out there on the web for sites, domains, security etc.
761
star
2

faker-buzzword-job-titles

👔 A job title generator for faker based on Buzzwords.
PHP
15
star
3

behat-speedtrap

🏎 Report on slow running scenarios & steps within Behat
PHP
13
star
4

api-testcase

🌍 A PHPUnit Test Case that contains methods to help with testing APIs.
PHP
8
star
5

laravel-environment

Package for Laravel that gives artisan commands to setup and edit environment files.
PHP
6
star
6

bdd-behat

💬 Demo Repo for my BDD & Behat Talk / Workshop
PHP
5
star
7

gulprevbust

A Bolt CMS plugin to work with gulp-rev cache busting in twig templates.
PHP
4
star
8

omz-brunty

Custom oh-my-zsh prompt theme that was adapted from my bash prompt I used to use.
4
star
9

csp-demo

🔒 A small site to demo some CSP concepts
PHP
3
star
10

intro-to-gulp-talk

Code from my Intro to Gulp talk
JavaScript
3
star
11

kahlan-mink

🌍 Provides functionality to work with Mink within Kahlan. Also provides a way to boot a PHP web server when tests run.
PHP
2
star
12

intro-to-gulp-workshop

Repo for the Intro to Gulp Workshop I run.
HTML
2
star
13

jenkins-cd-workshop

Repo with setup and materials for my Continuous Delivery with Jenkins workshop
PHP
2
star
14

laravel-behat-fixtures

PHP
1
star
15

kahlan-pdo

🗄 Provides functionality to work with PDO, reset a database and load fixtures within Kahlan
PHP
1
star
16

dotfiles

dotfiles, config files
Shell
1
star
17

php-relax-ng-domdocument

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings
PHP
1
star
18

pushover-client

A (non-official) PHP Client for pushing messages out via Pushover
PHP
1
star