integration tests with super powers
play

Integration Tests with Super Powers And even more... Alexandre - PowerPoint PPT Presentation

Integration Tests with Super Powers And even more... Alexandre Figura Site Reliability Engineer @ SysEleven GmbH A Brillant Masterpiece Irresistibly Entertaining The Python Magazine Edinburgh Times


  1. Integration Tests 
 with Super Powers And even more... Alexandre Figura · Site Reliability Engineer @ SysEleven GmbH

  2. ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ A Brillant Masterpiece Irresistibly Entertaining The Python Magazine Edinburgh Times ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ Golden Snake Awards The Most Exciting Nominated for Talk of the Year Best Speaker Alexandre Figura Scottish Insiders

  3. Who Am I? • Use Python with 😎 since 2014 . •  Live in Berlin 🛬 since 2016  • Always eat 2 desserts at lunch 🍧 • Work with cool folks at SysEleven GmbH , 
 best company in town. 3

  4. Tests and 
 Programmers ❤ A True Love Story ❤

  5. A Well-Kept Secret There is one And only one Reason why we write tests. We want our Pull-Requests to get accepted . And incidentally, to make it easier to maintain our code in the future . 5

  6. Lazy Mocking Or how harmful mocks can be...

  7. Mocks Advantages - Easy to write. Drawbacks - Dependant on implementation , - Make refactoring harder, - Hide errors and behavioral changes. Conclusion Never use them* 7 *Unless you have a very good reason...

  8. Please Do Not Try Mocks at Home

  9. Alternative Testing Strategies ...Pimp my Mock ™ ...

  10. Basic Concepts Integration Tests are built around two ideas: 1. Dependency Injection , 2. Interface Testing . It sounds complicated. But it isn't. 10

  11. Summary Advantages: - Tests not dependant anymore on implementation . - Easy to change dependency later on. - Make refactoring easier. Drawbacks: - Require way more work at first. 11

  12. Real World Example When practice meets theory...

  13. To the Cloud and Beyond Use Case We want to upload a static website Container To the Cloud Using OpenStack Object Store 's API. Object Object Links: - Officiel API, - Fake Implementation, Object Object - Interface Tests, - Parametrizing with Pytest. Object Store 13

  14. Additional Examples 
 of Dependency Injection Let's eat the snake!

  15. Mock Injection Too much work to write Fake dependencies? - Write a Mock-like implementation, - Inject it as a dependency. Useful for simulating complex systems. Advantages: - Easy as mocks, - Tests remaining independent of implementation 
 (makes refactoring easier). 15

  16. Minimalist Interface Testing Use Case: I make Holiday movies Recorded on Blu-ray And need to convert them to MKV . Problem: Links: - Syntax Errors Testing, A Blu-Ray is 30-50GB large. - Fake Implementations, Solution: - Dependency Injection. Only check for syntax errors . 16

  17. 💹 Bonus 💹 Running inside Docker Compose Because Buzzwords matter...

  18. Standard Workflow Tests independent Source Container 2 of running platform. Code Container 3 Tox + 
 Working example Pytest available on Github. Container 4 Application Container Docker Compose 18

  19. Conclusion What you should remember

  20. Summary Mocks make refactoring harder. Interface Testing is more flexible , but involves more work . Dependency Injection will improve your code's API . Always ask yourself (or around) 
 if you need 100% test coverage. 20

  21. Everything is about Tradeoffs

  22. We're hiring! Interested? 
 Just say: "Hello!" Mail: jobs@syseleven.de WhatsApp, SMS: +49 171/8934073

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend