How do you unit test your scripts?

Started by AlwaysLearning, January 20, 2023, 17:14:51 PM

Previous topic - Next topic

AlwaysLearning

How do you unit/end-to-end test you jArchi scripts?

I'm creating jArchi script which is complicated/valuable enough that I want to wrap it in tests. In these tests I'll populate and then empty a test model.

I can simply write a "Run Tests function" in a second script which includes the main script and then calls each of the test functions. 

I'm hoping for a Javascript testing framework/library recommendation if anyone use on inside jArchi. Needless to say JavaScript is not my core skillset.

Phil Beauvoir

#1
Hi, it's an interesting question. Anyone unit testing their jArchi scripts? @Jean-Baptiste Sarrodie didn't you once create a testing suite?
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Jean-Baptiste Sarrodie

Hi,

Quote from: Phil Beauvoir on January 26, 2023, 21:28:33 PM@Jean-Baptiste Sarrodie didn't you once create a testing suite?

Not a real one.

Quote from: AlwaysLearning on January 20, 2023, 17:14:51 PMcan simply write a "Run Tests function" in a second script which includes the main script and then calls each of the test functions. 

That's basically how I do it. I try to separate script behavior and UI functions so that it becomes easier to test the behavior. But it also requires to define some helper function to easily switch on a debug mode which prints as much information as possible.

I'm not aware of a better testing framework for JS only application (ie. outside nodeJS), but if you find (or build) one, I could use it ;-)

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate