What is Unit Testing, Why We Use It, and Sample Test Cases
HTML-код
- Опубликовано: 17 янв 2025
- Unit testing is a huge part of Software Development, however it's one of those topics that is not easy to understand until you are given some proper examples and context. In this video, we explore a simple test case that prevents some embarrassing mistakes from being introduced into our production application.
Enjoy.
Instagram Firebase Course
www.letsbuildt...
Time Ago Algorithm Explanation
• Swift: How to Display ...
Facebook Group
/ 1240636442694543
iOS Basic Training Course
www.letsbuildt...
Follow me on Twitter: / buildthatapp
This is a very underserved topic. Thanks for putting out a video on it. All devs need to know this.
Testing is definitely a topic that deserves attention from iOS developers. It's very interesting all the flaws you can find by just testing your own code.
Thanks for the video Brian!
Posting it here as both you and Sean post tutorials very actively.
If you guys get a chance, could you please post a video on how to write cases to test HTTP requests and responses using something like OHTTPStubs?
Thank you for all your posts. Cheers!
rumitification good request)
Mera number hai koi
Thanks for the video
I know this video is three years old, but it's very educational about this topic of unit testing. Thank you!
Fantastic and quick introduction to something that is whispered in hushed tones amongst junior developers.
First time I see such a simple way for the explanation. Great!
Brian Voong you are to iOS what Andrew Ng is for Maching Learning : concise, clear, and brilliant !
Very nice! I like the new effects! It gives your videos a polished look
Thanks Marc, I'm still figuring my way out around Adobe Premiere.
First I heard of built in test functions. Reminds me of sales force development. Thank you.
Yep, all enterprise companies have very robust testing infrastructure that produces reliable code for their customers that are paying millions.
Yes please! Can you make unit testing videos! Especially for networking and requests and model objects as well!!
Yeah I think I'll make a unit test video on network requests.
Nice, elaborate and to the point. Need some advance examples but for gaining basic understanding this is superb.
I don't use swift, but this was a really helpful primer on unit tests! I've worked at too many companies that don't see the value in them, so I'm working hard to start integrating them into our code base
Not even coding in swift, but very interesting to watch. This channel is awesome. Talking about very important stuff for newbies. Much appreciated
Yeah this channel goes into more useful advanced topics that beginners should be aware of.
Not aa iOS programmer here but your video explanation is so clear that I understand the concept anyway. Thank you!
Perfect timing as always! Thank you Brian...much appreciated!
Perfect timing? Exam? Job interview? You've piqued my interest.
Lets Build That App Hey, Brian...this week's application assignment for school was creating an app that included UITest...Unfortunately, my teacher isn't the greatest, so see outside resources to further my education. So it was perfect timing...as I follow all of your videos anyway.
woah... from 7yrs ago instagram looked much the same !
I never bother to learn what's that UnitTesting in Xcode for before. thanks for this! nicely put along with real-life example use case. now that you mentioned about Continous Integration, would be great if you could talk more about it in your next video, what tools you're using, and so on! Cheers
I really liked this video. I am relatively new to testing, and find it a big challenge sometimes, especially when it comes to UI. Can you do some more complex testing tutorial as well please?
Yeah, there are many aspects of testing that can be applied to apps. I'll plan out some more videos on this.
Thanks, Brian. This was excellent!
Some of your videos made me convince to learn programming. Thank you! :)
Hey thats great, hope you can see how simple it is when starting from scratch and building up a full product.
Awesome video. Would love to see more about advanced unit testing
Yeah, looking to put some more testing videos out.
Excellent explanation!
Very very clear! Thanks a lot!
Sweet and right to the point.
No fluff, just pure content.
very nice and easy to follow
Thanks a lot for clear and easy explanation!!!!
very explanatory! thanks a lot.
Great video Brian, I always thought that testing is tedious but this really makes it logical and appealing.
Those pesky "junior developers"! Always breaking all the code that only I contribute to!
Indeed, 100% of bugs were never my fault :)
We can't fully blame junior developers unless we taught the concept and they didn't care
Thanks Brian!
logically structured and informative presentation...thanks
great work
thanks Brian, very usefull
Great, thanks a lot!!
Amazing tut
Hey Brian, how you doing? Always pushing us further, few code lines at time. Thanks for enlightening us, the mere mortal beings struggling to be relevant in this iOS universe. ;-)
Wooow! I was waiting for this!! Super!
Glad to have finally been able to make a video on Unit Testing as it's very important in the real world of software development.
This topic is most important for us. I understand it clearly, because your teaching method is great :)
please also make a video on test case for web services, api testing.
I'm waiting for your kind video.
super like this video and much needed....waiting for your UI unit test video
i wish one day you also start teaching us android with same fun :) [but iOS - first love would remains first]
BDW I am glad to tell you that whenever i do swipe on my smartphones...i notice diff apps and started dreaming coding the same programatically....Brian you have impacted so +vely....FAN OF YOUR WAY OF TEACHING
That's excellent, I also find myself trying to break down the apps I use into components I can build. It's a lot of fun.
Very good explanation
This tutorial is super!!. Thank you, I understand it very easy
Hey Brian! Are you going to WWDC this year and planning to make a video about it?
Hey Tom, unfortunately my budget doesn't allow for a WWDC ticket. Perhaps I'll attend alt conf or some other nearby meetup.
You are the best!! Thank you so much!!
Thanks Joyce, testing is a very fun topic.
Thanks for creating this video.
Unit testing is a way of testing one unit of a software application. A unit is the smallest piece of software that is isolated and tested as an individual for functioning. Avo Automation provides the best automated testing platform for all types of software testing, including unit testing
good explanation
You made it when I wanted to ask you to do such a video
I would *love* to see more videos about Unit Testing! Keep it up, please!
never knew test cases this much easier. Thanks for knowledge sharing
5*
Hey do you think
I can use this to make sure all my products are priced correctly on third party apps?
Thanks for the video Sir!!
Super, thanks! What code editor are you using for app development? Do you do other development (Android, web) and if so, do you use the same environment? Thanks!
I really like this video!
We really like it too!
Thank you so much... This is very precious 😀
Heeyy what's up Brain ! Hope you are doing well ! I love your videos. We are learning so much things.
I want to ask one question.
Will you do some videos about the image processing in swift or do you think ?
When you say image processing are you referring to filters like instagram? I've written the code before and I could share it later on.
Lets Build That App No, not like the instagram. Like using open cv, doing corner detection , tracking object, scanning documents etc. Because there are not lots of source about swift - opencv .
I see, I've never looked into opencv before, perhaps one day I'll do some research.
Lets Build That App
Okey, thank you Brain. we love you. You are awesome !
Learned about Unit Tests and that you can create extensions on primitive types. I'm new to Swift haha. By the way, your content is awesome!
I can say only one thing.. He is a swift god
+Vijay Reddy oh rly
Your awesome man!
Your videos are excellent and great on teaching Swift. Please continue your hard work! Truly appreciate. Are you gonna teach Android in the future? If not, any recommendations who has best teaching on Android?
Awesome
I have a second interview in about two hours, thanks for this video! Wish me luck!
Made this topic clear to me in a just few minutes. Many thanks!
Thanks for the video. This enlightened us on why unit test required and how to write test cases. Could you teach us how to write UITests and Mocks?
Could you make a video about your setup? I'm really curious what tech you're using. Love your videos btw ^^
My development setup or recording setup?
Lets Build That App Both but I'd be more interested in your development setup
Which hardware is using in unit testing
Could you do some Unit and UI testing tutorials?
Woah... bryan you blew my mind!!! The square() on extension int is so cool!! But my question is, is there a reason why you did it on extension, instead of having function with arguments and returning square value??
Well, with extension you can call it from anywhere in your project and its easy to use. Functions are quite clunky. Also, the extension makes for an excellent example of how to implement a simple Unit Test.
I love you bryan
superb
can you plz put some more content on TDD. thank you very much awesome video.
how often do you update the instagram class?
I'm trying to update the course with at least one lesson a day. Apologies for not uploading a lesson yesterday. There will be two lessons uploaded today, episode 16 should already be available. Again, sorry for the wait.
Awesome tutorial...Please explain about Automated UI testing in xcode objective-c
which language are you using?
Is there an iOS Objective-C channel which is as good as this one?
Please one video on UI testing
Does the application needs to be built for the unit test to run? OR it’s just like calling functions in our code with some predefined data?
This may seem a stupid question, and I apologize in advance for it, but I'll ask anyway:
In your square function you used "3" for testing the square value, but let's say one uses "2" for testing; the result must be "4". But, if someone modifies the square function and "by mistake" changes the "self * self" to "self + self", if the testing value is "2" the result will still be "4". How does it assert that my function is right?
Will the tutorial use storyboard for design or all through code
All the tutorials I produce use the simple code approach. Once you get the hang of it, you'll find it to be quite enjoyable.
I started use UI programmatically after your RUclips seri. It's a wonderful change in my iOS development. Thanks Brian.
Thank you for the video, is great and it help a lot =)
sooo, in this case you compare the result of your square function to a build in square function. What do you do when you have a more complex function to test? recreate the complex function in your test script and compare it against the one writen in the project? I am not really sure I can follow what you do here. Or would you manually calculate with fixed input value and then hard code the result value while comparing it against the function when given this specific input value?
I'm not sure if you watched the entire video, but at the end we test a complex function that's in our project that prints out the timeAgoString. You simply create an instance of your objects and test the function calls with some inputs and verify the output is what you expect.
Thanks Brian for all the amazing tuts.
what should one unit test in a typical MVC iOS app, what parts should be covered by unit tests other than model layer and business logic?
Awesome tutorial!!! I want to learn more about Unit testing. How can we use it for TDD approach? Recently I faced this in an interview, I got selected but still not feeling comfortable regarding TDD. Can you give us any tutorial for TDD approach with swift?
I have a friend that does testing for work and he's going to be coming out with his own channel so stay tuned.
Thanks Brian! Do we need to create separate file for each test? Or do we have to create file for group of tests, or file per logical module?
All the junior dev's got attacked 2:14
Great vid man well done - only advice, step-by-step is always better, conciseness and simplicity are they keys to teaching skills. The least amount of words and points that say the most make knowledge acquirable for anyone in your medium.
Examples to check out concretely would be anything from Chad Darby - dudes got the simple down
Cool, chad goes at a much slower pace so it’s easier to understand. I’m not a big fan of preparing and reading from slides personally, I think I’m too lazy to actually do it.
write code to test code? what if you write bad tests?
Here is a video idea for you: Usually it is not hard to make tests. What is hard to determine is WHAT to test with unit testing. Because you don't want to test trivial things like square. What do you think of this idea? :)
If you're writing tests, a simple rule of thumb is to test every method that is public. This will help you determine what should be exposed and what should be kept private.
Hi Brian, can you make video about XMPP Chat services? At least quick information :)
What if there is a bug in your unit test code, and do you have to do a unit test to test your unit test code, and then do you have to unit test your unit test ... infinitum or am I missing the point?
Well there's always potential for bugs so testing isn't going to be 100% bug free most of the time. Furthermore, writing tests also makes you write code thats simple and easy to test. In the long run, it will save you many headaches.
I've just got a boss who knows how to break things. Not sure how he does it, but he always finds my bugs LOL
How do we create tests for Watch App?
I have a question as a Junior Developer: What kind of app should I bring to the app store to utilize as my resume app? How large, complicated, etc. should it be (are the good app examples that employers would like to see)? I have the basics down, the general requirements for a junior position and I have created 'mini' apps that are very simple in nature, but I don't know what I should create, or how since if it is too big I might be wasting my time (in a way 'wasting time' as in not actively working towards getting a complete app to use as a job resume). Any advice would be great :)
I would set a baseline of creating apps using core data and cloud db such as firebase. I create the paid courses on my website to help people land jobs. Go check them out, I’m sure you’ll find them useful like the rest of my students.
Thank you for the quick reply! That is great news! Will take a look at your paid courses and will try to create something around core date and/or cloud db. I really appreciate the advice :)
excuse me, can you help me, i'm having a problem about error domain 9806 and 9807 requires a certificate of trust
thank you
Excellent.
@@LetsBuildThatApp I have granted permission in info.plist file but failed, do you have any suggestions for me
thanks
subbed😁
Hi there Brian, thanks for the great video, very informative. Just a tiny bit of constructive criticism. The audio compression ration of your voice is set veeeery high:) See if you can tone that setting down a bit - it will make your voice a bit more natural and reduce over-emphasizing of other unwanted noise.
Again, thanks for the video, I especially like the fact that you use a very real world application!
very cool!
Sean Allen and Brian Basically The professor we dint have in collage
Can we have a video on UI Test?
Yes, I'll make some interesting videos regarding this.
UI testing soon?
Hey, can you please tell us how to write user interface testing for google sign in?
That sounds like something that would best be suited to an automated testing tool like Selenium IDE which is used for UI testing and is available for Firefox and Chrome.
Thank you
Were test-driven development and agile common practices in your previous jobs? If they were, how did you implement tests in a short iterative development cycle?
very profesional, thank you
Wait. I can find the instagram tutorial anywhere. is it coming or? i trying to learn how to make a profile account with public and private users
oh you have to pay. that sucks but get your money up i see you.
Yep, I think you'll enjoy the course if you like learning about iOS development.
Can you make a video for CI/CD using JENKINS,GIT,
Hey Brian. Nice job. Can you please share Spotify demo and tinder demo as a course I saw it on your device :)
Testing is a big part in the development and we should focus more on that but We have so much more to learn on iOS and Swift app development e.g. if the app is inactive and goes to the background what kind of stuff can we do at that state etc.. . Can you please make more apps that is the best way to learn. An application where we have different UIViewControllers and other important stuff from Apples framework involved like MapKit etc. would be perfect. Thanks
Yeah, unfortunately I'm a one man team here and preparing/recording everything is more than a full time job. We'll see what I can get done on my starbucks espresso coffee drinks.
If you are a Qa/test software engineer, is this the work the person would do?