Test Automation Architecture in Microservices

Preview:

Citation preview

TEST AUTOMATION ARCHITECTURE IN MICROSERVICES

Alper Mermer

TESTING RELATED ISSUES IN MICROSERVICES

Services are built and deployed independentlyServices talk to each other to accomplish things

Builds and deploys are automatedData is not centralized

Cross functionals need to be tested way before the endTests need to be executed way earlierTests need to be executed way later

THE INFAMOUS TEST AUTOMATION PYRAMIDE

INTERNAL TESTS

EXTERNAL TESTS

SERVICES ARE BUILT AND DEPLOYED INDEPENDENTLY

You can’t depend on other services to be up

SERVICES ARE BUILT AND DEPLOYED INDEPENDENTLY

Use test doubles to resolve your dependenciesMountebank

SERVICES ARE BUILT AND DEPLOYED INDEPENDENTLY

Your tests should be able to run in isolationDocker

SERVICES TALK TO EACH OTHER TO ACCOMPLISH THINGS

Keep the communication between your services alive

SERVICES TALK TO EACH OTHER TO ACCOMPLISH THINGS

Create Consumer Driven Contract Tests between servicesPact

BUILDS AND DEPLOYS ARE AUTOMATED

You don’t have a buffer time between builds

BUILDS AND DEPLOYS ARE AUTOMATED

Multiple layers of testing

Layered path to production deployment

Blue - Green deployments

Canary releases

BUILDS AND DEPLOYS ARE AUTOMATED

Repeatable environments Vagrant, Puppet, Chef, Ansible, Docker

DATA IS NOT CENTRALIZED

You have to manage each test data seperatelyEach test creates its own data

DATA IS NOT CENTRALIZED

Each test data should be unique accross the test suiteEach test deletes only the data it created

CROSS FUNCTIONALS NEED TO BE TESTED WAY BEFORE THE END

Again, you can’t wait until everything is completed

CROSS FUNCTIONALS NEED TO BE TESTED WAY BEFORE THE END

Put in automated performance tests in your CDPJmeter, Gattling, Locust

CROSS FUNCTIONALS NEED TO BE TESTED WAY BEFORE THE END

Put in automated security checks in your CDPOWASP ZAP, OWASP Dependency Check, W3af

TESTS NEED TO BE EXECUTED WAY EARLIER

Tests aren’t the responsibility of the testers aloneYou need to start testing right away

TESTS NEED TO BE EXECUTED WAY EARLIER

You should minimize testing things as a wholeEnd to End (E2E) tests

TESTS NEED TO BE EXECUTED WAY EARLIER

Implement Journey TestsSelenium, Capybara, Sahi, Appium

TESTS NEED TO BE EXECUTED WAY LATER

See what’s going on in productionMonitor things

TESTS NEED TO BE EXECUTED WAY LATER

Analyze trends and problems on productionHave some tests which are run in production

TESTS NEED TO BE EXECUTED WAY LATER

Be a Quality Analyst

COMMON PITFALLS

Don’t use a fixed recipeBuild your architecture

incrementallyKeep your architecture

alive

BOOK SUGGESTIONS

Building Microservices - Designing Fine-Grained Systems, Sam Newman

Infrastructure as Code - Managing Servers in the Cloud, Kief Morris

THANK YOUQuestions ?

amermer@thoughtworks.com

@alpermermer

@test_hive

Recommended