/images/avatar.png

Tech Lead and AWS Developer

Share context between tests with fixtures

๐Ÿ”Š Voiced by Amazon Polly Test Fixtures Imagine your about to sit down to eat your lunch. The dirty breakfast dish is still on the table. You got three options. You can get a new plate, you can clean the old plate, or you can just eat lunch off the dirty plate. Thats it. New plate, clean plate, dirty plate. The same rules apply to tests. Transient Fresh Fixture Getting a new plate is what Meszaros calls in the book “XUnit Test Patterns” a Transient Fresh Fixture.

Create Test Data cleanly with Fluent Builder Pattern

๐Ÿ”Š Voiced by Amazon Polly Helper methods make it easier to create test data. But they can become difficult to read over time as you need more variations of the test data to satisfy constantly evolving requirements from new tests. Let say, we have the following Customer class. public class Customer { public string Name { get; set; } public DateTime? DateOfBirth { get; set; } public string Email { get; set; } public string Address { get; set; } } In generally we create an instance of the Customer and set the respective properties as shown below.