How to unit test an operation ?

I have created a few custom operations and I need to unit test them.

I have seen some Java classes using the main method to call operations on a already running nuxeo instance.

My question is how can I create a unit test that would run the operation in a virtual nuxeo server ?

1 votes

1 answers



Thanks to the open source way, you can look into our source code.

Location of default Nuxeo Core Operations are located here. And if you look into the unit test part you have some JUnit4 Tests. You have examples of Unit test that init the Core Repository, directories, relation service, …

If your operation need a Seam context or is dedicated for JSF you can learn from test in this bundle.

To clone these sources on your desktop:

Hope this will help you.

4 votes