Great question, @amt! I've broken this out into a dedicated thread, because it sounds like your enquiry about VS Code is just a piece of the puzzle.
I'm hoping to get more context about your specific goals, as "testing" is a broad topic. We've long thought about the best way to write tests within Retool and actually came close to shipping a few different solutions. Nothing has stuck, though.
We currently recommend writing E2E webdriver tests using a tool like Playwright or Cypress.
I would like to be able to do unit testing on both transformers and javascript queries that have complex business logic.
I’ve struggled deeply on this topic because of how retool handles functions.
Let’s say I have a transformer that takes a retool table filter and we want to convert that to a payload to send to an API, I want to test that business logic. How do I do this.
The short answer is that automated unit testing isn't well supported. And not everything can be easily turned into a unit test. Writing local tests in VSC is a good idea, though! I can see why you wanted to explore that option.
My personal approach in a case like this would probably be to configure a resource environment within Retool solely dedicated to testing in order to capture and ingest all API activity
My personal opinion here is that Retool needs a better story around authoring and testing reusable code.
My work around for this was to attempt to use transformers but those come with different problems. For example if I reference {{transformer.value}} sometimes the data has propagated and other times it doesn’t. I don’t know how to trigger the tranformer to reevaluate. I had some tests that slept for 5 seconds after awaiting setValue on a component referenced by the transformer. The behavior was completely unintelligable to me and my colleague and we ended up going the PreloadedJS route.
Today I’m stuffing every helper function in the app’s PreloadedJS. This has proven difficult to manage. First because there is no support for logical groupings of files / folders and secondarily because the PR is a mess to review (PreloadedJS is stored as one giant text string in a yaml document).
I also tried having the query or transformer return a function but that breaks down because I believe the return value must be serializable. The lack of a unit testing in Retool over the 6 years I’ve used this product has me increasingly reluctant to recomment this product to my clients.
It seems my only option left is build and maintain a separate library just for testing complex utility functions - for example converating a retool filter component into a server side graphql filter. And that really defeats the point of why I would use Retool in the first place.
That's all useful feedback, @amt - thanks for sharing. I expect we'll revisit integrated testing and am sure the Product team would be interested in chatting with you at that point, if you're open to it!