cancel
Showing results for 
Search instead for 
Did you mean: 

How to unit test an operation ?

fast_narcis_
Confirmed Champ
Confirmed Champ

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 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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.

View answer in original post

1 REPLY 1

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.