Effective Unit Testing by Eliotte Rusty Harold

preview_player
Показать описание

You've been bitten by the testing bug, are thoroughly test infected. Excellent! You're undoubtedly producing more robust, less buggy software faster and at lower cost. Now it’s time to think about what makes unit tests even better. We’ll discuss flakiness, debuggability, reproducibility, speed, specificity, independence, timing, and other characteristics of effective unit tests. Examples will be in Java and JUnit, but the principles apply generally to all languages and test frameworks.

Рекомендации по теме
Комментарии
Автор

01:46 Why do we write unit tests?
04:28 The Fundamental Principle of Unit Testing
04:40 What is a unit test?
05:46 No.1- Eliminate everything that makes input and output unclear or contingent
09:37 No.2- Write Your Tests First! - Run the test first ! Couple with API
13:57 No.3 - Why Unit Tests?
16:20 No.4 - Unit also means Independent!
17:33 No.5 - Tests and Thread Safety
19:17 The Two least Known Facts of Unit Testing
19:23 Test don't share instance data (In JUnit) - may not set it in setup
20:46 You can have many test classes per model class
21:21 Speed of Tests
24:06 General Principle - Passing Tests should produce no output
25:39 General Principle - Failing Tests should produce clear ouput
27:16 Flakiness ( tests sometimes passes and sometimes fails)
31:46 System Skew (different kind of flakiness) - test couple with environments(OS, character set)
34:18 Another Conditional Logic in Tests
35:21 Debugging (addressing bugs by tests)
37:04 Refactoring (write tests by refactor something)
39:15 Development Practices
41:55 Final Thoughts
42:37 Question From audiences
42:38 The asset about writing test first
46:18 What do you think tools like cucumber ?

tommyli
Автор

Wow! I just got put in charge of starting to develop a test suite for my company's software with no previous experience with Unit Tests. I took some online courses, but this was the final piece of the puzzle for me to understand what Unit Tests are, their purpose, what to test, and how to design and write them. Extremely helpful!!

jasonproulx
Автор

By far the best talk I've ever seen on testing

christianbouwense
Автор

The 5 last minutes of this video are simply golden.

stevechamaillard
Автор

I feel like I wanna give tips to youtube recomendation algorythm. I was looking for a good info about test desing and found nothing I could like, and them this piece of gold comes up.

uuusysq
Автор

Incredible talk. Best use of my hour. The best in youtube... @Devoxx you guys are best.

hiteshbitscs
Автор

Perfect video for those of us who are trying to apply JUnit first time in code without guidance

NirajSanghani
Автор

33:21 When his cough made me alert.
BTW a great video helped me to learn why unit testing is important for my code.

MuhammadUsman-fvcs
Автор

I write unit tests in Typescript for Angular and still found this very helpful.

MrAdamwilson
Автор

Very helpful for a newcomer to unit tests

Overthought
Автор

2022, I'm still learning from it

michaeldeng
Автор

These days, I started writing unit tests and I find this video really really helpful.
Thanks a lot for your advices 👍👍

raymondyoo
Автор

19:23 "Tests do not share instance data" is true for JUnit, but exactly the same code structure does cause problems in NUnit. In NUnit, fixture instance is shared by all test cases it contains, what makes running NUnit tests in parallel really fun. Also parallel tests are disabled by default, and when you switch from default to parallel and see all red, be ready to rewrite your fixtures and move instance data to... somewhere, because there's no nice equivalent of JUnit behavior. So beware when using instance data in your test aggregates in different frameworks, and don't forget to check documentation.

maciejchabros
Автор

Great talk, time to go back to my PHPUnit and change some things >_<"

abdullahhejazi
Автор

Code Coverage is simply a metric of how good your developers are at hiding bad Unit Tests with lots of Mocks. Nothing more.

Tony-dprl
Автор

*Multiple assertions are OK!* People are confusing things: you want a given-when-then structure, rather than a given-when-then-when-then... And one assertion cannot always test everything. You still test one thing at a time, and I think JUnit has a way to report multiple assertion errors. If not, then it should. Because it just feels wrong otherwise.

SirWolf
Автор

Amazing talk, I'm a PHP dev and still got a lot of useful information from this.

DCBlogdev
Автор

Great lecture! This is a great way to learn to think. All people who write code make mistakes, and it helps to have some sort of safeguard in place where, if you have to modify the behavior of your code down the line, you risk less of a chance of some unforeseen bug cropping up because you thought thoroughly about them when writing the initial unit tests. Very thorough justification for writing unit tests.

InSterquiliniisInvenitur
Автор

47:04 "Try thinking about the interface..." 👍

Thank you.

jamilxt
Автор

Awesome overview, thank you for sharing this..!

september