Skip to main content

Json wrapper around requests for simple smoke testing.

Project description

Smolder
=======

"[Requests](https://github.com/kennethreitz/requests) for humans." :)
[![Build Status](https://travis-ci.org/sky-shiny/smolder.svg?branch=master)](https://travis-ci.org/sky-shiny/smolder)

The prevalence of SOA, microservices and dev/stage/live environment build processes precipitated the development of smolder.
The challenges these technologies pose requires the use of restful api tests which are simple and repeatable on
different endpoints without modifying the tests or the endpoints. A lot of these environments require agents running the
tests to be inside the network boundary and running inside internal build pipelines.

Smolder aims to solve these problems by providing features such as:

- Smoke test your rest API.
- Validate response times.
- Validate redirects.
- Validate ssl certificates.
- Validate headers.
- Validate json object types using [validictory](https://github.com/jamesturk/validictory)
- Write plugins using [Yapsy](https://github.com/tibonihoo/yapsy)
- More

Installation
============

```
pip install git+https://github.com/sky-shiny/smolder.git
```

Example
=======

After installing copy/paste the following into a bash shell:
```
cat <<EOF > github_status.yaml
---
tests:
-
name: "Github Status"
outcomes:
expect_status_code: 301
response_redirect: "https://status.github.com/api/status.json"
inputs:
headers:
User-Agent: "Smolder smoke test library"
uri: /api/status.json
-
inputs:
headers:
User-Agent: "Smolder smoke test library"
name: "Github Status ssl"
outcomes:
response_json_contains:
status: good
response_max_time_ms: 200
port: 443
protocol: https
uri: /api/status.json
EOF
smolder status.github.com github_status.yaml
```

Expected Output:
![Output](https://raw.githubusercontent.com/sky-shiny/smolder/master/docs/output.png)

Documentation
=============

[readthedocs](http://smolder.readthedocs.org/en/latest/)

1. [tests](docs/tests.md)
- [inputs](docs/inputs.md)
- [outcomes](docs/outcomes.md)
2. [plugins](docs/plugins.md)
3. [examples](docs/examples.md)
4. [contributing](docs/contributing.md)
5. [history](./HISTORY)

Similar Projects
================

1. [Runscope](https://www.runscope.com/)
2. [vrest.io](http://vrest.io)
3. [Stackoverflow](http://stackoverflow.com/questions/12135309/automated-testing-for-rest-api)

Thanks
======

https://github.com/njsaunders

https://github.com/nielsdraaisma

https://github.com/lotia

https://github.com/casibbald


RELEASE HISTORY
===============

Version 0.5.0
-------------
- Adding output plugin handling. Props to https://github.com/yasn77.
- Output can now be optionally json

Version 0.4.2
-------------
- More specific SSL error handling
- Schema validation happens inside the class for Ansible module support

Version 0.4.1
-------------
- Adds error handling for bad ssl certificates.
- Unit tests in place for all types of bad ssl certificates currently handled by badssl.com
- New plugin "response_header_value_contains", big thanks to https://github.com/yasn77

Version 0.4.0
-------------
- Breaks out input handling into modules that can be independently tested.

Version 0.3.1
-------------
- Adds support for default overrides
- Supporting Docker testing
- Community contributions
- Big thanks to https://github.com/hekaldama

Version 0.3.0
-------------
- 0.3.0 is looking to resolve defaults globally using immutable data structures, deep copied and updated for defaults.
- Handles issues with requests where the verify var accepts both bools and strings.
- Adds support for smolder warnings (not python warnings).
- Some unit test improvements.
- Big enough change surface area to warrant a 'major' version bump.

Version 0.2.4
-------------
- Improved certificate validation

Version 0.2.3
-------------
- Fix bug with tcp test defaults.

Version 0.2.2
-------------
- Added input validation for tests
- Moved classification to production/stable

Version 0.2.1
-------------
- Rewrote and reorganised everything to be more pythonic
- Implemented the yapsy plugin system
- json validation from validictory
- *** Breaking changes *** to the test schema
- Added inputs dict section with inputs and structure matching the underlying requests verbs exactly (pass through)
- Added an outcomes section to be more clear about logic
- request_headers becomes simply headers
- smolder-cli command line tool becomes simply smolder
- If you are inheriting, inherit from charcoal package
- validate_cert becomes verify (as it is passed through to requests directly), and goes under inputs
- See commit 8e7bc1c for examples of how the test structure has changed.

Version 0.1.2
-------------
- fixed bug with json search path
- deprecated use of regex (will reintroduce after fixing handling of binary objects)
- Improved tests
- Python 3 support

Version 0.0.1
-------------

- Smoke testing framework

Project details


Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page