Writing unit tests and visual validation tests for Babylon React Native projects?


Is there a practical way to do visual validation testing on Babylon React Native projects at present?

We currently use Jest for unit testing of our React Native components and non-3D classes, but I’m a bit at a loss as to how to provide meaningful unit and validation tests for the rendering code that we have, without creating mocks for half of the Babylon.js framework itself …

Seeking advice and inspiration.

1 Like

Can your tests run inside a Babylon js playground?
If yes, you can add them inside babylonnative visual test framework.

It would take considerable work, but possibly.

We’re working in the Babylon React Native context though, not Babylon Native directly. Almost all our code is intertwined tightly with React Native. Would it be easy to separate out the visual testing and spin up the Babylon Native visual test framework using our current build scripts and Jenkins?

If you look at this script: https://github.com/BabylonJS/BabylonNative/blob/master/Apps/Playground/Scripts/validation_native.js

All it does it capturing current display and compare it with reference images. I guess it’s something you’d like to do?
TestUtils plugin is not available with BRN but I think most of its features are available with reactnative framework: loading and saving .png.