How to know if your tests are correct? - Twitch stream highlight

preview_player
Показать описание
This is a highlight from the Fun Fun Function live stream on Twitch.

Get notified when I go live by following me on Twitch

Watching the stream live is completely free, but the live stream recordings is an exclusive perk for $5+ Patrons:

💛 Wallaby (Show sponsor)
Рекомендации по теме
Комментарии
Автор

A few relevant thoughts coming from my team:
1. You test your tests by following TDD: by watching your tests fail at first and then pass you gain some confidence that it is actually testing the behaviour you want.
2. Mutation testing - you can test your tests by deliberately breaking your code - we do this manually when reviewing our changes but there are some tools which automatically do this (though we haven't used any of them)
3. Tests which rely on mocks are inherently riskier so we take precautions:
3.1. We always try to use real data for our mock responses/side-effects. (It's easy to make false assumptions otherwise)
3.2. If you can: a limited number of integration tests help continuosly validate your baked-in-the-mock assumptions

stephensmithwick
Автор

Why you remove streams from twitch? It's very upset.

siZeOf
Автор

I am just waiting for this unit test series to get over, maybe ur viewers like me are interested in other areas of software development apart from unit testing, btw wishing u a very happy new year 2018 and also wishing Fun Fun Function to be funnier than all the previous years.

amitsharma-vqed
Автор

Hey @MPJ What are your thoughts on the individual programmer and ethical responsibility to a project and to the quality of the code on non TDD projects? (I.E. trying to individual force red-green tdd when the code base is just not setup to make that easy)

TO-cwfy
Автор

When you say verify it once, you mean just the shape of the JSON response, right?

If not, it doesn't seem relevant to me to test the value returned from the API. So long as you are mocking the JSON structure correctly then you can test the behaviour of your app with a unit test.

ie. If you know the shape is { country: String, rate: Number } then it doesn't matter what rate the API returns, because you're not testing the API. You're testing that given a JSON response of that shape, your app behaves correctly.

NWCalvank
Автор

Isn't snapshot testing perfect for APIs?

ChrisHa
Автор

I have no idea of why i don't get the notification when you go LIVE on twitch. Followed and subbed for notifications though i get no messages :/. So, my question is when did you last stream on twitch ?

SlavchoDimitrievski
Автор

Red-green hair cycle, cool. Also, great content

DeusEx
Автор

Specifically in the case that you described, of making a request to a third-party API, if the third party provides sandbox API for testing purposes (or any test environment), I would trade test speed for test correctness by making actual requests to that sandbox API.

pedroneves
Автор

You are very quiet. Can use some tuning up / editing or what ever :)

mirimCZ