Why do we need test case in swift | xctest | unit testing | code coverage

Поділитися
Вставка
  • Опубліковано 22 сер 2024

КОМЕНТАРІ • 84

  • @CodeCat15
    @CodeCat15  3 роки тому +8

    In this video, we will understand what are test cases and why do we need them along with the difference between unit and integration test case, we will understand the need for a writing unit test case in a project with the help of an example. In the second part of the video where we will learn how to write test cases for an API along with some good practices. If you have any questions on this topic please do ask in the comments and do share the video with your friends and do support the channel by subscribing to it. Happy iCoding.

  • @pushpender.s
    @pushpender.s 3 роки тому +4

    This is called quality content… I have seen few videos of yours from yesterday and i would say it’s great.
    my company is going to change my team and in the new team, I have to write test cases and Jenkins will take screenshots.
    These types of videos has limited audience still you are creating with full of passion so thank you so much.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Much appreciated! Thank you for your kind words. I am glad this channel and its content are proving to be helpful. I also share some short swift content on my instagram account (@codecat15) so do check that out as well :)

    • @pushpender.s
      @pushpender.s 3 роки тому

      @@CodeCat15 Sure, will subscribe you there also, thanks a lot again brother for the quality content.

    • @aafaqahmed2265
      @aafaqahmed2265 3 роки тому

      Indeed @pushpender

  • @AnuragKashyap17
    @AnuragKashyap17 2 роки тому +2

    I really like everything on this channel and the fact that you reply to each and every comment. Man!!!! you are doing a splendid job with so much of passion. A video on VIPER implementation from you will add something more to this channel. Thanks once again. PS: I would really like to buy you a pizza or a beer :p hehehehehe.... Keep it up!!

    • @CodeCat15
      @CodeCat15  2 роки тому +2

      Thanks for the kind words Anurag it means a lot, VIPER is planned for next year along with other complicated topics which will be simplified soon.
      I also share some short videos on Instagram like a 2-3 min reels on swift so do check those out as well
      Pan base pizza is ❤️ but for now just share the channel with anyone who wants to learn swift or with your iOS group of company or WhatsApp or LinkedIn 😊

    • @AnuragKashyap17
      @AnuragKashyap17 2 роки тому +1

      Few of your subscribers are known to me i have shared your channel to them and they are subscribed to you. And also I do want to buy a Pan pizza then for you. 😅😅

    • @AnuragKashyap17
      @AnuragKashyap17 2 роки тому +1

      Please do not ever stop creating videos , soon your channel will be famous , it is slow process but then indeed a permanent one it will be.

    • @CodeCat15
      @CodeCat15  2 роки тому +1

      I guess I would never stop making videos on Swift or anything related to iOS development, as when I was down and demotivated the iOS community took care of me and for that I am grateful and want to continue this work.

  • @polu9132
    @polu9132 3 роки тому +3

    Great work. keep posting videos on different topics related to iOS development. Kudos to you.👍

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thank you @polu and welcome to the channel

  • @darshantelang1535
    @darshantelang1535 3 роки тому +1

    Excellent intro to Unit Test Cases. I liked mention of Code Coverage and its importance. #CheersToCodeCat15

    • @CodeCat15
      @CodeCat15  3 роки тому +2

      Code coverage is something that's ignored by many, and devs feel that just by adding test cases they are doing a good job but then really it all boils down to how much of your code is covered with test, are you performing integration test with happy and failure path scenarios coz just like for every if condition we need an else similarly for every happy path we need a failure path test cases as well.
      I make sure that when I get the PR, the code coverage is more than 70% else I reject that PR, well I do have that automated in my build configurations hehe

  • @tankarshah9913
    @tankarshah9913 2 роки тому +2

    Very useful and conceptually explained all the things very clearly.
    Thank you Ravi sir for creating such a very fundamental and useful content for the community..!!

    • @CodeCat15
      @CodeCat15  2 роки тому

      You are most welcome, do share the video with your iOS group and always feel free to ask questions

  • @Real_Indian_bhartiya
    @Real_Indian_bhartiya 3 роки тому +4

    your content and efforts are much appreciated

    • @CodeCat15
      @CodeCat15  3 роки тому

      welcome to the channel Vaibhav, I am glad this video was helpful to you. Please do share this with your iOS group or with anyone who wants to know why test cases are so important and always feel free to ask question I will be happy to answer them

  • @sambit6500
    @sambit6500 3 роки тому +4

    It was really an Awesome video! It is very helpful for me, Thanks 🙏 & Merry Christmas 🎄

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Hey Sambit, i am glad this video was helpful, do feel free to ask questions on this topic and do share this video with your iOS group. Merry Christmas to you too buddy

  • @surendramavuri9162
    @surendramavuri9162 4 місяці тому +1

    Very Good one. Thanks!

    • @CodeCat15
      @CodeCat15  4 місяці тому

      Glad you liked it!

  • @prachibile2798
    @prachibile2798 3 роки тому +2

    Hey @ravi. I am really a fan of yours. Whenever I want to learn anything in iOS then I search in your channel first and then I go through it. Your way of explanation is just awesome. Now I am doing unit testing for my project but using Quick and Nimble, Can you please make a video on Quick and Nimble especially UI Tests?

  • @Karma_Rinku
    @Karma_Rinku 3 роки тому +1

    Video editing and all video delivery are great... Keep it up and video on all swift. docs topic ... For every chapter and each topic ..up to Advance level SwiftUI etc Thanks

    • @CodeCat15
      @CodeCat15  3 роки тому

      I will try my best Karmjeet and thank you for your kind words

  • @yogeshdate99
    @yogeshdate99 2 роки тому +1

    great video Ravi...
    Definitely your video will add more value in to iOS engineer...
    Keep it up bro....

    • @CodeCat15
      @CodeCat15  2 роки тому +1

      Thank you Yogesh, am glad the content is helpful. Do consider sharing the same with your iOS group 👍

  • @malleshaholeyache4464
    @malleshaholeyache4464 2 роки тому +1

    Your explanation is awesome Ravi sir. I really loved this video 😍❤️. Keep posting such videos 😊.

    • @CodeCat15
      @CodeCat15  2 роки тому

      Thank you so much 😀

  • @pradipdeore8068
    @pradipdeore8068 2 роки тому

    simple explanation yet very informative content.

  • @JunaidKhan-ny8tu
    @JunaidKhan-ny8tu 2 роки тому

    Yar kya bat hy Ravi bhai ❤❤❤❤

  • @rachitsharma8829
    @rachitsharma8829 Рік тому +1

    Superb and Excellent explanation ... 👌

    • @CodeCat15
      @CodeCat15  Рік тому

      I am glad this was helpful 👨‍💻

  • @rishusharma8817
    @rishusharma8817 2 роки тому +1

    Good job

    • @CodeCat15
      @CodeCat15  2 роки тому

      Thank you, I am glad this was helpful.

  • @Real_Indian_bhartiya
    @Real_Indian_bhartiya 3 роки тому +3

    keep on making such videos...

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thanks Vaibhav, I will surely keep on sharing whatever I learn or implement something new with everyone

  • @anshuiphonedevswiftandswif2107
    @anshuiphonedevswiftandswif2107 3 роки тому +1

    Great work . Keep on more videos

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Hello Anshu, welcome to the channel and thank you for your comment :)

  • @museeransari8339
    @museeransari8339 3 роки тому +1

    I am a big fan of you
    your explanation is awesome

    • @CodeCat15
      @CodeCat15  2 роки тому

      Thank you so much 😀

  • @arindamsantra1727
    @arindamsantra1727 2 роки тому

    Great Content

  • @DhavalHNena
    @DhavalHNena 3 роки тому +1

    Nice example!

    • @CodeCat15
      @CodeCat15  3 роки тому

      Glad that was helpful Dhaval

  • @pankajchahakar8623
    @pankajchahakar8623 2 роки тому

    Hi I love watching your sessions, it helps me a lot, I have request can you please make some videos on vip clean swift and unit test cases in vip clean swift

  • @connectSanjayMali
    @connectSanjayMali 2 роки тому

    Kudos bro..

  • @kartheekmanthoju493
    @kartheekmanthoju493 3 роки тому +1

    Excellent explanation

    • @CodeCat15
      @CodeCat15  3 роки тому

      Glad it was helpful! Kartheek

  • @govind20246
    @govind20246 3 роки тому

    Simply awesome 👍

  • @prafullkharche3835
    @prafullkharche3835 2 роки тому

    Hey Ravi thanks for your video, i want to learn How to made SDK can you pls get a session of SDK Creation..it will helps to lots of people ..

  • @Hassankhan-cn9wu
    @Hassankhan-cn9wu 3 роки тому +1

    Love from Pakistan bhai level ha apka

  • @suhaspathak6319
    @suhaspathak6319 3 роки тому +1

    Thanks for efforts to make a video. Can you make a video on API response model.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Hey Suhas can you elaborate more on the api response model please coz am sure the api series takes care about such models but i just wanted to be sure before I answer this question

  • @shashankmishra5329
    @shashankmishra5329 3 роки тому +1

    thanks for video!!

    • @CodeCat15
      @CodeCat15  3 роки тому

      Welcome Shashank, please let me know if you have any questions on this topic and do share this with your iOS group on WhatsApp or Facebook

  • @venugopalreddy6618
    @venugopalreddy6618 11 місяців тому

    Can there be a source code , which is hard to write unit tests for?

  • @entertainmenton2106
    @entertainmenton2106 3 роки тому

    Sir can you make video how to make project from basic step by step how to do Start and end in hindi .

  • @sheshadrivendramishra1543
    @sheshadrivendramishra1543 2 роки тому

    sir, i have a project with a chatting screen too in which i want to chat and along with i want send multiple image name, url, or multiple documents so how to do it???
    i did chatting for both sides receiver as well as sender and it is working well using table view.......but inside tableview i wanna take a collectionView in horizontal scrolling in which i want to send a url of image or any kind of documents(must be multiple) and and horizontal rows of must be tied with the row of tableView cell's row in which i am sending message but not others......don't want to use any third party or firebase..........so plz help me

  • @akanksha2143
    @akanksha2143 3 роки тому +1

    hey CodeCat, please make a video on types of notifications.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I can show local notifications and cover all grounds with that but for push notification i need my own personal account and cannot use company account and the issue is I don’t have a personal account for APNS so showing just theory is something I don’t want to do coz for push notifications theory adds a less value than practical

    • @akanksha2143
      @akanksha2143 3 роки тому

      Ok thanks. If you get time then start memory management topic also.

  • @indivarraina5473
    @indivarraina5473 3 роки тому

    Hi Ravi, Thanks for the video , was really looking for some test cases tutorials. I want to ask that the scenarios that you have passed through the test files, I also need to follow the same approach in my controller files too right ?

    • @CodeCat15
      @CodeCat15  3 роки тому

      when you say controller files, do you mean UI test cases? or something else?

    • @raviphulara8165
      @raviphulara8165 11 місяців тому

      Hi Sir, could you please share some UI test case demos?

  • @nagarajvrao7249
    @nagarajvrao7249 3 роки тому

    Can't we use protocol default implementation for logics instead of hard coding?
    Can't we define a protocol which we use for our logics in ViewModel/model/validator & use the same logic in test case?
    For ex.
    Protocol SomeProtocol {
    func getFullName(fName: String, lName: String) -> String
    }
    extension SomeProtocol {
    func getFullName(fName: String, lName: String)-> String {
    fName + lName
    }
    }
    struct ViewModel: SomeProtocol {
    }
    Class TestCase: SomeProtocol {
    XctAssertEqual(viewModel.getFullName("Code","Cat), self.getFullName("Code","Cat")
    //with this approach we can test all the values at once
    }

    • @CodeCat15
      @CodeCat15  3 роки тому

      if i understand that right, you want to use the same protocol and write the business logic or should I say code from the view model or other layers in the extensions? Correct me if i got that wrong please but if I did get that right my question is why do you want to do code duplication at two places and what's stopping you to directly use the concrete implantation?

    • @nagarajvrao7249
      @nagarajvrao7249 3 роки тому

      My point is It is better to re-use the same logic instead of hard coding the logic in the test case.
      For example If we are reading first name & last name from a JSON file, it will be easier to loop for all the values & assert In test case.
      func testNames() {
      users.forEach { user in
      let actual = viewModel.getFullname(user.firstName, user.lastName)
      let expected = getFullname(user.firstName, user.lastName)
      XctAssertEqual(expected, actual)
      }
      }

    • @CodeCat15
      @CodeCat15  3 роки тому

      @@nagarajvrao7249 calling an actual API is preferred and let me tell you why Nagraj, sometimes when the server folks change the response key value then it will be easy to detect such hiccups because you are hitting a real server and not mocking the response from the server and I have had my fair share of pain in the past because some creative developer from the API team had different key-value pair on dev and different on QA, and if I did not have test cases I would have never caught such fantastic work of art done by the API team later i came to know that their deployment was failing to QA and they had no process so it was my test that caught it. I know once the QA was down and it was my test cases that caught it because my tests were failing. Having a JSON file locally will hide these kinds of issues

    • @nagarajvrao7249
      @nagarajvrao7249 3 роки тому +1

      1.We can't call the API if it isn't ready
      2.If the API is dependent (on token...), we can't hardcode it.
      So Instead of directly calling the API, I thought of reading it from the local JSON & parse.
      Ofcourse If in the backend if the key value is updated, we can update the local JSON as well.
      I didn't get what issues you faced/ one might face? Can you explain (if not here may be in the next video)
      In your case key-values for development & staging were different?

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Api when its ready can have issues and the local json file will never ever catch that issue coz the local file is not the place where api developers will make the change, or what if there’s a logical change?
      Also it will be a pain to maintain that local file in sync with server response, we cannot be sure that api response will never change coz changes do happen and we won’t work on the same project for 5 years someone else will maintain or pick it up
      So when they look at this wonderful test that pass but in reality due to server response changes or server not being live you are not getting the response so the test is really not helping us, it defects the whole purpose of having a test case in your project.
      Having a test case which does not really hit the server is not doing us any good, it will hide the potential issues that can arise on the server, the margin of error is a little high if we are not hitting the real server.
      The code that you will write to fetch the data will hit the server and not local json file so why have a local json file for test and a different route for the real implementation?
      The idea of test cases is to capture every potential bug and not to hide them, the local json file hides it as its not calling the real server.

  • @kurbanalimasu4895
    @kurbanalimasu4895 3 роки тому

    Sir, I am getting error like this :
    /CoreData:1:1: API Misuse: Attempt to serialize store access on non-owning coordinator (PSC = 0x7fb68fc515d0, store PSC = 0x0)
    I am not using core data in my project although its showing like this !

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      You sure you are not having an xcdatamodel in your project? Can you also check app delegate to make sure there’s no start up code for core data?

    • @kurbanalimasu4895
      @kurbanalimasu4895 3 роки тому

      @@CodeCat15 Yes Sir ! I am sure . I can also share a GitHub link

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      yeah sure go ahead, share the link please

    • @kurbanalimasu4895
      @kurbanalimasu4895 3 роки тому

      @@CodeCat15 github.com/KurbanAli6615/ShoppingAppIOS
      Sir please replay ASAP

    • @kurbanalimasu4895
      @kurbanalimasu4895 3 роки тому

      @@CodeCat15 Sir i have found error. Its showing error cause of assets. I have entered wrong type of asset

  • @songsmovieentertainment6691
    @songsmovieentertainment6691 2 роки тому

    post the video English language

  • @randalnadadava9316
    @randalnadadava9316 3 роки тому +1

    please speak hindi🙏

    • @CodeCat15
      @CodeCat15  3 роки тому

      As i said earlier this is the video where english and hindi is mixed, but i am working on it and i assure you that next time it will be pure hindi so apologies for the same 😊