How I write Go HTTP services after 7 years
1–7 of 7 posts
Re: How I write Go HTTP services after 7 years
#2> By calling ServeHTTP on the server, we are testing the entire stack including routing and middleware, etc. You can of course call the handler methods directly if you want to avoid this
What is the trade-off between the two? Does it make the tests significantly slower to test the entire stack rather than just a handler?
Re: How I write Go HTTP services after 7 years
#3Very nice. > By calling ServeHTTP on the server, we are testing the entire stack including routing and middleware, etc. You can of course call the handler methods directly if you want to avoid this What is the trade-off between the two? Does it make the tests significantly slower to test the entire stack rather than just a handler?
Re: How I write Go HTTP services after 7 years
#4Very nice. > By calling ServeHTTP on the server, we are testing the entire stack including routing and middleware, etc. You can of course call the handler methods directly if you want to avoid this What is the trade-off between the two? Does it make the tests significantly slower to test the entire stack rather than just a handler?
I usually do both. I like having unit tests that test individual function that describe functionality. But I also like to have tests that ensure everything works as intended ones you throw everything together.
Re: How I write Go HTTP services after 7 years
#5Re: How I write Go HTTP services after 7 years
#6"What is this Machine Box that I keep hearing all this amazing stuff about?
Machine Learning in Docker containers for Kubernetes — implement some ML today, without having to learn all that Tensorflow stuff."
Re: How I write Go HTTP services after 7 years
#7Earlier quoted context omitted.
I usually do both. I like having unit tests that test individual function that describe functionality. But I also like to have tests that ensure everything works as intended ones you throw everything together.
To be clear, you test individual functions handler uses, and to test the handlers themselves, you opt to test the whole stack as described in the article?