It's all about the answers!

Ask a question

How to use JUnit to test IOperationParticipant?

Eduardo Bello (4401922) | asked Mar 18 '11, 9:54 a.m.

I'm trying to optimize the tests on my customizations. I read several materials about it: (,, But I have to admit, I'm still struggling to understand it.

I'd use JUnit before on regular projects and I have a little experience developing bundles for RTC, but I had a cloud of doubt above me.

For example, I'm not quite sure how can I select a project area and create an workitem to test a follow-up action and get the message that would be displayed to the user.

I guess I have to use Plain Java Libraries right?

I start with something like this:

private ITeamRepository repo;
private static String REPOSITORY_ADDRESS = System.getProperty("repositoryAddress", "https://rtclocaljazz:9443/jazz");

protected void setUp() throws Exception {

if (!TeamPlatform.isStarted())

repo = login();

protected void tearDown() throws Exception {

repo = null;


private ITeamRepository login() throws TeamRepositoryException {
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(REPOSITORY_ADDRESS);
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repo) {
return new ILoginInfo() {
public String getUserId() {
return "test";

public String getPassword() {
return "test";
return repository;

Where I go from here? or more important what I've done is correct so far?

Another doubt, I have to make this as a plugin to extend AbstractRemoteServiceTestCase or a standalone JUnit do the job?

One answer

permanent link
Qiong Feng Huang (76911610) | answered Mar 20 '11, 7:52 p.m.
Here are some advises:
1. You will need to use AbstractRemoteServiceTestCase.
2. In the class that implements IOperationParticipant, you can use
IParticipantInfoCollector.createInfo() and IParticipantInfoCollector
addInfo() to create any message.
3. You should have a default project area created for testing. You can do
this in setup method.
4. You should have already had the operation object.
5. In the test method, you should use IServerProcess to execute the
operation and use the report to do the validation.
IServerProcess serverProcess = getService(IProcessInternalServerService.
IOperationReport report = serverProcess.adviseAndExecute(operation);
IParticipantReport[] participantReports = report.getParticipantReports();
IParticipantReport myReport = null;
for (int i = 0; i < participantReports.length; i++) {
IParticipantReport participantReport = participantReports;
myReport = participantReport;
IReportInfo[] infos = testReport.getInfos();
//check the infos

Your answer

Register or to post your answer.