JavaScript Testing

Hello friends at Retool!
We continue to be impressed and delighted by Retool as time goes on and our team continues to integrate it more and more into our workflows. We’re looking to lean on it even more, and have thus come to an area where we’d like some guidance on: automatic testing for the JavaScript that.
We’re mainly talking about code that run in the transformers. The approach that seems at first blush to be the best long-term solution is publishing an npm package or other form of JS bundle that we could run tests against in CI.
Do you have a recommend way of testing the JS that runs in Retools?

I suppose end-to-end testing frameworks could help here, although not on a unit level. Cypress.io, Nightwatchjs.org… essentially anything that allows you to test by interacting from the user perspective (navigate to url so-and-so, click on button, compare result with expectation etc.)

Thanks @pmetzdorf, we’ve considered going the Cypress route, but are more concerned about the logic combinatorics and edge-case coverage of the formatting as opposed to proper wiring-up of the given tool (although it would be good to have some degree of testing for this as well.)

@abdul-nimeri @david-dworsky Do you have any suggestions in regards to automated testing? How many of your users have you seen include their own 3rd party JS for this purpose?

I see your point. e2e tests are a good fallback to test your formatters at least indirectly. But I suppose it would require your staging environment to be completely disposable in terms of test data going in and out.

It seems that having some sort of API interface to sync the contents of certain Retool transforms / preloaded JS (among other fields) might help with this. If this could be achieved, then the source of truth for the transform code could be stored elsewhere where any arbitrary testing could be done against it, and then pushed upward to the corresponding Retool app(s) using some kind of automated CI or other system.

1 Like

Does anyone have an update on whether unit test functionality is planned within ReTool, or has anyone managed to achieve it? Thanks

Hey @tommynewman! We have testing in Retool now :smile: Is this similar to what you were looking for?

https://docs.retool.com/docs/testing