How to add new mutation for cosmic-ray framework

Mutation testing is a concept that I heard some time ago but lately on anti-if course (I highly recommend!) done by Andrzej Krzywda I had a chance to use it in practice. I notice a big difference in the number of mutations generated by different frameworks (mutmut, cosmic-ray, and mutpy) when I was refactoring Gilded … Read more

Tox configuration and integration

Basic tox config Let’s start with a basic config that will run unittest and measure coverage. Important option here is usedevelop = true. With this it won’t install your package to virtualnenv and coverage can be measured. Another thing is to erase previous coverage reports. Codestyle Next, I wanted to check the codestyle. I use pycodestyle, … Read more

Refactoring to BDD-like tests

Sometimes I found myself in a situation where it’s hard to understand what some components suppose to achieve. In these situations, I go to test where scenarios/contracts of this component should be.But then I find some integrations tests with some entries in DB and expected mechanical results.My strategy in this situation is to refactor test … Read more

Process manager VS DDD Aggregate

DDD Aggregate is responsible for encapsulating business logic for the component. But we need to be aware that when we are implementing business logic for a long time process that is coordinating many components, like subscription trial, we have another building block for this. It’s a process manager. Below I pointed out some differences between … Read more

Persistency of DDD aggregate

Post in answer to a StackOverflow questions “SQLAlchemy and DDD” and “Persist POJOs in Python using a DDD approach”. You can find code used in this example here. DTO Having out DDD component I want to separation from DTO used by our aggregate and repository implementation. I introduce interface for DTO that will be delivered by … Read more

My structure for DDD component

Post in answer to a StackOverflow question. You can find code used in this example here. Package structure In component package I use this modules as starting point. migrations/ Commands A command is always DTO and as specific, as it can be from a domain perspective. I aim to create … Read more