Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Dennis Doomen | @ddoomen | Aviva Solutions | The Continuous Improver
An opinionated definition
(in my definition)
1. Design the class responsibilities
2. Write a first unit test
3. Generate stubs using R#, Rider, etc
4. Ensure test fail...
Order Processing
IStoreOrders<T>
+ CreateQuery<T>();
+ Add<T>();
+ Delete<T>();
NHibernate
Repository
Order Processing
ISt...
eventMonitor.OccurredEvents.Should().BeEquivalentTo(new[]
{
new
{
EventName = "PropertyChanged",
TimestampUtc = utcNow - 1...
Command Handlers
Commands
Domain Model
Event Store
Events
App
Query
Store
RavenDB
Projectors
Events
API Controller
Project...
• Define the boundary carefully
• Use BDD or AAA when applicable
• Don’t repeat the context in names
• Don’t use technical...
• Example code
https://github.com/dennisdoomen/EffectiveTdd
Demo
• Chill
https://github.com/ChillBdd/Chill
• Fluent Assert...
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
Upcoming SlideShare
Loading in …5
×

of

How to practice TDD without shooting yourself in the foot Slide 1 How to practice TDD without shooting yourself in the foot Slide 2 How to practice TDD without shooting yourself in the foot Slide 3 How to practice TDD without shooting yourself in the foot Slide 4 How to practice TDD without shooting yourself in the foot Slide 5 How to practice TDD without shooting yourself in the foot Slide 6 How to practice TDD without shooting yourself in the foot Slide 7 How to practice TDD without shooting yourself in the foot Slide 8 How to practice TDD without shooting yourself in the foot Slide 9 How to practice TDD without shooting yourself in the foot Slide 10 How to practice TDD without shooting yourself in the foot Slide 11 How to practice TDD without shooting yourself in the foot Slide 12 How to practice TDD without shooting yourself in the foot Slide 13 How to practice TDD without shooting yourself in the foot Slide 14 How to practice TDD without shooting yourself in the foot Slide 15 How to practice TDD without shooting yourself in the foot Slide 16 How to practice TDD without shooting yourself in the foot Slide 17 How to practice TDD without shooting yourself in the foot Slide 18 How to practice TDD without shooting yourself in the foot Slide 19 How to practice TDD without shooting yourself in the foot Slide 20 How to practice TDD without shooting yourself in the foot Slide 21 How to practice TDD without shooting yourself in the foot Slide 22 How to practice TDD without shooting yourself in the foot Slide 23 How to practice TDD without shooting yourself in the foot Slide 24 How to practice TDD without shooting yourself in the foot Slide 25 How to practice TDD without shooting yourself in the foot Slide 26 How to practice TDD without shooting yourself in the foot Slide 27 How to practice TDD without shooting yourself in the foot Slide 28 How to practice TDD without shooting yourself in the foot Slide 29 How to practice TDD without shooting yourself in the foot Slide 30
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

1 Like

Share

Download to read offline

How to practice TDD without shooting yourself in the foot

Download to read offline

It’s 2019, so practices like Test Driven Development (TDD) have long found their way into organizations. However, the practices and principles to keep those unit tests maintainable haven’t really changed. Still, I regularly talk to developers that somehow ended up with an incomprehensible unmaintainable set of unit tests that they once believed in, but are now holding them back. So in this session I like to provide a refresh of those fundamental ideas and talk about why you should practice TDD, revealing intentions, naming conventions, state versus interaction based testing, and how to stay out of the debugger hell with proper mocking and assertion frameworks. And even if you believe you are well versed in the testing realm, join me anyway. Maybe we can learn some tips & tricks from the audience as well. Looking forward to it!

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

How to practice TDD without shooting yourself in the foot

  1. 1. Dennis Doomen | @ddoomen | Aviva Solutions | The Continuous Improver
  2. 2. An opinionated definition
  3. 3. (in my definition)
  4. 4. 1. Design the class responsibilities 2. Write a first unit test 3. Generate stubs using R#, Rider, etc 4. Ensure test fails for the right reason 5. Implement the real deal 6. Ensure test succeeds 7. Identify alternative scenarios 8. Repeat twice 9. Refactor.
  5. 5. Order Processing IStoreOrders<T> + CreateQuery<T>(); + Add<T>(); + Delete<T>(); NHibernate Repository Order Processing IStoreOrders + GetIncompletedOrders(minValue); + StoreOrder(); + CompleteOrder(); OrderRepository VS
  6. 6. eventMonitor.OccurredEvents.Should().BeEquivalentTo(new[] { new { EventName = "PropertyChanged", TimestampUtc = utcNow - 1.Hours(), Parameters = new object[] { “third”, “first”, 123 } }, new { EventName = "NonConventionalEvent", TimestampUtc = utcNow, Parameters = new object[] { "first", 123, "third" } } }, o => o.WithStrictOrdering());
  7. 7. Command Handlers Commands Domain Model Event Store Events App Query Store RavenDB Projectors Events API Controller Projections Events
  8. 8. • Define the boundary carefully • Use BDD or AAA when applicable • Don’t repeat the context in names • Don’t use technical names • Avoid constants • Use Test Data Builders for the irrelevant parts • Show relevant dependencies • Only assert the relevant parts • Keep refactoring • Keep out of the debugger hell.
  9. 9. • Example code https://github.com/dennisdoomen/EffectiveTdd Demo • Chill https://github.com/ChillBdd/Chill • Fluent Assertions https://www.fluentassertions.com • Laws of Jeremy D. Miller http://codebetter.com/jeremymiller/2005/10/21 /haacked-on-tdd-and-jeremys-first-rule-of-tdd/ • Xunit Patterns http://xunitpatterns.com/ • Test data builders http://www.natpryce.com/articles/000714.html
  • powerirs

    Oct. 18, 2019

It’s 2019, so practices like Test Driven Development (TDD) have long found their way into organizations. However, the practices and principles to keep those unit tests maintainable haven’t really changed. Still, I regularly talk to developers that somehow ended up with an incomprehensible unmaintainable set of unit tests that they once believed in, but are now holding them back. So in this session I like to provide a refresh of those fundamental ideas and talk about why you should practice TDD, revealing intentions, naming conventions, state versus interaction based testing, and how to stay out of the debugger hell with proper mocking and assertion frameworks. And even if you believe you are well versed in the testing realm, join me anyway. Maybe we can learn some tips & tricks from the audience as well. Looking forward to it!

Views

Total views

328

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

11

Shares

0

Comments

0

Likes

1

×