You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/02/10 09:50:31 UTC

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2219: CassandraQL native support #1355

ppalaga commented on a change in pull request #2219:
URL: https://github.com/apache/camel-quarkus/pull/2219#discussion_r573587146



##########
File path: integration-tests/cassandraql/src/test/java/org/apache/camel/quarkus/component/cassandraql/it/CassandraqlTest.java
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.cassandraql.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.hamcrest.Matcher;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.both;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.not;
+
+@QuarkusTest
+@QuarkusTestResource(CassandraqlTestResource.class)
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+class CassandraqlTest {
+
+    private Employee sheldon = new Employee(1, "Sheldon", "Alpha Centauri");
+    private Employee leonard = new Employee(2, "Leonard", "Earth");
+    private Employee irma = new Employee(3, "Irma", "Jupiter");
+
+    @Test
+    @Order(1)

Review comment:
       Let's have some academic discussion about test structuring ;)
   
   I see that splitting into the methods helps structuring and thus understanding the code.
   
   I see that `@Order` is intended to overcome the fact that the test methods depend on effects caused by their predecessors. This helps when the whole class is executed without any explicit method includes/excludes.
   
   However, `@Order` does not express the dependency. Therefore, when the first test fails, the successor tests are still executed and will most probably fail. They will all be reported as failed and I am not sure if there is any way to see quickly from the report which one of them is the root cause.
   
   Also, the test methods cannot be executed independently via `mvn clean test -Dtest=CassandraqlTest#testUpdate` (except for the first one). 
   
   Given the above, I wonder whether this way of structuring brings enough benefits. I tend to see this kind of situation as end-to-end scenario that is best packed into as single test method where the structure is marked only by comments. (This is not a request to change this PR.) What do others think? Are there any other options to consider?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org