Skip to content

Commit b6e532a

Browse files
committed
fix(#1408): Add documentation for Citrus Cucumber steps
1 parent 64ba5bb commit b6e532a

19 files changed

+4796
-43
lines changed

src/manual/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ include::endpoint-ssh.adoc[]
5757
include::endpoint-rmi.adoc[]
5858
include::endpoint-jmx.adoc[]
5959
include::endpoint-zookeeper.adoc[]
60-
include::endpoint-restdocs.adoc[]
6160
include::endpoint-component.adoc[]
6261
include::endpoint-adapter.adoc[]
6362

@@ -76,12 +75,13 @@ include::data-dictionary.adoc[]
7675
include::test-actors.adoc[]
7776
include::test-suite.adoc[]
7877
include::meta-info.adoc[]
79-
include::message-tracing.adoc[]
8078
include::reporting.adoc[]
8179

8280
include::configuration.adoc[]
8381
include::spring-support.adoc[]
8482

83+
include::tools.adoc[]
84+
8585
include::samples.adoc[]
8686

8787
include::appendix.adoc[]

src/manual/runtimes-cucumber.adoc

Lines changed: 64 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -381,89 +381,119 @@ As usual, we are able to use *@CitrusResource* annotated *TestCaseRunner* fields
381381
logic. With this extension you can use the full Spring testing power in your tests in particular dependency injection and
382382
also transaction management for data persistence tests.
383383

384-
[[yaks-step-definitions]]
385-
=== YAKS step definitions
384+
[[citrus-step-definitions]]
385+
=== Predefined step definitions
386386

387-
https://github.com/citrusframework/yaks[YAKS] is a side project of Citrus and provides some predefined steps for typical
388-
integration test scenarios that you can use out-of-the-box.
387+
Citrus provides a set of predefined step implementations for typical integration test scenarios that you can use out-of-the-box in a Cucumber feature.
389388

390-
You can basically define send/receive operations and many other predefined steps to handle Citrus test
391-
actions. As these steps are predefined in YAKS you just need to use them in your feature stories. The step definitions with
392-
glue to test actions is handled automatically in YAKS.
389+
You can basically define send/receive operations and many other predefined steps to leverage Citrus functionality such as endpoints and test
390+
actions. As these steps are predefined in Citrus you just need to add the step as a line in your feature stories. The step definitions with
391+
the glue to test actions is handled automatically when running Citrus with Cucumber.
393392

394-
If you want to enable predefined steps support in your test you need to include the YAKS module as a Maven dependency.
393+
If you want to enable predefined steps support in your test you need to include the Citrus Cucumber steps module as a Maven dependency.
395394

396-
.YAKS module dependency
395+
.Citrus Cucumber step module dependency
397396
[source,xml]
398397
----
399398
<dependency>
400-
<groupId>org.citrusframework.yaks</groupId>
401-
<artifactId>yaks-standard</artifactId>
402-
<version>${yaks.version}</version>
399+
<groupId>org.citrusframework</groupId>
400+
<artifactId>citrus-cucumber-core</artifactId>
401+
<version>${citrus.version}</version>
403402
<scope>test</scope>
404403
</dependency>
405404
----
406405

407406
After that you need to include the glue code package in your test class like this:
408407

409-
.Include YAKS steps
408+
.Include Citrus steps
410409
[source,java]
411410
----
412411
@RunWith(Cucumber.class)
413412
@CucumberOptions(
414-
extraGlue = { "org.citrusframework.yaks.standard" },
413+
extraGlue = { "org.citrusframework.cucumber.steps" },
415414
plugin = { "pretty", "org.citrusframework.cucumber.CitrusReporter" } )
416415
public class MyFeatureIT {
417416
418417
}
419418
----
420419

421-
Instead of writing the glue code on our own in step definition classes we include the glue package `org.citrusframework.yaks.standard`
422-
as extra glue. This automatically loads all YAKS step definitions in this module. Once you have done this you can use predefined
420+
Instead of writing the glue code on our own in step definition classes we include the glue package `org.citrusframework.cucumber.steps`
421+
as extra glue. This automatically loads all predefined Citrus step definitions. Once you have done this you can use predefined
423422
steps without having to write any glue code in Java.
424423

425-
The YAKS framework provides the following modules with predefined steps:
424+
[source,gherkin]
425+
----
426+
Feature: Hello World
427+
428+
Scenario: Print Hello World
429+
Given variable text="Hello World!"
430+
Then print 'You just said: ${text}'
431+
432+
----
433+
434+
The feature uses the default predefined steps `Given variable <name>="<value>"` and `Then print '<output>'` provided by Citrus.
435+
436+
The Citrus framework provides many different modules serving many different aspects of integration testing.
437+
You can add those steps with modular dependencies in Maven.
438+
See the following modules with predefined steps provided by Citrus:
426439

427-
.YAKS modules
440+
.Citrus Cucumber step modules
428441
|===
429442
|Module |Description
430443

431-
| yaks-standard
444+
| citrus-cucumber-core
432445
| Standard steps such as test variables, sleep/delay, log/print, ...
433446

434-
| yaks-http
447+
| citrus-cucumber-http
435448
| Http steps for client and server side communication
436449

437-
| yaks-openapi
450+
| citrus-cucumber-openapi
438451
| Load Open API specifications and invoke/verify operations with generated test data
439452

440-
| yaks-kubernetes
453+
| citrus-cucumber-kubernetes
441454
| Manage Kubernetes resources (e.g. pods, deployments, custom resources)
442455

443-
| yaks-knative
456+
| citrus-cucumber-knative
444457
| Steps to connect with Knative eventing and messaging
445458

446-
| yaks-jms
459+
| citrus-cucumber-jms
447460
| Send/receive steps via JMS queues/topics
448461

449-
| yaks-kafka
462+
| citrus-cucumber-kafka
450463
| Steps to publish/subscribe on Kafka messaging
451464

452-
| yaks-jdbc
465+
| citrus-cucumber-jdbc
453466
| Steps to connect to relational databases
454467

455-
| yaks-camel
468+
| citrus-cucumber-camel
456469
| Steps to access Apache Camel components and Camel routes
457470

458-
| yaks-camel-k
459-
| Manage Camel-K resources on Kubernetes
460-
461-
| yaks-selenium
471+
| citrus-cucumber-selenium
462472
| Run UI tests with Selenium using Selenium grid or standalone containers
463473

464-
| yaks-groovy
474+
| citrus-cucumber-groovy
465475
| Leverage Groovy scripts as Citrus endpoint and component configuration
476+
477+
| citrus-cucumber-testcontainers
478+
| Manage Testcontainers instances with starting/stopping databases, message brokers and many more
479+
466480
|===
467481

468-
Once again it should be said that the step definitions included in this modules can be used out-of-the-box. You can start
469-
to write feature stories in Gherkin syntax that trigger the predefined steps.
482+
Once again it is important to understand that the predefined step definitions included in these modules can be used out-of-the-box.
483+
You can just start to write BDD features in Gherkin syntax that trigger these predefined steps.
484+
485+
486+
TIP: If you want to include all available step definitions into your project at once you can use the `citrus-cucumber-all` module dependency.
487+
488+
.Include all Citrus Cucumber steps
489+
[source,xml]
490+
----
491+
<dependency>
492+
<groupId>org.citrusframework</groupId>
493+
<artifactId>citrus-cucumber-all</artifactId>
494+
<version>${citrus.version}</version>
495+
<scope>test</scope>
496+
</dependency>
497+
----
498+
499+
Read more about the individual step implementations and their functionality in xref:tools-cucumber-steps[Tools - Citrus Cucumber steps].

src/manual/runtimes-jbang.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ Feature: EchoTest
261261
.Run my-test.feature
262262
[source,shell]
263263
----
264-
jbang --deps org.citrusframework.yaks:yaks-standard:0.20.0 citrus run my-test.feature
264+
jbang --deps org.citrusframework:citrus-cucumber-all:4.9.0-SNAPSHOT citrus run my-test.feature
265265
----
266266

267-
NOTE: Many of the predefined Cucumber steps (e.g. `Then print '<message>'`) in Citrus are provided in a separate Citrus child project called https://github.com/citrusframework/yaks[YAKS].
267+
NOTE: Many of the predefined Cucumber steps (e.g. `Then print '<message>'`) in Citrus are provided in separate Citrus modules.
268268
You need to add additional project dependencies for that steps to be loaded as part of the JBang script.
269269
The `--deps` option adds dependencies using Maven artifact coordinates.
270-
You may add the additional modules to the `jbang.properties` as described in the next section.
270+
You may also add the additional modules to the `jbang.properties` as described in the next section.
271271

272272
[[runtime-jbang-dependencies]]
273273
=== Additional JBang dependencies
@@ -304,8 +304,7 @@ The file above adds the modules `citrus-camel`, `citrus-testcontainers` and `cit
304304

305305
The `jbang.properties` file may be located right next to the test source file or in your user home directory for global settings.
306306

307-
IMPORTANT: In case you want to run Cucumber BDD Gherkin feature files and use the predefined steps included in the https://github.com/citrusframework/yaks[YAKS] project,
308-
you need to add this YAKS runtime dependency accordingly: `org.citrusframework.yaks:yaks-standard:0.20.0`
307+
IMPORTANT: In case you want to run Cucumber BDD Gherkin feature files and use the predefined Citrus steps, you need to add this dependency accordingly: `org.citrusframework:citrus-cucumber-all:4.9.0-SNAPSHOT`
309308

310309
[[runtime-jbang-clipboard]]
311310
=== Run from clipboard

0 commit comments

Comments
 (0)