I recently created the slide above for a course I taught in testing. I hope it will help understanding how to write tests.
Category: Testing
Library recommendations
This article is a list of recommended libraries around software development, architecture and automated testing. It will be updated.
Continue reading “Library recommendations”Resource recommendations
This article is a list of recommended recources around software development, architecture and automated testing. It will be updated.
Continue reading “Resource recommendations”Data Providers / Parametrized tests in Python
Take as example a simple validator function: it is usually a pure function, simple input data structure and boolean return value. Writing tests for a validator can create a lot of boilerplate and repetitive code. A solution for simpler test structure are data providers and parametrized tests. In e.g. JavaScript / node.js or PHP you usually use the term “data provider” whereas in Python “parametrized” is used. Below you can find an example for parametrized tests for an is_valid_email validator.
Continue reading “Data Providers / Parametrized tests in Python”Easy mocking in Angular for container components
Everybody how tried to write some tests for container ccomponents knows the pain of writing the mocks. This can be very time consuming, since you have to write Mock classes for each used components including inputs etc. The possibility of NO_ERRORS_SCHEMA should NOT be used, since it is suppressing ALL error messages concerning the schema. It is just an option to lead testing ad abdsurdum …
BUT I found a nice module which is a very nice solution: ng-mocks. Mocking a component is then a oneliner in the TestBed configuration:
import { MockComponent } from 'ng-mocks';
// ...
declarations: [
TestedComponent,
MockComponent(DependencyComponent),
]