JBoss Community

JUnit test and process instance variables

created by Amin MC in jBPM - View the full discussion

Hi

 

I have encountered an interesting scenario of my test failing when I run it but passing when I debug the test.  Basically I have the following code

 

WorkflowProcessInstance instance = (WorkflowProcessInstance)session.getProcessInstance(processInstanceId);

DataObject dataObject = instance.getVariable(variableName);

 

session.signalEvent(..);

 

WorkflowProcessInstance instance = (WorkflowProcessInstance)session.getProcessInstance(processInstanceId);

DataObject reloaded = instance.getVariable(variableName);

 

if (dataObject is not same as reloaded) {

     doSomething();

}

 

 

What I notice is that when i run the test reloaded hasn't been updated when i expect it to be as defined in my flow.  However when I debug and wait a second or two reload gets updated and the condition is evaluated.  My test basically starts the flow and then performs the signal. 

 

I was wondering if anyone has experienced this issue?  When running the code outside of a test it works as expected but not within a test.

 

Any help would be appreciated. 

 

Cheers

Reply to this message by going to Community

Start a new discussion in jBPM at Community