AnsweredAssumed Answered

Unit tests with variable into workflow

Question asked by marcantoine on Nov 19, 2015
Latest reply on Nov 20, 2015 by martin.grofcik
Hi,

I'm based on unit tests located here:
https://forums.activiti.org/content/sticky-how-write-unit-test (and the source code repository).

I'll try to add some unit tests on my extensions of Service Task wrote in Java.
To test all configurations I need to launch this simplest workflow (with the simple activity), and pass parameters on the launch of the instance.
In my JavaDelegation class, I don't have correct values after get expression content. I get ${type} instead of the input value I passed to start the workflow.
Is it a bug ? because it work fine on a deployed instance of Activiti.
Do you have an issue for that ?

Thank,
Marc-Antoine


<?xml version="1.0" encoding="UTF-8"?>
<definitions
   xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:activiti="http://activiti.org/bpmn"
   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
   xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
   xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
   typeLanguage="http://www.w3.org/2001/XMLSchema"
   expressionLanguage="http://www.w3.org/1999/XPath"
   targetNamespace="http://www.activiti.org/test">
<process id="workflowTest">
    <startEvent id="startevent1" name="Start" activiti:formKey="startForm">
     </startEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <serviceTask id="servicetask1" name="Test Extension" activiti:class="com.arkena.ConnectorJavaDelegation" activiti:extensionId="com.arkena.ConnectorDownloadTask">
      <extensionElements>
        <activiti:field name="type">
          <activiti:string>${type}</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
</process>
</definitions>

Outcomes