YAML schema
A YAML schema is bound to Citrus YAML test case files, which automatically provides validation and code completion.
Different schema files are provided based on the version of Citrus used in each module of a project. At the moment, there is one for versions up to 3.4.0 and one for 4.0.0 and up. Alpha, beta, etc. releases are not supported.
When the Citrus version used by a project module changes, the schema used for a given file is updated automatically according to that new version. Also, in case no Citrus version is found for a module, a default schema (Citrus 4.x) is assigned to the corresponding files.
NOTES:
- The 4.x schema contains schemas for test actions that are outside citrus-base, e.g.
sql
,plsql
,selenium
, etc., while the 3.x schema doesn’t contain those. - Descriptions and potential restrictions for property values will be added in subsequent releases.
- The validation and auto-completion features are not implemented in this plugin, but in the IntelliJ platform itself.
It simply provides the configuration for the IntelliJ platform, so that it knows what conditions must a file meet to assign a certain schema file to it.
XML
Code folding of tags
In order to make Citrus specific XML files more comprehensible, certain tags are folded into smaller chunks. Below you’ll find the list of tags that are folded, and what they are folded into.
Code folding of XML tags is enabled by default, and it can be disabled in Settings > Editor > General > Code Folding > Citric > Tags in Citrus XML DSLs.
echo.message
<!-- From -->
<echo>
<message>Received response from server</message>
</echo>
<!-- to -->
<echo> Received response from server />
load.properties
<!-- From -->
<load>
<properties file="classpath:com/some/package/load.properties"/>
</load>
<!-- to -->
<load> properties: classpath:com/some/package/load.properties />
send.message.builder / receive.message.builder
<!-- From -->
<receive endpoint="anEndpoint">
<message>
<builder type="groovy" file="classpath:com/some/package/payload.groovy"/>
</message>
</receive>
<!-- to -->
<receive endpoint="anEndpoint">
<message> from classpath:com/some/package/payload.groovy />
</receive>
validate.script
<!-- From -->
<receive endpoint="anEndpoint">
<message>
<validate>
<script type="groovy" file="classpath:com/some/package/script.groovy"/>
</validate>
</message>
</receive>
<!-- to -->
<receive endpoint="anEndpoint">
<message>
<validate> by script classpath:com/some/package/script.groovy />
</message>
</receive>
purge-jms-queues.queue
Queues specified as refs are prefixed with the $
symbol.
This folding is supported for the purge-jms-queues
tag in the following namespaces:
- http://www.citrusframework.org/schema/xml/testcase
- http://www.citrusframework.org/schema/testcase
- http://www.citrusframework.org/schema/jms/testcase
<!-- From -->
<purge-jms-queues>
<queue ref="JMSQueueByRef"/>
<queue name="JMS.Queue.By.Name"/>
</purge-jms-queues>
<!-- to -->
<purge-jms-queues> $JMSQueueByRef, JMS.Queue.By.Name />
purge-channels.channel / purge-channel.channel
Channels specified as refs are prefixed with the $
symbol.
This folding is supported for the purge-channel
and purge-channels
tags in the following namespaces:
- http://www.citrusframework.org/schema/xml/testcase
- http://www.citrusframework.org/schema/testcase
- http://www.citrusframework.org/schema/spring-integration/testcase
<!-- From -->
<purge-channel>
<channel ref="ChannelByRef"/>
<channel name="Channel.By.Name"/>
</purge-channel>
<!-- to -->
<purge-channel> $ChannelByRef, Channel.By.Name />
purge-endpoint.endpoint
Endpoints specified as refs are prefixed with the $
symbol.
<!-- From -->
<purge-endpoint>
<endpoint ref="EndpointRef"/>
<endpoint name="Endpoint.By.Name"/>
</purge-endpoint>
<!-- to -->
<purge-endpoint> $EndpointByRef, Endpoint.By.Name />
Camel start-routes.route, stop-routes.route and remove-routes.route
The tag is folded regardless of the presence of the camel-context
attribute. This folding is supported for the start-routes
, stop-routes
and remove-routes
in the following namespace:
- http://www.citrusframework.org/schema/camel/testcase
<!-- From -->
<camel:remove-routes camel-context="camelContext">
<route id="route1"/>
<route id="route2"/>
<route id="route3"/>
</camel:remove-routes>
<!-- to -->
<camel:remove-routes camel-context="camelContext"> route1, route2, route3 />
Spring test meta-info
The folding happens only when at least the author
, creationdate
or status
sub-tag of meta-info
is specified.
<!-- From -->
<meta-info>
<author>Balog Tamás</author>
<creationdate>2024-08-28</creationdate>
<status>FINAL</status>
<last-updated-by>Balog Tamás</last-updated-by>
<last-updated-on>2024-08-28T00:00:00</last-updated-on>
</meta-info>
<!-- to -->
<meta-info> FINAL test - created on 2024-08-28 - by Balog Tamás />
Depending on which eligible metas are specified, the placeholder text can be one of the following:
- Single meta:
Created by <author>
Created on <creationdate>
<status> test
- Two metas:
Created on <creationdate> - by <author>
<status> test - by <author>
<status> test - created on <creationdate>
- All eligible metas:
<status> test - created on <creationdate> - by <author>
WebSocket endpoints
<!-- From -->
<websocket:server [attributes]>
<websocket:endpoints>
<websocket:endpoint ref="websocket1"/>
<websocket:endpoint ref="websocket2"/>
<websocket:endpoint ref="websocket3"/>
</websocket:endpoints>
</websocket:server>
<!-- to -->
<websocket:server [attributes]>
<websocket:endpoints> websocket1, websocket2, websocket3 />
</websocket:server>
Selenium actions
This folding is supported for the click
, hover
, set-input
, check-input
, wait
tags in the following namespaces:
- http://citrusframework.org/schema/xml/testcase
- http://www.citrusframework.org/schema/selenium/testcase
From | To |
---|---|
<click><element id="menubar"/></click> | <click> on id "menubar" /> |
<hover><element id="menubar"/></hover> | <hover> over id"menubar" /> |
<set-input value="new-value"><element tag-name="input"/></set-input> | <set-input value="new-value"> in tag-name "input" /> |
<check-input checked="true"><element xpath="//input[@type='checkbox']"/></check-input> | <check-input checked="true"> at xpath "//input[@type='checkbox']" /> |
<wait until="hidden"><element id="dialog"/></wait> | <wait until="hidden"> id="dialog" /> |
Kubernetes validate.element
This folding is supported for the validate.element
tag in the following namespace:
- http://www.citrusframework.org/schema/kubernetes/testcase
element
tags in which thevalue
attribute is specified as a Citrus validation matcher are not folded.
<!-- From -->
<k8s:list-pods [attributes] >
<k8s:validate>
<k8s:element path="$.result.items.size()" value="0"/>
</k8s:validate>
</k8s:list-pods>
<!-- to -->
<k8s:list-pods [attributes]>
<k8s:validate> $.result.items.size() == 0/>
</k8s:list-pods>
Closing tag elements
To lessen the cognitive load on Citrus related XML files, the closing tag elements of Citrus specific tags are folded into a single /
symbol. A few tags though, are excluded: test
, testcase
, actions
.
This folding supports Citrus related tags in non-Spring and Spring XML test files, as well as in Spring context configuration files.
This particular code folding is enabled by default, and it can be disabled in Settings > Editor >
General > Code Folding > Citric > Closing tags of tags in Citrus XML DSLs.
<!-- From -->
<repeat-onerror-until-true [attributes]>
<k8s:list-pods [attributes]>
<k8s:validate>
<k8s:element path="$.result.items.size()" value="1"/>
</k8s:validate>
</k8s:list-pods>
</repeat-onerror-until-true>
<!-- to -->
<repeat-onerror-until-true [attributes]>
<k8s:list-pods [attributes]>
<k8s:validate>
<k8s:element path="$.result.items.size()" value="1"/>
/>
/>
/>