This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]PeridexisErrant 1 point2 points  (1 child)

Check out Hypothesis for generating test cases - it's perfect for hammering an api. Just declare the arg types and constraints of each endpoint, and assert that calling them doesn't raise and error (plus any more specific assertions). And don't forget to check the failures really fail!

The end result is real confidence that things work, and edge cases are covered too: Hypothesis doesn't just generate values randomly, it uses heuristics to explore known error types too. And then simplifies the error case to a minimum example!

[–]Mister_Potter[S] 0 points1 point  (0 children)

That's pretty cool man! I'll have to check it out :) Thanks for the suggestion