1

I have started building an SDK in Golang that interacts with a REST API. Without testing the actual API for correctness and isolating the tests for the SDK, what should I be looking to assert within my tests?

My SDK consists of several functions that create structs modeled around the API body responses, call the API endpoints and then deserializes the JSON into the created struct and returns the struct to the user.

0

I would concentrate on testing deserialization mechanism. Depending on how complicated the data structures are there would be different tests applicable. Apart from the obvious tests of if a sample data structure is properly deserialized I would introduce the tests for:

  • How well does deserialization handles unexpected elements in response
  • How well does your deserialization handles case-sensitivity, numbers and dates (including time-zones) field of JSON model
  • How does your code handles SSL issues
  • How does the memory consumption of your deserialized objects grow with JSON model growing up.
  • If your API works both with compressed and uncompressed traffic
  • If your API caches the objects, test how well are they cached

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.