Unit testing in golang - a beginners + advanced-ish tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.ย. 2024
  • You want to learn how to write unit tests in golang? In this tutorial I am explaining all the basics you need to know about how to write your very first tests in go. I also get into some advanced-ish techniques like parametrized testing and using testify.
    Playlist:
    • Advanced go tutorials
    testify:
    github.com/str...
    ❤️ SUPPORT MY CHANNEL ❤️
    --------------------------------------------------
    A little support goes a long way!
    Buy me a coffee: www.buymeacoff...
    Become a patreon: / thomaslanghorst
    📖 5 Books to skyrocket your career 📖
    ----------------------------------------------------
    THE EXPLANATION VIDEO - • 5 MUST READ Programmin...
    amzn.to/3IahMMh - Automate the boring stuff with python
    amzn.to/3lI4RcM - Head First Design Patterns
    amzn.to/3Ea1KjZ - Extreme Programming Explained
    amzn.to/3k7xhwn - Soft Skills
    amzn.to/3KdEC8n - Clean Code
    🎒 THE GEAR I USE 🎒
    --------------------------------------------------
    💻 Technical Gear
    amzn.to/3Edp4h5 - Apple MacBook Pro M1
    amzn.to/3KmaWFQ - Laptop Bag
    amzn.to/412MNdt - Apple Magic Keyboard
    amzn.to/3jXJ2pb - Mouse (Mac Version)
    amzn.to/3I3umwJ - Mouse (Windows Version)
    amzn.to/3YHVCYD - Mousepad
    amzn.to/3YAoAtj - SSD External Hard Drive
    amzn.to/3Sdj0e7 - SSD Protection Case
    amzn.to/3XDdfr9 - Headphones
    amzn.to/3lJqrgN - USB Hub
    amzn.to/3KamAUo - HDMI to USB
    🎒 Digital Nomad Essential Gear
    amzn.to/3Sdjn8v - Bag
    amzn.to/40ZLyf9 - Bullet Journal
    amzn.to/41130zS - Fineliner Pens
    amzn.to/3YNwUps - French Press / Plunger
    amzn.to/3lI44sk - Mug
    📷 TH-cam Gear
    amzn.to/3k7bTra - Apple Iphone 13 mini (My "camera")
    amzn.to/40ZbdEF - Tripod
    amzn.to/3ZeMlY7 - Lightning to USB adapter for Microphones
    amzn.to/3EdpSCD - Microphone
    amzn.to/3Ee926A - Microphone Pop Protection
    amzn.to/3S2AR7z - Selfie Ring Light
    👋 SOCIAL MEDIA 👋
    ----------------------------------------------------
    @the_langhorst - INSTAGRAM
    @the_langhorst - TWITTER
    @the_langhorst - TIKTOK
    Music used:
    Karl Casey @ White Bat Audio
    • 80s Retrowave / Synthw...
    Track: Sports Dubstep [Vlog Music] by MOKKA / Love in Space
    • (No Copyright Music) S...
    Music provided by "MokkaMusic" channel and
    inaudio.org
    ‼️ Disclaimers
    The links mentioned in this description may contain affiliate links. I may receive a commission for any purchases made through these links, but there won't be any extra cost for you. I am grateful for your support, as it enables me to keep providing you with valuable content for free.
    #programming #coding #golang

ความคิดเห็น • 31

  • @Programscape
    @Programscape 7 หลายเดือนก่อน +1

    maan, this was the most complete video about golang unit tests I've ever seen on youtube, thanks)))

  • @lynx_nz
    @lynx_nz 2 ปีที่แล้ว +9

    testify please! :)

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว +2

      Alrighty, testify will be put onto my video idea list! Thanks for the comment, btw. Much appreciated!

  • @JonDisnard
    @JonDisnard 2 ปีที่แล้ว +2

    This was probably the best video on go lang unit testing I've seen so far. I come from python unit testing with mock, and was able to understand everything. Good job!

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว

      wow...thank you so much! Reading such things is exactly why I do this! It makes me so incredibly happy!

  • @savingday
    @savingday 2 หลายเดือนก่อน

    Very engaging way of teaching. Good job!!

  • @kushalshukla444
    @kushalshukla444 2 หลายเดือนก่อน +1

    nice one , now i can do my opensource work !

  • @daniel0liveir4
    @daniel0liveir4 2 ปีที่แล้ว +2

    I noticed that the testify library runs the tests in less time 👀
    Nica tutorial 👌

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว +1

      Hey Daniel, thanks for the comment!
      To be honest, I haven't noticed any significant speed boosts. I will investigate on that 🧐 . Thanks for pointing it out!!!

  • @akshay-kumar-007
    @akshay-kumar-007 3 หลายเดือนก่อน

    The video was very helpful. Thanks!

  • @amitsharma928
    @amitsharma928 2 ปีที่แล้ว +2

    Nice tutorial, thanks 🙂

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว

      Thank you very much. I am glad you liked it.

  • @amineamaach4450
    @amineamaach4450 2 ปีที่แล้ว +1

    Pretty straightforward, thanks.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars ปีที่แล้ว +2

    thank you, good one and to the point video :)

  • @dexslender
    @dexslender ปีที่แล้ว +1

    excellent, i was able to solve some queries about golang testing :D

    • @ThomasLanghorst
      @ThomasLanghorst  ปีที่แล้ว

      You are very welcome! Glad I could be of help!

  • @delduked
    @delduked 2 ปีที่แล้ว +2

    I'd love a video for testify! seriously, nobody does any videos about unit testing. Its the same with nodejs, no one does anything with TSOA for nodejs unit testing.

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว +1

      Hey, thanks for the comment. Feedback like this is much appreciated! You are not the first who liked to have a video about testify. So I will make sure to create one. But it takes up more time and planning and structuring it. Be patient. But there will be a video on that!

  • @samdelamarter4557
    @samdelamarter4557 2 ปีที่แล้ว +1

    Great video!!

  • @evilwumpus
    @evilwumpus 2 ปีที่แล้ว +2

    very nice video

  • @Kai6771
    @Kai6771 2 ปีที่แล้ว +1

    Very Helpful thank you. Will you be exploring mocking?

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว +2

      Hey Jeff, thanks for the comment! I am glad that I could be of help.
      mocking is a great topic and I could actually talk about it for hours :D If more people want to see it, I will most certainly create a video about it.

  • @user-ro9ty1qk6r
    @user-ro9ty1qk6r 6 หลายเดือนก่อน

    I am getting the error "package command-line-arguments is not a main package" when using a package that has the same name as the filename (calculator in this case). How are you able to have a package calculator running in the code? Please guide.

  • @rasikamanori8324
    @rasikamanori8324 2 ปีที่แล้ว +1

    Sir, I am currently learning c++, java and python is it enough or should i learn 1 more. (Not web development)

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว +1

      Hey. Thanks for the comment.
      tl;dr: these three languages are more than enough.
      Personally, I think that it is not about the amount of languages you know, but rather the concepts of programming. If you fully understand C++, Java or Python, learning another language is pretty simple. But I would not learn more languages, just for the sake of learning them. If you need to switch languages, because you want to switch your focus of work, that is ok. For instance, if you want to learn data science and you do not know Python. Then learn Python. But I would not learn Python simply to put it onto my résumé. So it depends on what you want to accomplish with learning another language. Is there any special need why you want to learn one more?

    • @rasikamanori8324
      @rasikamanori8324 2 ปีที่แล้ว +1

      @@ThomasLanghorst thanks, what arebthe languages that you know?

    • @ThomasLanghorst
      @ThomasLanghorst  2 ปีที่แล้ว

      Hey Rasika. Thanks for asking.
      professionally:
      Java, Kotlin, JS, Angular (+Typescript) and finally golang YAY
      side projects:
      I started with python and switched to golang about 3 years ago. I use VueJS for my frontends.