I am working on an application that has SDKs in multiple languages. Currently Java, JavaScript, Dart, and Go, but ultimately we'd like to have an SDK for every major language. Our primary test suites are written in Go, which means our other SDKs are not well tested. I do not want to write or maintain test suites in four or ten different languages.

What I would like to do is choose a language to write the tests in, define a test harness interface, implement that test harness for each SDK, and write the tests using that harness. Of course I could do this with RPC/HTTP/etc but that would add significant complexity. I'd prefer to write the tests in a language that has a meaningful degree of interop/FFI with most of the major languages. Lua comes to mind, since it seems like someone has built a Lua interpreter for basically every language in existence, but I have very little Lua experience and I have no idea how painful it might be to do this in Lua. I am open to other suggestions besides interop/FFI and RPC, though I don't want to take the approach of creating test templates and generating the tests in each language. I've done things like that and they're a pain to maintain.

  • HairHeel@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    How much does your SDK do? If it's just wrapping calls to an HTTP API, use something like OpenAPI / Swagger to document the API, then auto-generate client libraries based on the OpenAPI specs.

    Then if you add any language-specific niceties on top of the auto-generated code (i.e. accessor functions to set up user credentials etc) you have to write tests for those parts in that particular language. But the bulk of the API you can test in whichever language you prefer, then just assume the code generator is doing its job and creating a compatible API in the other languages.