Found it quite enjoyable and easy to understand. Thank you!
@CodingWithAdamАй бұрын
Your welcome! Thank you for the great feedback! 😁
@gabrielsm09072 жыл бұрын
Awesome content here. Finally, a case for understanding the utility and power of TDD in clear way. Thanks, Adam.
@CodingWithAdam2 жыл бұрын
You’re welcome! I’m really glad the tutorial helped! 😀
@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 Жыл бұрын
Thank you! It creates sense of confidence knowing that all the tests are passing. Specially when you work on a large team 😁
@HarshSingh-ll1sq Жыл бұрын
god bless you man never got so much clearity
@CodingWithAdam Жыл бұрын
You’re welcome! I’m really glad that video was helpful to understand TDD with react! 😁
@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 Жыл бұрын
Thank you!! That's a great suggestion!
@manishamuskan67559 ай бұрын
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...
@CodingWithAdam9 ай бұрын
Thank you for the great suggestion! I’ll consider it for a future video.
@joumanax3 жыл бұрын
Great tutorial! I just recently found out about TDD but haven't looked into it until you posted this. Thank you for this intro! :)
@CodingWithAdam3 жыл бұрын
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.
@vijayavula44103 ай бұрын
Beautiful way of presenting TDD. Can you add some complex features which involves Api calls?
@CodingWithAdam2 ай бұрын
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-nd6 ай бұрын
This was so very helpful, thank you!
@CodingWithAdam6 ай бұрын
You’re welcome! Glad the video was helpful!
@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 Жыл бұрын
Thank you! I’m really glad the video was helpful in understanding TDD and react! 😀
@mgcmsn6 ай бұрын
Thank you sir!
@CodingWithAdam6 ай бұрын
You’re welcome!
@MohamedAfzalMullaTweetzal Жыл бұрын
Great video Adam! 💯
@CodingWithAdam Жыл бұрын
Thank you! Glad you liked the video. 😁
@theagiletester6285 Жыл бұрын
Very nice Adam.
@CodingWithAdam Жыл бұрын
Thank you! 😀
@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 Жыл бұрын
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-h10 ай бұрын
@@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).
@LunaSmithArt2 жыл бұрын
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 🍭🎃🍬🐈⬛
@CodingWithAdam2 жыл бұрын
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 🎃🐈⬛
@sabarnabasak16773 жыл бұрын
Great explaination man ! Thanks
@CodingWithAdam3 жыл бұрын
Thank you! I’m glad the video helped.
@OtisDeLarge Жыл бұрын
I found this very helpful. Thank you.
@CodingWithAdam Жыл бұрын
You’re welcome! Happy the video was helpful!
@Jrrs20078 ай бұрын
Nice.
@CodingWithAdam8 ай бұрын
You’re welcome!
@lezboy5385 Жыл бұрын
Really nice tutorial, helped me a lot! Keep up the nice content, you earned a sub :)
@CodingWithAdam Жыл бұрын
Thank you. I’m really happy the tutorial helped! Thank you for the sub!!!
@aryanrahman32122 жыл бұрын
Great intro!
@CodingWithAdam2 жыл бұрын
Thank you! Glad you enjoyed it!
@Razkazar Жыл бұрын
!
@CodingWithAdam Жыл бұрын
Thank you!!! 😁
@stamatispsarras2 жыл бұрын
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.
@CodingWithAdam2 жыл бұрын
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 Жыл бұрын
in TDD, how do we know if the tests are correct?
@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.
@Nekenbeker7 ай бұрын
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.
@ElderESG3 жыл бұрын
What happens if you have more of the same text on the screen. Maybe make a tutorial on a more complex project. Thanks!!!
@CodingWithAdam3 жыл бұрын
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_mcmillan2 жыл бұрын
@@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!
@CodingWithAdam2 жыл бұрын
Thank you Killian! I’m glad you learned something new and thank you for the suggestions!
@MovaClub8 ай бұрын
many thanks!
@CodingWithAdam8 ай бұрын
You’re welcome!
@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 Жыл бұрын
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
@Nekenbeker7 ай бұрын
@@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.