Sign inSign up

hiredscorelabs/cornell

By hiredscorelabs

Updated over 4 years ago

End-to-end testing in a fast and isolated testing environment

Image
0

5.1K

hiredscorelabs/cornell repository overview

Cornell: record & replay mock server

Build Status Python Version

https://github.com/hiredscorelabs/cornell

Cornell Logo

Cornell makes it dead simple, via its record and replay features to perform end-to-end testing in a fast and isolated testing environment.

When your application integrates with multiple web-based services, end-to-end testing is crucial before deploying to production. Mocking is often a tedious task. It becomes even more tiresome when working with multiple APIs from multiple vendors.

vcrpy is an awesome library that records and replays HTTP interactions for unit tests. Its output is saved to reusable "cassette" files.

By wrapping vcrpy with Flask, Cornell provides a lightweight record and replay server that can be easily used during distributed system testing and simulate all HTTP traffic needed for your tests.

Basic Use Case

When you're working with distributed systems, the test client entry point triggers a cascade of events that eventually send HTTP requests to an external server

System in test

With Cornell server started, it will act as a proxy (record mode) between the outgoing HTTP requests and the external server and will record all relevant interactions. Once interactions are recorded, Cornell can work in replay mode, replacing the external server entirely, short-circuiting the calls and instead, replying back instantly with the previously recorded response.

System in test

Start cornell as docker container
docker build -t cornell .
docker run cornell --help

You will probably need to import cassettes from a local directory from your computer. To do that, use the following command to mount a local directory as a volume in the container.

docker run  -v ~/cassettes:/var/cassettes cornell -cd /var/cassettes

In some case, you want to use another port with cornell. If you need to do that, you should use docker port mapping as in the following where cornell will listen on port 9020.

docker run -p 9020:9000 cornell
Docs

Can be found in the documentation

Tag summary

Content type

Image

Digest

Size

344.3 MB

Last updated

over 4 years ago

docker pull hiredscorelabs/cornell