justforfunc #16: unit testing HTTP servers

preview_player
Показать описание
Let's cover the basics of unit testing in Go and then show how you can test http.HandlerFunc and http.Handler.

You'll learn how to use "testing", including subtests and examples, and "net/http/httptest" with ResponseRecorder and Server.

References:

Рекомендации по теме
Комментарии
Автор

1:42 - Basic Unit Tests
14:27 - Sub tests:
16:12 - Examples as tests
20:03 - Testing HTTP Handlers
39:27 - Testing HTTP routing

JustForFunc
Автор

One of my favorite things about this series is seeing the collection of stickers grow each video.

Zyian
Автор

Wasn't expecting to find a video on exactly what I was looking for, but I did. Thanks for the video! One of the live coding videos I've seen.

zacharykeener
Автор

Extremely informative video and still holding its value very well as time goes on. Thank you very much for taking your time to help grow the gophers!

mattbrun
Автор

Hello, Francesc.

Thanks for the video. It helped lot to get into basic testing.
Can you please record a video how to mock Handlers dependencies that can be anything like connecting to database or invoking external API's and like so.

sureshrajput
Автор

I love it! Keep up the good work. As a new programmer working with Go, deep dives into the basics of the language are extremely helpful.

jongschneider
Автор

i miss this series. i wish there was one that was comparable. justforfunc RULES!

EnTransic
Автор

This is really excellent! One tip I discovered just yesterday: if you put "localhost:8080" instead of ":8080" into your ListenAndServe method, it will make that annoying MacOS popup go away (but only after you've run it once)

yalestar
Автор

I learned more from this video than any other tutorial on testing that's currently out there. Keep up the good work! Let me know if you have a Patreon account, I would like to donate.

geoblk
Автор

This series is wonderful. I watched it first in 2017 and I come back from time to time. I also use a similar approach to testing and error handling in C now, since my job doesn't allow me to use golang, but it's super effective.

CarloLobrano
Автор

Been coding in go for 3 years, still picked up some tricks! Great content, thanks!

kalleidoskop
Автор

Excellant video my man. Your channel has been recommended to me, so far, I like your style and topics.

ashhammond
Автор

I really enjoyed this episode particularly. I have not been writing tests in my code. It was interesting to see how to write tests for network services that I assumed you couldn't easily write tests for. I learned allot.

blondie
Автор

Just a great joy to learn from this series :-) Thanks for providing nice tutorials !

leffenx
Автор

This is the clearest explanation I've seen, thanks! (or read :) )

Trammael
Автор

Awesome episode! I had no idea about this way to test router. Thank you so much for this video. By the way I'm really enjoying to learn Go. It is not only pragmatic and fun but also have an impressive and powerful standard library.

marcoazevedo
Автор

Very good explanation bro, congratulations!

JorgeGomez-xcer
Автор

great one and it helped me a lot, thanks, but why your last video is for 5 years ago? where are you?

plaguewielder
Автор

This is sooper cool.. quite informative.. thanks a lot Francesc!!

AshwiniKondalakadu
Автор

Sweet video. Learned a bunch of cool stuff. Really cool example docs thing

mybigbeak