This is an automated email from the ASF dual-hosted git repository.
aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-e2e.git
The following commit(s) were added to refs/heads/master by this push:
new 3ca14a6 [ISSUE #23]Add the design of the test case specification (#22)
3ca14a6 is described below
commit 3ca14a675a5db974cc49163f9c714b7607f91b86
Author: yueya <[email protected]>
AuthorDate: Fri Apr 21 11:05:51 2023 +0800
[ISSUE #23]Add the design of the test case specification (#22)
* add bdd cases demo
* Add check for delay message
---
bdd/normal.feature | 18 ---
bdd/pom.xml | 145 +++++++++++++++++++++
.../org/apache/rocketmq/ClientInitStepdefs.java | 100 ++++++++++++++
.../java/org/apache/rocketmq/DelayStepdefs.java | 31 +++++
bdd/src/main/resources/delay.feature | 33 +++++
bdd/src/main/resources/normal.feature | 15 +++
bdd/src/main/resources/order.feature | 11 ++
bdd/src/main/resources/transaction.feature | 20 +++
8 files changed, 355 insertions(+), 18 deletions(-)
diff --git a/bdd/normal.feature b/bdd/normal.feature
deleted file mode 100644
index 42d8134..0000000
--- a/bdd/normal.feature
+++ /dev/null
@@ -1,18 +0,0 @@
-Feature: Test producer send message with normal topic
-
- Background:
- Given username、password and endpoint
-
- Scenario: send normal msgs with sync method and recv by simpleconsumer
- Given normal topic name to use
- When create normal topic
- And build and start consumer、producer,consumer subscribe topic
- And use producer sync send 10 msgs
- Then receive 10 msgs from server by simpleconsumer
-
- Scenario: send normal msgs with async method and recv by simpleconsumer
- Given normal topic name to use
- When create normal topic
- And build and start consumer、producer,consumer subscribe topic
- And use producer async send 10 msgs
- Then receive 10 msgs from server by simpleconsumer
\ No newline at end of file
diff --git a/bdd/pom.xml b/bdd/pom.xml
new file mode 100644
index 0000000..9e4eb57
--- /dev/null
+++ b/bdd/pom.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.rocketmq</groupId>
+ <artifactId>rocketmq-bdd</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
+
+ <junit.jupiter.version>5.7.2</junit.jupiter.version>
+ <rocketmq.client.version>4.9.3</rocketmq.client.version>
+ <rocketmqV5.client.version>5.0.2</rocketmqV5.client.version>
+ <cucumber.version>7.11.1</cucumber.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.cucumber</groupId>
+ <artifactId>cucumber-java</artifactId>
+ <version>${cucumber.version}</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>io.cucumber</groupId>-->
+<!-- <artifactId>cucumber-junit</artifactId>-->
+<!-- <version>${cucumber.version}</version>-->
+<!-- <scope>test</scope>-->
+<!-- </dependency>-->
+ <dependency>
+ <groupId>io.cucumber</groupId>
+ <artifactId>cucumber-core</artifactId>
+ <version>${cucumber.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.17</version>
+ <executions>
+ <execution>
+ <id>verify</id>
+ <phase>verify</phase>
+ <configuration>
+
<configLocation>style/rmq_checkstyle.xml</configLocation>
+ <encoding>UTF-8</encoding>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
+
<includeTestSourceDirectory>false</includeTestSourceDirectory>
+ </configuration>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.12</version>
+ <configuration>
+ <excludes>
+ <exclude>.gitignore</exclude>
+ <exclude>.travis.yml</exclude>
+ <exclude>CONTRIBUTING.md</exclude>
+ <exclude>bin/README.md</exclude>
+ <exclude>.github/**</exclude>
+ <exclude>src/test/resources/certs/*</exclude>
+ <exclude>src/test/**/*.log</exclude>
+
<exclude>src/test/resources/META-INF/service/*</exclude>
+
<exclude>src/main/resources/META-INF/service/*</exclude>
+ <exclude>*/target/**</exclude>
+ <exclude>*/*.iml</exclude>
+ <exclude>docs/**</exclude>
+ <exclude>localbin/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ <configuration>
+ <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
+ <rerunFailingTestsCount>1</rerunFailingTestsCount>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.22.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+
<source>${project.basedir}/src/test/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.conf</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+</project>
\ No newline at end of file
diff --git a/bdd/src/main/java/org/apache/rocketmq/ClientInitStepdefs.java
b/bdd/src/main/java/org/apache/rocketmq/ClientInitStepdefs.java
new file mode 100644
index 0000000..0718c29
--- /dev/null
+++ b/bdd/src/main/java/org/apache/rocketmq/ClientInitStepdefs.java
@@ -0,0 +1,100 @@
+package org.apache.rocketmq;
+
+import io.cucumber.java.en.And;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+public class ClientInitStepdefs {
+ @And("Shutdown the producer and consumer")
+ public void shutdownTheProducerAndConsumer() {
+ }
+
+ @And("Create a Producer, set the <NameServer>, <RequestTimeout>")
+ public void createAProducerSetTheNameServerRequestTimeout() {
+ }
+
+ @And("Create a Producer, set the {string}, {string}")
+ public void createAProducerSetThe(String nameserver, String
requestTimeout) {
+ }
+
+ @Then("Create a message, including the {string}, {string}, {string}, and
{string}")
+ public void createAMessageIncludingTheAnd(String arg0, String arg1, String
arg2, String arg3) {
+ }
+
+ @When("Create a PushConsumer, set the {string}, {string},
{string}:{string}, {string}")
+ public void createAPushConsumerSetThe(String arg0, String arg1, String
arg2, String arg3, String arg4) {
+
+ }
+
+ @And("Send {string} messages {string}")
+ public void sendMessages(String arg0, String arg1) {
+
+ }
+
+ @And("Shutdown the producer")
+ public void shutdownTheProducer() {
+
+ }
+
+ @Then("Check all messages that can be consumed within {int}s")
+ public void checkAllMessagesThatCanBeConsumedWithinS(int arg0) {
+
+ }
+
+ @And("A total of {int} messages are sent {string} to the {int}
MessageGroups in turn")
+ public void aTotalOfMessagesAreSentToTheMessageGroupsInTurn(int arg0,
String arg1, int arg2) {
+
+ }
+
+ @Given("Create a {string} topic:{string} if not exist, a {string}
group:{string}")
+ public void createATopicIfNotExistAGroup(String arg0, String arg1, String
arg2, String arg3) {
+
+ }
+
+ @And("Create a Producer, set the {string}, {string}, {string}")
+ public void createAProducerSetThe(String arg0, String arg1, String arg2) {
+
+ }
+
+ @And("Create a Producer, set the {string}, {string}, {string}, {string}")
+ public void createAProducerSetThe(String arg0, String arg1, String arg2,
String arg3) {
+
+
+ }
+
+ @And("Execute transaction:{string}")
+ public void executeTransaction(String arg0) {
+
+ }
+
+ @Then("Check all messages send {string}")
+ public void checkAllMessagesSend(String arg0) {
+
+ }
+
+ @When("Create a PushConsumer, set the Endpoint\\({string}),
ConsumerGroup\\({string}), SubscriptionExpression\\({string}),
Topic\\({string}), MessageListener\\({string})")
+ public void
createAPushConsumerSetTheEndpointConsumerGroupSubscriptionExpressionTopicMessageListener(String
arg0, String arg1, String arg2, String arg3, String arg4) {
+
+ }
+
+ @And("Create a Producer, set the Endpoint\\({string}),
RequestTimeout:\\({string}), Topic\\({string}),
TransactionChecker:\\({string})")
+ public void
createAProducerSetTheEndpointRequestTimeoutTopicTransactionChecker(String arg0,
String arg1, String arg2, String arg3) {
+
+ }
+
+ @Then("Create a message, including the Topic\\({string}),
SubscriptionExpression\\({string}), Key\\({string}), and Body\\({string})")
+ public void
createAMessageIncludingTheTopicSubscriptionExpressionKeyAndBody(String arg0,
String arg1, String arg2, String arg3) {
+
+ }
+
+ @And("Create a Producer, set the Endpoint\\({string}),
RequestTimeout:\\({string}), Topic\\({string})")
+ public void createAProducerSetTheEndpointRequestTimeoutTopic(String arg0,
String arg1, String arg2) {
+
+ }
+
+ @Then("Check send message failed")
+ public void checkSendMessageFailed() {
+
+ }
+}
diff --git a/bdd/src/main/java/org/apache/rocketmq/DelayStepdefs.java
b/bdd/src/main/java/org/apache/rocketmq/DelayStepdefs.java
new file mode 100644
index 0000000..18529c9
--- /dev/null
+++ b/bdd/src/main/java/org/apache/rocketmq/DelayStepdefs.java
@@ -0,0 +1,31 @@
+package org.apache.rocketmq;
+
+import io.cucumber.java.en.And;
+import io.cucumber.java.en.Then;
+
+public class DelayStepdefs {
+ @And("Check consume all messages immediately")
+ public void checkConsumeAllMessagesImmediately() {
+
+ }
+
+ @Then("Check consume all {int} messages after {int}s\\(±{int}s)")
+ public void checkConsumeAllMessagesAfterSS(int arg0, int arg1, int arg2) {
+
+ }
+
+ @And("Set message {string} to {int} seconds before the current system
time")
+ public void setMessageToSecondsBeforeTheCurrentSystemTime(String arg0, int
arg1) {
+
+ }
+
+ @And("Set message {string} to {int} seconds after the current system time")
+ public void setMessageToSecondsAfterTheCurrentSystemTime(String arg0, int
arg1) {
+
+ }
+
+ @And("Check the received message's {string} property {string} and value is
expected")
+ public void checkTheReceivedMessageSPropertyAndValueIsExpected(String
arg0, String arg1) {
+
+ }
+}
diff --git a/bdd/src/main/resources/delay.feature
b/bdd/src/main/resources/delay.feature
new file mode 100644
index 0000000..e6a714b
--- /dev/null
+++ b/bdd/src/main/resources/delay.feature
@@ -0,0 +1,33 @@
+Feature: Test the message transfer mode and topic type
+
+ Scenario: Send 10 messages set delivery timestamp after 30s after the
current system time. Expect to consume all 10 messages after 30s
+ Given Create a "DELAY" topic:"random-topic" if not exist, a "Concurrently"
group:"random-group"
+ When Create a PushConsumer, set the Endpoint("127.0.0.1:9876"),
ConsumerGroup("random-group"), SubscriptionExpression("TagA"),
Topic("random-topic"), MessageListener("default")
+ And Create a Producer, set the Endpoint("127.0.0.1:9876"),
RequestTimeout:("10s"), Topic("random-topic")
+ Then Create a message, including the Topic("random-topic"),
SubscriptionExpression("TagA"), Key("Key"), and Body("Body")
+ And Set message "DeliveryTimestamp" to 20 seconds before the current
system time
+ And Send "10" messages "synchronous"
+ Then Check all messages that can be consumed within 60s
+ And Check the received message's "DeliveryTimestamp" property "isNotNull"
and value is expected
+ And Check consume all messages immediately
+ And Shutdown the producer and consumer
+
+ Scenario: Send 10 messages set delivery timestamp 10s before the current
system time. Expect timing does not take effect, all 10 messages can be
consumed immediately
+ Given Create a "DELAY" topic:"random-topic" if not exist, a "Concurrently"
group:"random-group"
+ When Create a PushConsumer, set the Endpoint("127.0.0.1:9876"),
ConsumerGroup("random-group"), SubscriptionExpression("TagA"),
Topic("random-topic"), MessageListener("default")
+ And Create a Producer, set the Endpoint("127.0.0.1:9876"),
RequestTimeout:("10s"), Topic("random-topic")
+ Then Create a message, including the Topic("random-topic"),
SubscriptionExpression("TagA"), Key("Key"), and Body("Body")
+ And Set message "DeliveryTimestamp" to 30 seconds after the current system
time
+ And Send "10" messages "synchronous"
+ Then Check consume all 10 messages after 30s(±5s)
+ And Check the received message's "DeliveryTimestamp" property "isNotNull"
and value is expected
+ And Shutdown the producer and consumer
+
+ Scenario: Send a message set delivery timestamp 24h+5s after the current
system time. Expect send message failed
+ Given Create a "DELAY" topic:"random-topic" if not exist, a "Concurrently"
group:"random-group"
+ And Create a Producer, set the Endpoint("127.0.0.1:9876"),
RequestTimeout:("10s"), Topic("random-topic")
+ Then Create a message, including the Topic("random-topic"),
SubscriptionExpression("TagA"), Key("Key"), and Body("Body")
+ And Set message "DeliveryTimestamp" to 86405 seconds after the current
system time
+ And Send "1" messages "synchronous"
+ Then Check send message failed
+ And Shutdown the producer
\ No newline at end of file
diff --git a/bdd/src/main/resources/normal.feature
b/bdd/src/main/resources/normal.feature
new file mode 100644
index 0000000..9950722
--- /dev/null
+++ b/bdd/src/main/resources/normal.feature
@@ -0,0 +1,15 @@
+Feature: Test the message transfer mode
+
+ Scenario Outline: 10 normal messages are sent synchronously and are
expected to be received
+ Given Create a "Normal" topic:"random-topic" if not exist, a
"Concurrently" group:"random-group"
+ When Create a PushConsumer, set the Endpoint("127.0.0.1:9876"),
ConsumerGroup("random-group"), SubscriptionExpression("TagA"),
Topic("random-topic"), MessageListener("default")
+ And Create a Producer, set the Endpoint("127.0.0.1:9876"),
RequestTimeout:("10s"), Topic("random-topic")
+ Then Create a message, including the Topic("random-topic"),
SubscriptionExpression("TagA"), Key("Key"), and Body("Body")
+ And Send "10" messages "<TransmissionMode>"
+ Then Check all messages that can be consumed within 60s
+ And Shutdown the producer and consumer
+
+ Examples:
+ | TransmissionMode |
+ | synchronous |
+ | asynchronous |
diff --git a/bdd/src/main/resources/order.feature
b/bdd/src/main/resources/order.feature
new file mode 100644
index 0000000..e8d2669
--- /dev/null
+++ b/bdd/src/main/resources/order.feature
@@ -0,0 +1,11 @@
+Feature: Test the message transfer mode and topic type
+
+ Scenario: Send 100 messages with in 2 MessageGroup, expect consumed all
messages orderly
+ Given Create a "FIFO" topic:"random-topic" if not exist, a "Orderly"
group:"random-group"
+ When Create a PushConsumer, set the Endpoint("127.0.0.1:9876"),
ConsumerGroup("random-group"), SubscriptionExpression("TagA"),
Topic("random-topic"), MessageListener("default")
+ And Create a Producer, set the Endpoint("127.0.0.1:9876"),
RequestTimeout:("10s"), Topic("random-topic")
+ Then Create a message, including the Topic("random-topic"),
SubscriptionExpression("TagA"), Key("Key"), and Body("Body")
+ And A total of 100 messages are sent "<TransmissionMode>" to the 2
MessageGroups in turn
+ Then Check all messages that can be consumed within 60s
+ And Check each MessageGroup consumes up to 50 messages separately and is
consumed orderly
+ And Shutdown the producer and consumer
diff --git a/bdd/src/main/resources/transaction.feature
b/bdd/src/main/resources/transaction.feature
new file mode 100644
index 0000000..942773a
--- /dev/null
+++ b/bdd/src/main/resources/transaction.feature
@@ -0,0 +1,20 @@
+Feature: Test the message transfer mode
+
+ Scenario Outline: 10 transaction messages are sent synchronously and are
expected to be received
+ Given Create a "Normal" topic:"random-topic" if not exist, a
"Concurrently" group:"random-group"
+ When Create a PushConsumer, set the Endpoint("127.0.0.1:9876"),
ConsumerGroup("random-group"), SubscriptionExpression("TagA"),
Topic("random-topic"), MessageListener("default")
+ And Create a Producer, set the Endpoint("127.0.0.1:9876"),
RequestTimeout:("10s"), Topic("random-topic"),
TransactionChecker:("<TransactionChecker>")
+ And Create a transaction branch
+ Then Create a message, including the Topic("random-topic"),
SubscriptionExpression("TagA"), Key("Key"), and Body("Body")
+ And Send a half message
+ And Execute transaction:"<TransactionExecutor>"
+ Then Check all messages send "success"
+ And Check all messages that can be consumed within 60s
+ And Shutdown the producer and consumer
+
+ Examples:
+ | TransactionChecker | TransactionExecutor |
+ | COMMIT | COMMIT |
+ | ROLLBACK | COMMIT |
+ | UNKNOWN | COMMIT |
+