Principles of Unit Testing

Joseph (17.Mar.2017 at 10:00, 50 min)
Talk at Midwest PHP 2017 (English - US)

Rating: 3 of 5

The proliferation of testing strategies outside of a broadly agreed set of definitions has caused confusion and a waste of effort by not fully understanding how to apply the fundamentals of unit testing. Let's change that.

In this session, we will cover the five types of test doubles: dummy, fake, stub, spy, and mock, showing code examples of how to use each with PHPUnit and Prophecy. Layered on top of this we will observe the difference between sociable and solitary tests, as coined by Jeffrey Fields. Lastly, we will look at how test smells naturally surface and what strategies can be used to mitigate them, such as Arrange-Act-Assert, object mothers and data builders.

The key takeaway from this session will be a deep knowledge of unit testing: when to apply one double versus another, when to use solitary vs sociable, and how to mitigate test smells.

Who are you?

Claim talk

Talk claims have been moved to the new Joind.in site.

Please login to the new site to claim your talk

Want to comment on this talk? Log in or create a new account or comment anonymously

Write a comment

 
Please note: you are not logged in and will be posting anonymously!
= three minus zero

Comments

Rating: 3 of 5

17.Mar.2017 at 13:09 by Dave Buchanan (26 comments) via Web2 LIVE

I got a lot out of this talk. Being very new to writing tests, I got some good staring points. Especially in the final slides.

Would have liked speaker to start session with the What/Why, like an overview detailing what will be covered. Instead he just seemed to dive right in, which had some great stuff. But not having stated an overview I kept wondering where this was going.

Also this is a bit nit picky but speaker kept correcting himself. Maybe he was nervous. Repeatedly said, "I should have better examples". Next time just have better examples.

Rating: 3 of 5

17.Mar.2017 at 14:01 by epilektric (20 comments) via Web2 LIVE

Being new to unit testing, this talk seemed beyond my understanding. Still, I feel like I gained more knowledge about it than when I first walked into the room.

Rating: 3 of 5

17.Mar.2017 at 14:25 by Michael Sullivan (4 comments) via Web2 LIVE

As an entry level course I was expecting it to have a little more overview before jumping in. It was still very valuable and I'm glad I attended.

Rating: 3 of 5

17.Mar.2017 at 18:22 by Becky (34 comments) via Web2 LIVE

I've been wanting to learn about testing for a while now, but have never had the chance. This talk gave me a good overview of unit testing.

Rating: 3 of 5

17.Mar.2017 at 19:20 by Josh Hartman (3 comments) via Web2 LIVE

I did learn more about the terminology but feel that I would have understood the examples better if I had experience with the Drupal codebase, of which I have none.

Rating: 4 of 5

20.Mar.2017 at 09:19 by Anonymous


Rating: 3 of 5

20.Mar.2017 at 10:29 by Jesse Donat (25 comments) via Web2 LIVE

The talk was in a sort of weird place where it wasn't exactly an intro to testing, but a person like myself who's been testing for a while didn't get a ton out of it either. I think the talk needs a better sense of who it's target audience is.

© Joind.in 2017