Introduction to Test Driven Development with React

  Рет қаралды 21,324

Coding With Adam

Coding With Adam

Күн бұрын

Пікірлер: 64
@simplesimon399
@simplesimon399 Ай бұрын
Found it quite enjoyable and easy to understand. Thank you!
@CodingWithAdam
@CodingWithAdam Ай бұрын
Your welcome! Thank you for the great feedback! 😁
@gabrielsm0907
@gabrielsm0907 2 жыл бұрын
Awesome content here. Finally, a case for understanding the utility and power of TDD in clear way. Thanks, Adam.
@CodingWithAdam
@CodingWithAdam 2 жыл бұрын
You’re welcome! I’m really glad the tutorial helped! 😀
@mj2068
@mj2068 Жыл бұрын
for someone like me that haven't thought much about tests before, it just blew my mind when the first thing you did after project creation is to run the test command.
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you! It creates sense of confidence knowing that all the tests are passing. Specially when you work on a large team 😁
@HarshSingh-ll1sq
@HarshSingh-ll1sq Жыл бұрын
god bless you man never got so much clearity
@CodingWithAdam
@CodingWithAdam Жыл бұрын
You’re welcome! I’m really glad that video was helpful to understand TDD with react! 😁
@keifer7813
@keifer7813 Жыл бұрын
This was great. I'd love to see more of this. Maybe a slightly more complex set of react tests to mimic a professional working environment
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you!! That's a great suggestion!
@manishamuskan6755
@manishamuskan6755 9 ай бұрын
Awesome video... One request though - Please make a video where we can test advanced features like mocking a server request, routing etc with the same TDD approach...
@CodingWithAdam
@CodingWithAdam 9 ай бұрын
Thank you for the great suggestion! I’ll consider it for a future video.
@joumanax
@joumanax 3 жыл бұрын
Great tutorial! I just recently found out about TDD but haven't looked into it until you posted this. Thank you for this intro! :)
@CodingWithAdam
@CodingWithAdam 3 жыл бұрын
Thank You Joumana! You're welcome. Once you get into the flow TDD it can be a lot of fun. Glad you enjoyed the tutorial.
@vijayavula4410
@vijayavula4410 3 ай бұрын
Beautiful way of presenting TDD. Can you add some complex features which involves Api calls?
@CodingWithAdam
@CodingWithAdam 2 ай бұрын
Thank you! Glad you enjoyed the video! I made this a while back that might help with testing api calls. kzbin.info/www/bejne/moPIoIN_rKmWmbssi=ZiXOeie5aXY5tj72
@_k-nd
@_k-nd 6 ай бұрын
This was so very helpful, thank you!
@CodingWithAdam
@CodingWithAdam 6 ай бұрын
You’re welcome! Glad the video was helpful!
@Fred_Klingon
@Fred_Klingon Жыл бұрын
This is an awesome explanation! Other than TDD applied to a real world example, it made me understand a little more about how React works (I used to work with Vue.js before)
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you! I’m really glad the video was helpful in understanding TDD and react! 😀
@mgcmsn
@mgcmsn 6 ай бұрын
Thank you sir!
@CodingWithAdam
@CodingWithAdam 6 ай бұрын
You’re welcome!
@MohamedAfzalMullaTweetzal
@MohamedAfzalMullaTweetzal Жыл бұрын
Great video Adam! 💯
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you! Glad you liked the video. 😁
@theagiletester6285
@theagiletester6285 Жыл бұрын
Very nice Adam.
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you! 😀
@Ricardoromero4444
@Ricardoromero4444 Жыл бұрын
I mean, this shows the workflow of TDD very well... but that's kind of obvious. When you get a feature request, how do you decide what tests to write? How do you write good tests? How do you avoid writing a bunch of useless tests?
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thanks for the question. An easy way is to use a coverage report to determine if you are executing all branches of your code ex if else etc. Also ask your self the question do my tests provide confidence that my application is working correctly? Will it prevent other devs from making mistakes. Those are a few of the things I think about.
@mks-h
@mks-h 10 ай бұрын
@@CodingWithAdam "if you are executing all branches of your code" and now the test is heavily tied to the code, which in TDD shouldn't even exist until after you write a test. Instead, I'd say you have to test all ways the component is supposed to be used (or all states it supposed to be in, and transitions between them).
@LunaSmithArt
@LunaSmithArt 2 жыл бұрын
A lovely introduction to TDD with React. Nicely done and simple to follow. Can you make a video with TDD/React and Typescript? Happy Halloween 🍭🎃🍬🐈‍⬛
@CodingWithAdam
@CodingWithAdam 2 жыл бұрын
Thank you Luna! I’m happy that enjoyed the tutorial! That’s a wonderful suggestion, I will add it to my list of future videos. Happy Halloween 🎃🐈‍⬛
@sabarnabasak1677
@sabarnabasak1677 3 жыл бұрын
Great explaination man ! Thanks
@CodingWithAdam
@CodingWithAdam 3 жыл бұрын
Thank you! I’m glad the video helped.
@OtisDeLarge
@OtisDeLarge Жыл бұрын
I found this very helpful. Thank you.
@CodingWithAdam
@CodingWithAdam Жыл бұрын
You’re welcome! Happy the video was helpful!
@Jrrs2007
@Jrrs2007 8 ай бұрын
Nice.
@CodingWithAdam
@CodingWithAdam 8 ай бұрын
You’re welcome!
@lezboy5385
@lezboy5385 Жыл бұрын
Really nice tutorial, helped me a lot! Keep up the nice content, you earned a sub :)
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you. I’m really happy the tutorial helped! Thank you for the sub!!!
@aryanrahman3212
@aryanrahman3212 2 жыл бұрын
Great intro!
@CodingWithAdam
@CodingWithAdam 2 жыл бұрын
Thank you! Glad you enjoyed it!
@Razkazar
@Razkazar Жыл бұрын
!
@CodingWithAdam
@CodingWithAdam Жыл бұрын
Thank you!!! 😁
@stamatispsarras
@stamatispsarras 2 жыл бұрын
I am not familiar with React but this video made me understand it better, since you were building it in small steps. TDD FTW. BTW I do not understand why you had to test if you clicked twice? You never proved that this test was failing (other than when it was simply throwing an exception). In my understanding of TDD, you need to write a test completely, prove that it fails. You did that in most scenarios, but not on the ones you were checking for multiple clicks.
@CodingWithAdam
@CodingWithAdam 2 жыл бұрын
Agree TDD and testing in general are great and help to build confidence when changing code to ensure nothing has broken. Great question. As with any best practice like agile or TDD you can pick and chose how to use it. Testing can be about coverage and seeing if you can break anything. Clicking a button fast twice could yield an incorrect result in this situation it was an extra coverage test. We could have written the first test so that clicking the button once would hard code the value to 1. This would cause the click button twice test to fail. This can be a fun exercise to write just the code needed to make a test pass. This can be done with pair programming where one writes the test and the other makes it pass The important thing is that there is a test. As you observed with strict TDD you write the test first see the failure and make it pass. Hope this helps!
@damindadineshimaduwagamage9044
@damindadineshimaduwagamage9044 Жыл бұрын
in TDD, how do we know if the tests are correct?
@CodingWithAdam
@CodingWithAdam Жыл бұрын
That is a great question. One way is to use a coverage report to see if your test code is executing all paths of your code.
@Nekenbeker
@Nekenbeker 7 ай бұрын
Well the implementation tests your test. The TDD cycle is: Write a test and it must fail. Then write minimal and simplest code possible to make the test green. At this time you should know that your test is testing for your intention as it fails when the code does not what it's supposed to do but is green when the code does work. After that you refactor, i.e. make the code less stupid keeping the tested test green.
@ElderESG
@ElderESG 3 жыл бұрын
What happens if you have more of the same text on the screen. Maybe make a tutorial on a more complex project. Thanks!!!
@CodingWithAdam
@CodingWithAdam 3 жыл бұрын
Great question. In that situation I would suggest using a testId. Here is the documentation testing-library.com/docs/queries/bytestid Thank you for the suggestion of making a more advanced example.
@killian_mcmillan
@killian_mcmillan 2 жыл бұрын
@@CodingWithAdam I was thinking the same thing (about using queryByText). I actually paused the video and tried to do it myself. As you said, *testId* would be the way to go (in lot of cases here), but I get it that this is more of an introduction video than building a production app. Also, I think it's better to provide the default value in the component's props, e.g.: const AwesomeCounter = ({ initialValue = 0 }) => { ...... As your component grows, it's easier to keep track of default values. Also, for preventing negative values, I would say it's nicer to write something like: const remove = () => { setCounter((prev) => prev > 0 ? prev - 1 : 0) } Just my 2 cents :) Thanks for this great video! Keep it up! I learned something new today and that's what's priceless! Cheers!
@CodingWithAdam
@CodingWithAdam 2 жыл бұрын
Thank you Killian! I’m glad you learned something new and thank you for the suggestions!
@MovaClub
@MovaClub 8 ай бұрын
many thanks!
@CodingWithAdam
@CodingWithAdam 8 ай бұрын
You’re welcome!
@desajustecreativo
@desajustecreativo Жыл бұрын
Writing the list of tests ahead of time breaks the second rule of TDD: “You are not allowed to write any more of a unit test than is sufficient to fail”
@CodingWithAdam
@CodingWithAdam Жыл бұрын
That’s right the 3 laws of TDD from Robert C Martin (Uncle Bob). Really helps to achieve a very high test coverage percentage 😁 butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
@Nekenbeker
@Nekenbeker 7 ай бұрын
@@CodingWithAdam The point of doing minimal amounts of work in every step is not having great test coverage, this is merely a side product. The main point is to minimize cognitive load. If you do 10 failing tests in advance you not only have to think of the functionality you are currently implementing but also how many tests have failed before and what should my test-suite green-rate be right now. In formal TDD the whole test suite has to be green after the implementation step no matter what.
@cryswerton__silva
@cryswerton__silva 12 күн бұрын
Awesome!
@CodingWithAdam
@CodingWithAdam 6 күн бұрын
Thanks!
@matthewrideout426
@matthewrideout426 3 жыл бұрын
Thanks :)
@CodingWithAdam
@CodingWithAdam 3 жыл бұрын
You’re welcome!
@lucasa8710
@lucasa8710 3 жыл бұрын
tnx a lot
@CodingWithAdam
@CodingWithAdam 3 жыл бұрын
You’re welcome!
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 906 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 86 МЛН
🚀  TDD, Where Did It All Go Wrong (Ian Cooper)
1:03:55
DevTernity Conference
Рет қаралды 572 М.
Build an Awesome Version of Tic Tac Toe in React Tutorial
53:02
Coding With Adam
Рет қаралды 24 М.
Why Would Anyone Hate TDD? | Prime Reacts
46:52
ThePrimeTime
Рет қаралды 153 М.
Test Driven Development: The best way to code that I almost never use
19:35
Test Driven Development vs Behavior Driven Development
18:42
Continuous Delivery
Рет қаралды 154 М.
Next.js with React Testing Library, Jest, TypeScript
25:04
Dave Gray
Рет қаралды 72 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 492 М.
React Testing Crash Course
58:36
Traversy Media
Рет қаралды 319 М.
Why I Don’t Unit Test
8:25
Theo - t3․gg
Рет қаралды 92 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 906 М.