Skip to content

Instantly share code, notes, and snippets.

@matthew-wilson
Created July 21, 2015 15:50
Show Gist options
  • Save matthew-wilson/423b6a8b8788e8b83a53 to your computer and use it in GitHub Desktop.
Save matthew-wilson/423b6a8b8788e8b83a53 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<spring:beans xmlns="http://www.citrusframework.org/schema/testcase"
xmlns:jms="http://www.citrusframework.org/schema/jms/testcase"
xmlns:ws="http://www.citrusframework.org/schema/ws/testcase"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.citrusframework.org/schema/jms/testcase http://www.citrusframework.org/schema/jms/testcase/citrus-jms-testcase.xsd
http://www.citrusframework.org/schema/ws/testcase http://www.citrusframework.org/schema/ws/testcase/citrus-ws-testcase.xsd
http://www.citrusframework.org/schema/testcase http://www.citrusframework.org/schema/testcase/citrus-testcase.xsd">
<template name="textMatch">
<groovy>
<![CDATA[
assert ${text1} == ${text2}
]]>
</groovy>
</template>
<testcase name="ParallelFailureTest">
<actions>
<parallel>
<echo>
<message>simple test</message>
</echo>
<call-template name="textMatch">
<parameter name="text1" value="123"/>
<parameter name="text2" value="456"/>
</call-template>
</parallel>
</actions>
</testcase>
</spring:beans>
@christophd
Copy link

Wrote a test that raises CitrusRuntimeException which is working fine as parallel block does not support assertion errors right now. Going to fix that!

<template name="textMatch">
  <groovy>
    <![CDATA[
      import com.consol.citrus.exceptions.CitrusRuntimeException
      if (${text1} != ${text2}) {
        throw new CitrusRuntimeException("Text did not match")
      }
    ]]>
  </groovy>
</template>

<testcase name="ParallelFailureTest">
  <actions>
    <assert exception="com.consol.citrus.exceptions.CitrusRuntimeException"
            message="Text did not match">
      <parallel>
        <echo>
          <message>Test failure in call template</message>
        </echo>

        <call-template name="textMatch">
          <parameter name="text1" value="123"/>
          <parameter name="text2" value="456"/>
        </call-template>
      </parallel>
    </assert>
  </actions>
</testcase>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment