wtsi-hgi/useintest

Name: useintest

Owner: Wellcome Trust Sanger Institute - Human Genetics Informatics

Description: I don't care how it's done, I just want to use it in my tests!

Created: 2016-11-21 14:18:26.0

Updated: 2017-05-08 08:30:37.0

Pushed: 2017-12-05 16:49:07.0

Homepage:

Size: 418

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status codecov.io Documentation Status

Use In Test

I don't care how it's done, I just want to use it in my tests!

Less blurb, more documentation - link to ReadTheDocs.

Key Features
Predefined Support

Out of the box support for:

Why Use This Library?

Software no longer works in isolation; with the trend towards microservices over monoliths, modern day applications rely on numerous external services for both data and computation.

Mocks can be a quick way to test against something that (should) behave like the external service that your application uses. However, unless a well respected mocking framework exists, the mock you'll end up with will probably make the same bad assumptions about the behaviour of service as your faulty code does!

Testing with the “real thing” or a shared dev mirror of it is probably not a good idea during development, particularly if the services that you're using hold state. You want to be able to run the tests in parallel, have repeatability and have availability, be it for when you're offline or for collaborators outside of your organisation. You also want to be able to wipe the slate clean and start again if something goes terribly wrong! It is unlikely you will be able to do this in any kind of shared environment.

This library offers a way to just start up services and then throw them away after each test case, with no mess left over on your machine. It gives complete test isolation along with confidence that you're testing with services similar to those used in production.

Quick Examples

Start up a containerised instance of Mongo:

 useintest.predefined.mongo import MongoServiceController

arts a containerised version of Mongo
roller = MongoServiceController()              
 controller.start_service() as service:      
run_my_tests(my_application, service.host, service.port)

Use samtools in a container from the host machine via “proxy executables”:

 useintest.predefined.samtools import SamtoolsExecutablesController

roller = SamtoolsExecutablesController()  
utables_directory = controller.write_executables()
 the case of Samtools, there will be one executable in `executables_directory` named "samtools"
my_tests(my_application, executables_directory)
roller.tear_down()
Documentation

For more details, including information on how to setup and use the library, please view the documentation on ReadTheDocs or read it from /docs.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.