Is there any recommended way to run tests on the controllers?
For now, you can look at our lib-* projects ( https://github.com/enonic/xp/tree/master/modules/lib ) for how we test our internal code.
When do you plan to open this up for 3rd party developers?
I am also in the need of writing automated tests for the JS in both controllers and services; would this be possible with XP 6.1.1?
Sorry about the delay. We will try hard to get this into a release before christmas.
Any updates on this?
Yes, we have some testing (with mocks) in place now. Will try to make an isloated example of this in next week. But for now you can check out https://github.com/enonic/app-features to see how we test some of the controllers there. Right now you will need to bootstrap the testing with a Java class, but this will go away in the future.
Okay, so do you recommend that we test our controllers in the same way as in the repo you linked to, or wait for an upcoming release?
Looks to me like the xp/assert library is not yet exposed for 3rd party developers, is that correct?
It’s exposed. The assert library is not documented, but it’s exposed. Will be documented in 6.4 release.
Any updates on testing controllers and documentation on how it works? I find it difficult to understand exactly how to test my controllers. Simple controllers are okay to test, but as controllers get more complex, and especially when using external libraries, it gets complicated.
Hi. I will create a little document in the docs for how to test the controllers. Will notify you here when that’s done.
Looking forward to it!
I really think ease of testing should be prioritized in future releases.
At least for me testing is a very important aspect of software developement.
It really is the single, major thing that has always been missing in Enonic (CMS and XP). Although I am sure it is possible to figure something out on our own now (using one of several JS-test frameworks out there), I really think some suggestions/examples/documentation on best practice would be great.
Combining this with a library for creating mockups based on content type schemas would be even better.
Were you guys able to document it? I’m really looking forward to that.
Any news on testing controllers?
Sorry about this. We tried to get some more functionality around this in 6.8, but will add it to 6.9. I am in the middle of creating a spec on how the new testing framework should work. Will post some ideas here later this week.
Is there any news regarding test best practice?
I don’t know how helpful this particular comment is in itself, but a big +1 on this one from one more user
We will do some changes here to 6.10. Added an issue on GitHub that can be tracked. https://github.com/enonic/xp/issues/4433
I am also missing the possibility to write tests.
@srs: What is the roadmap for this? Looks like it was removed from a sprint in march?