Friday, May 22, 2015

StringContent defaults to text/plain

If your using Microsoft's WebAPI, you probably had to play around with the StringContent class. This class allows you to build content for an HttpResponseMessage. However, the documentation in MSDN is not clear about what you can do with this class. If you enter the more complete constructor, no info at all. So, to create a new Content Object, you could do something like:

(click to enlarge)

Even with just a string it works, but, the Content-Type defaults to text/plain:

(click to enlarge)

Friday, May 8, 2015

End-to-End Tests: a necessary evil

End-to-End tests are mandatory. But what's the right balance between Unit Tests, Integration Tests, and End-to-End tests? Here's an excellent article from the Google Testing team with a real world example.

Google Testing Example

"As a good first guess,Google often suggests a 70/20/10 split: 70% unit tests, 20% integration tests, and 10% end-to-end tests. The exact mix will be different for each team, but in general, it should retain that pyramid shape."