Test-Driven Development // Fun TDD Introduction with JavaScript
Ғылым және технология
Test-Driven Development (TDD) is a proven prevent bugs and improve the quality of your code - and it's fun! Learn the fundamentals of JavaScript testing in this beginner's tutorial. github.com/fireship-io/tdd-ba...
#js #webdev #tutorial
🔗 Resources
Wallaby (20% discount) bit.ly/34KDnHP
Jest jestjs.io/
Cypress www.cypress.io/
Software Testing in 100 Seconds • Software Testing Expla...
📚 Chapters
00:00 Why Test?
01:13 Test-Driven Development (TDD) Philosophy
02:07 Functional Testing
03:40 Non-Functional Testing
03:53 JS Interview Question
04:12 Setting up Jest
06:04 Writing your First Test
09:05 Setup & Teardown
10:29 Code Coverage Report
10:57 Cypress E2E
🤓 Install the quiz app
iOS itunes.apple.com/us/app/fires...
Android play.google.com/store/apps/de...
🔥 Watch more with Fireship PRO
Upgrade to Fireship PRO at fireship.io/pro
Use code lORhwXd2 for 25% off your first payment.
🎨 My Editor Settings
- Atom One Dark
- vscode-icons
- Fira Code Font
Пікірлер: 423
I had a panic attack when he said you have to implement dynamic time-warping algorithm
@juanotavalo
3 жыл бұрын
same feeling
@user-ke4yx6uw1r
3 жыл бұрын
same here😂
@fredianriko5648
3 жыл бұрын
I have a trouble breathing at that moment, and my stomach hurt alot
@emaxix7
3 жыл бұрын
Wait, you guys can breath right now?
@Ab-cj6gl
3 жыл бұрын
same i swear 😂😂
hr : "write a dynamic time-warping algorithm" me : "ok let me make some test" hr : "in paper"
@TheHighborn
2 жыл бұрын
ok, so anyways string time = "hell to the no"; std::sort(time .begin(), time .end()); have nice day, it's "time" "warp", good bye, see you never
@MrBURGEON
Жыл бұрын
me: "dynamic time-warping algorithm"
@polski_dezerter
Жыл бұрын
@@MrBURGEON no no no they wanted you to write "a dynamic time-warping algorythm" so the ral anwser is "a dynamic time-warping algorythm"
@ModsForAndroidAndiOS
2 ай бұрын
ban this industry and regulate it; what happens in SWE is complete nonsense; to find a reasonable employer is not possible just through job listings; you need to find a niche and STOP thinking so deep - you'll fry your brain!
"Unfortunately we don't write tests for tests" Mutation testing: allow to introduce myself
@jcespinoza
3 жыл бұрын
Hey thanks! Didn't know that was a thing until today
@The8merp
2 жыл бұрын
You checkout Pitest for JVM.
@MikeStock88
2 жыл бұрын
Such a great way to check the quality of your tests Especially useful when you have to refactor something that has no tests
Now we need tutorial on how to write Dynamic Time - Warping Algorithm.
@chriseadie7089
3 жыл бұрын
You could unintentionally write a recursive function that should warp time trying to find it or maybe install every node package that should turn the node_modules folder into a singular even horizon and that definitely warps time 😂
@scripticstudios2022
3 жыл бұрын
@@chriseadie7089 big brain moment
@scripticstudios2022
3 жыл бұрын
@RaitRow same lol
@cableguy5576
2 жыл бұрын
bruh i was thinking the same thing
How did you know 😭I was literally googling this for my internship today. And this majestic video just drop 2 hours ago
A video on e2e test with cy and firebase emulator please 🤓
My Java DS&A course in uni was TDD without us realizing. The TA wrote all the tests so it was pretty convinient for them because we weren't submitting crap. The hardest tests to pass were the performance ones.
@sylvereleipertz955
8 ай бұрын
TDD and test first are not the same things.
Having done TDD for more than a decade, in Java, I must say this is one of the best intro to it. Any code worth writing should be done using TDD. It is the most valuable habit you could acquire as a developer. It gives you what non practitioners cannot have; true confidence in your code.
@tomaspilny8320
2 жыл бұрын
Being confident due to TDD is true only in moment when you know your tests are bulletproof - most of beginners practitioners won't have that level of confidence you would have after years of TDD thou
@badhombre4942
2 жыл бұрын
@@tomaspilny8320 The confidence builds as your code consistently pass QA while the others don't.
@ReddSpark
8 ай бұрын
I just don't understand how it would be useful in situations where the requirements evolve on a regular basis. For example a startup where you are finding out the right solution based on constant feedback.
@badhombre4942
8 ай бұрын
@@ReddSpark Actually that is the perfect case for TDD, where you develop iteratively and testing grows exponentially.
I literally never had idea how exactly testing is done, never tried, also focused on development, but this video taught me testing also in a very short time. Thanks.
Read few blogs, docs just to wrap this things around my head initially, and her I am watching and enjoying every bit of it now.
The intro for this video is filled with a bunch of emotions... Happy for a new video, confused by colors and labels, scared by entry level interviews these days and calm to know what to see in your next interview. Hahahaha Amazing video!
at 1:00, I was think about the exact same things that you mentioned next ( importance and do I need to do it every time?). That's why you are one of the best, you know what kind of question your viewers will ask you and you always (almost) already answer that in your videos. 👍👍👍
I have been waiting for videos from your personal channel as i want to know more about your productivity. As usual, this video was so cool. And your teaching style is evolving 🤗
No doubt, you are the best communicator of these topics and this is the best channel on KZread. Kudos!
@Fireship always keeping things simple and straight to the point, Thanks for this. As someone just coming into testing and expected to do TDD one major challenge I face is not knowing if its my test that's bad or if my feature implementation are just wrong, this makes me cut corners. Writing the code then testing it (but this can lead to bias, as I've been told)
Hey hey! Just wanted to say thanks for the great content, I'm a Full stack looking to move jobs and I actually looked as this video as exactly as you mentioned, I have an interview that will involve unit testing, so this has taught me a lot, and I love your style or teaching, I will deffo be signing up to some of your more advanced classes in the coming future, keep up the good work!
More videos on Tests please! This probably the least covered area of development in the YT community
As you said it's very satisfying to see tests passed. My favorite tools are RTL and Jest.
That jab at PM's and clients regarding 100% test coverage was so good. They do get easily fooled by those numbers.
As full-stack pro I love your videos! Clear, to the point & concise! Great job!
@MuhsinFatih
2 жыл бұрын
you're a full-stack pro? damn you must be so talented
@balddog470
Жыл бұрын
define pro
@edgarsvilums1550
Жыл бұрын
@@balddog470 A professional, by definition - "someone engaged in a specified activity as one's main paid occupation rather than as a pastime." Are you trying to sound smart by asking elementary questions? If you don't know what a professional is, you could've just googled it, jeez..
@balddog470
Жыл бұрын
@@edgarsvilums1550 i have no idea why i commented like this lol
Please bring a series on how to test react functional components. (In detail please 🥺)
@Medik_0001
3 жыл бұрын
There's a good cypress plugin for that
@yamogebrewold8620
3 жыл бұрын
Use React Testing Library
Hey, love your videos and really beginner friendly. However, I feel it's important to describe better what a unit test is (e.g. API calls using spies, stubs etc), what a functional test is (better explaining what assertions should be done and explaining the testing of interaction between different parts of your code) . I've been doing that for around 8 years and when people have to really go in and write tests it's indistinguishable for them which one is unit or functional and I've banged my head against that topic too. Looking forward to another more in-depth video, keep it up : )
@michaelslattery3050
Жыл бұрын
I'm glad he didn't. Most of us are unit testing wrong, and I'd rather it not be further spread. The right way could be a distraction. See Ian Cooper videos for details. (Test your API , not your implementation classes; good unit tests test functionality, making conventional functional tests unnecessary.)
Subscribed not because of invaluable content but also how it's lectured, thank you Fireship :)
Thank you for this great explanation. I will be a pro member, because I have learnt a lot from you. You are a blessing to the software world 🌎.
Nicely done, just what I needed.
This is definitely what I need to properly learn, Thanks
I've read and watch a lot of TDD guides and I still can't wrap my head around why we needed it.
This dude reads mind! Like today i was assigned a task to write test cases, and he just uploaded one. Damn ❤️🙏
I hope one day I can make videos like this, the quality is insane.
I always thought it would be difficult to make test codes... Thanks you for changing my mind♥️
You're the best KZreadr there is when it comes to programming world. Highly interesting and funny has hell. I hope you're not about to retreat anytime soon. Big, big fan.
wow, this is so nice, I came back while implementing this, first time I only watched it , a month ago, but now came to implement this... thanks a lot.
Thanks for the amazing content bro.
Woooohoooooo, so happy about seeing this. My latest vid shows how I use it in my daily development for Flutter but I haven't gone over the full process! This is an awesome video Jeff!
i never wrote tests, did not use typescript, had no clue about ci .. i learn this stuff right now in my new job and i love it!
I'm surprised with the quality of each guide in this channel. Great video!
Wow, I never thought that TDD could be fun. I'll try this methodology in the next project.
As a noob I used to only do manual QA because "why would I need tests when it's easy to tell if it's working". But let me tell you once you switch to TDD it's so much less overhead to worry about. You *know* your change isn't going to cause a cascading failure. You *know* you didn't make an oversight when writing that database filter. You *know* your maths are correct. Also it's so much easier to pinpoint the problem when your test cases are small and everything is modular. So much more confidence in complex codebases
@marcosrolando7987
Жыл бұрын
There's a misconception that derives from the name probably, but TDD is not only making tests but actually *making them before even writing a single line of code that solves those tests*. If you are writing your tests after the code then its not TDD, its just testing (which is not bad thing, TDD per se is almost never used at any job because its complicated to be efficient with it).
@muhmmadawd3206
Жыл бұрын
@@marcosrolando7987 but for newbies in testing it's better to write your tests after making the xode then when you feel your good you can start your tests first😊
I want to start working with unit testing on my office. this video show me why. I will show it to my team. thanks a lot for that.
Another awesome video. Thanks a lot! I have been trying to combine the jest and cypress coverage reports in a TS & React project. Can you please cover that in one of your future videos?
First time honest Video about tdd.
You can also do E2E testing with Apache Jmeter. Jmeter is open source, works on any platform and with any development stack, and easy to use with/without testers help by using the proxy server.
Amazing tutorial on testing, thanking you heaps!!! ❤
Great material, as always. Thanks!
Amazing insight into the world of testing.
This is the video I’ve been waiting for :)
Since you mentioned interviews I am currently working as a software developer for a bank for over a year now. The company took a chance with me after a successful phone interview. Written/coding interviews I find hard. Not becuase I can't do them. No. But becuase I always have a pain attack doing exams or tests. I am not good at taking tests but I can redeem myself through implementation and demo. Test driven development has been a God sent since I started using more over a year ago now.
wish there was a channel like this for non js/ts/node stuff
This is testing oversimolified. Love it!! Could you do a course one cypress with js or do you have a course on that?
This is awesome, I didn't know about cypress. I have implemented a huge amount of test in the past using protractor but is not as straightforward as cypress as I can see
This is really helpful. Thank you! 🙏
Looks like someone got "Continuous Delivery" channel recommended :) Nice and informative video.
You are awesome. Your video content makes me keep on watching and brings it back to youtube frequently :)
Man, this channel just keeps giving.
Your content is always amazing, thank you a lot for your awesome work !
Very useful, will apply to my next project.
So I went ahead and implemented the stack thingie while I paused the video, I am happy to find out we implemented it similarly :D although, you set up a project, I did a docker run -it node:buster bash and then apt update && apt install nano and went from there :p
Able to understand TDD first time because of you..♥️🇵🇰
I was close to giving up on implementing unit tests into an existing Svelte+Tauri+TypeScript app. Jest? No luck. Jasmine? Nope. Using TypeScript in the project made everything unnecessarily harder to integrate. I had 30 tabs open, from stackoverflow to GitHub issues in various packages. No lie, 6 hours later I managed to make it work. Not sure if what I did was correct, but it didn't matter. I was able to run a simple test I wrote hours ago. I stuck with Jasmine because I dropped Jest halfway through out of curiosity if it not working was about Jest or not. I also added istanbul/nyc for coverage later. I'm in love with unit testing now. Excited to check out cypress. Thanks for the timely video! 💚🐢
Very nicely explained!
The best Thumbnail ever on a Developers Channel! ✝️
Just a note, just a tiny mistake in tests would make a huge-deep-logical-hardToFind bug in your app, because it might pass in dev but it might be buggy publishment. So always test the fn in addition of these testing tools.
Thank you for making the video on webgl
this was a really awesome video!
I had lost my motivation & will for writing test. I didn't write tests for 1 week & didn't even write a single line of code for that project. Thanks for motivating me again to write 1000 more tests🙂 If you know what your software will do, its way easier to build code for that software
adamın videolar çok iyi. çok güzel özetliyor
Thank you, I am now considering Fireship pro.
Man, you're a hero...
Really a great video on testing
Would love to see a blog post or video showing how you set up the firebase emulator to run with cypress. And would that be integration testing, or E2E, or just ui testing?
This is just amazing. WOW
Very nice vid, thanks!
I Tested the like button It worked first time
Love the thumbnail! Greetings from Paraguay
Loved it 👌
awesome, now i pained served this way
Would love a video on react testing library 🙏🏼
You should make an entire course on testing ⭐️
I always prefer this pre-learning method of describing the path of the science or tech to understand what you are going to find withing it Just make more sense just i would like if you could make a map of what you talk here on github so we can use it for later .thanks
This video is nothing but constant Aha moments. Thank you for filling in my gaps of knowledge
@Fireship you didn't mention regression tests. What is your opinion about them? I love Storybook's storyshots and how they basically come for free. It saves tremendous time compared to writing unit / e2es, that they can cover. (of course I wrote those, too just need much less) I think it would be beautiful if people used more storyshots :) or at least knew about it. (it also encourages smart+dumb component pattern)
This is really great. I would object to the actual TDD example you give though. Your stack is a leaky abstraction and the leakiness crept into the tests. A Stack "should" only have push, pop (and either peak or isEmpty, depending on your style of stack). It does not have a top, or an items and writing tests against those implementation details means that if you want to change the implementation, you have to change both your test suite, and your implementation. the TDD sequence for a stack with pop, push, isEmpty might look something like - given an empty stack, then isEmpty is true (implement stack class, implement isEmpty that returns true) - given an empty stack, when I push onto the stack, then isEmpty is false (add state to stack class and have push mutate state and isEmpty return based on the state) - given a stack with a single item pushed on, when I pop off the stack, then isEmpty is true (have pop mutate state) - given a stack with a single item pushed on, when I pop off the stack, then the value (have pop return the element at the top of the stack) Probably at this point I have a stack. I could also not have a stack (because I could have implemented an optional), so it's probably best to check that I can push 2 items on the stack and then get them in reverse order when I pop them both up, and end up with and empty stack.
@raphaeld9270
Жыл бұрын
That is a great point: you should keep coupling between your tests and your implementations to a minimum. Makes me remember that connascence + TDD video : kzread.info/dash/bejne/mIemmq59k8WWiZM.html Have a great day ^^
I'm a tester and this is one of the best explanations for different testing strategies one can look for
Great video!
Thanks!
Nice video. Although I don't agree with using the beforeEach for this kind of things. Pass everything you need to each test so that you don't cause side effects by mistake. After being working with tests for some years it was something I learned the hard way (debug tests instead of the code ⚰️)
@ogodoonyebuchi2129
Жыл бұрын
Can you give me like 30 minutes of your time, if yes, kindly drop your social media handle let me connect with you. I'm a new Automated tester and I need to ask a few question. Thanks
Just perfect!
It seems you read my mind !~~ I was searched someone to explain it to me :p
You should make a video on website Domains and the working of hosting of websites. Like how does one buy a domain, use it and host it Or Types of website domains in 100 seconds Or Working of vscode (like the internal working of it, the technologies used, etc) Or A video on 2D library/framework for javascript (as same as you did for threejs, make a video on a threejs counterpart 2D framework of library) And I still have a lot of ideas
You can selenium as for front-end testing.
Fantastic! Thank you! Moooar please :D
Much needed intro, Lets say I'm introducing Testing to a startup SaaS web product, with zero teseting till date. With limited dev resources, whats by best ROI test to first implement, Looks like e2e test is the best to start with . What are your thoi
A video on debugging unit test would be great
Amazing!
amazing tutorial
its amazing!
As a tech lead of the QA automation team in my company I can't stress enough how important is Cypress for web testing. And if done right it can do much more than Selenium with waaay less test flakyness
@Cahangir
8 ай бұрын
Hey , if things go well i might start diving into QA field soon. Would you tell me which programming language am i supposed to learn to get ahead in the competition? I can be considered an intermediate level Python programmer and currently playing with MySQL to manipulate some databases at the moment ( data enthusiast here).
Heavy hitter!!! 💥⚡️🔥
Very interesting thank you
you guys ROCK \m/