I am developing plugins that use JavaScript, and I want to write Unit Tests for them using Jasmine. Since they use a lot of functions from AJS and other JavaScript supplied by Atlassian I would like to know if there are any best practises regarding that topic. Is there easy access to the required JS files or is it neccessary to mock every AJS (etc. ) function I use in my JavaScript?
Community moderators have prevented the ability to post new answers.
We had the same question regarding our company-internal Confluence JS libraries we wanted to unit test. We thought about two alternatives: (1) include the whole AJS stuff as testing dependencies; (2) mock only the AJS contents we use in our libs. In the end we went with approach (2), since we didn't want to maintain somehing like 2 MB of AJS code that needs updates regularly. I don't know if there are further alternatives though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I figured out Atlassian provides a way to automate this with maven. Works pretty good for me.
https://bitbucket.org/atlassian/confluence-karma-test-runner-support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.