Comment on What languages are well suited for testing SDKs written in multiple other languages?
BitSound@lemmy.world 1 year ago
I don’t think you really have a choice TBH. Try to do something like that sounds like a world of pain, and a bunch of unidiomatic code. If you can’t actually support 4 to 10 languages, maybe you should cut back on which ones you support?
One interesting thing you could try if you really don’t want to cut back is to try having using an LLM to take your officially supported code and transliterate it to other languages. I haven’t tried it at this scale yet, but LLMs are generally pretty good at tasks like that. I suspect that would work better than whatever templating approach you’ve used before.
If neither of those approaches works, everything speaks C FFI, and Rust is a modern language that would work well for presenting a C FFI that the other languages can use. You’re probably not hot on the idea of rewriting your Go tests into another language, but I think that’s your only real option then.
firelizzard@programming.dev 1 year ago
To be clear, the SDKs themselves are hand-written; I’m not trying to do anything fancy there. In terms of designing and writing the SDKs, we can manage that for the 4 we have now. The issue is testing. The main system is a collection of services that are accessed via an API. That API can be accessed directly through function calls, or via HTTP or RPC. Our integration tests interact with the system through that API. The SDKs have a moderate amount of logic so they’re not simple HTTP/RPC clients, but maintaining multiple (idiomatic) versions of that logic is not too much of a burden. The issue is that I want a single test corpus that I can use to validate each SDK without having to rewrite that test corpus in each language. Ideally I’d like the integration tests to be that test corpus.
I was assuming I’d need to rewrite my tests in Go given that Go’s FFI support for anything other than C is not somewhere I want to go again. I have been meaning to learn Rust so I might just do that.
naonintendois@programming.dev 1 year ago
How complex are the API calls you need to make? Debugging interop mismatch can end up being more work than writing the tests if you need to deal with complex types.