[ 
https://issues.apache.org/jira/browse/TINKERPOP-3136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17946249#comment-17946249
 ] 

ASF GitHub Bot commented on TINKERPOP-3136:
-------------------------------------------

kenhuuu commented on code in PR #3097:
URL: https://github.com/apache/tinkerpop/pull/3097#discussion_r2053100356


##########
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/StepDefinition.java:
##########
@@ -374,6 +375,91 @@ else if (result instanceof Map)
             fail(String.format("Missing an assert for this type", 
result.getClass()));
     }
 
+    @Then("the result should be a subgraph with the following")
+    public void theResultShouldBeASubgraphWithEdges(final DataTable dataTable) 
{
+        assertThatNoErrorWasThrown();
+
+        // result should be a graph
+        assertThat(result, instanceOf(Graph.class));
+
+        // pop a graph traversal source from what was returned so we can use 
it for assertions
+        final GraphTraversalSource sg = ((Graph) result).traversal();
+
+        // the first item in the datatable tells us what we are asserting
+        final boolean assertingVertices = 
dataTable.asList().get(0).equals("vertices") ? true : false;
+
+        if (assertingVertices) {
+            // grab the expected vertex in the subgraph
+            final List<Vertex> expectedVertices = 
dataTable.asList().stream().skip(1).
+                    map(this::convertToObject).
+                    map(v -> (Vertex) v).collect(Collectors.toList());
+
+            // expected vertices match the count in the graph
+            assertEquals(expectedVertices.size(), 
sg.V().count().next().intValue());
+
+            // assert the structure of the subgraph. there should be no 
references here as this is serialized as
+            // a full TinkerGraph. also, ids should be the same as they are in 
the source graph so we can use all
+            // of this to do a complete assertion. there is only support for 
the modern graph right now but it
+            // wouldn't be hard to add others.
+            for (Vertex vertex : expectedVertices) {
+                final String variableKey = vertex.label().equals("person") ? 
"age" : "lang";

Review Comment:
   This seems very specific. Is this limitation documented somewhere?





> Complete move to Gherkin for implementation testing
> ---------------------------------------------------
>
>                 Key: TINKERPOP-3136
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3136
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: test-suite
>    Affects Versions: 3.7.3
>            Reporter: Stephen Mallette
>            Priority: Major
>
> TinkerPop is most of the way to testing Gremlin exclusively with Gherkin. By 
> 4.0 that move should be complete with whatever deprecations necessary for 
> Java tests along 3.x. Retain the Java test suite for embedded {{Graph}} tests 
> that only make sense in that case.
> For 3.x - likely 3.8.x
> * Create {{ProcessEmbeddedSuite}} and deprecate {{ProcessLimitedSuite}} to 
> make it clear what aspects of Gremlin are meant for embedded cases and 
> Java/Groovy sugar only. Update provider documentation to reflect these 
> changes and ensure Gherkin is clear as the primary test suite for Gremlin.
> * Drop {{MergeVertexTest}} and {{MergeEdgeTest}} as remaining tests in there 
> seem to be covered by Gherkin already.
> * Drop {{SubgraphTest}} since it should be able to be converted to feature 
> tests but will need to add a way to assert a {{Graph}} though. Ignore in 
> languages that don't have {{{}Graph{}}}.
> * Drop {{TreeTest}} since it should be able to be converted to feature tests 
> but will need to add a way to assert a {{Tree}} though. Ignore in languages 
> that don't have {{{}Tree{}}}.
> * Implement Gherkin tests for {{match()}} - do a limited and simple set to 
> minimally test the capability since that feature is a bit up in the air for 
> 4.x. Retain {{MatchTest}} as it is for the embedded suite for now.
> * For {{{}ComplexTest{}}}:
>  ** {{cap('m')}} from {{classicRecommendation}} so that it can be asserted in 
> {{{}Recommendation.feature{}}}.
>  *** Figure out a way to assert the {{coworkerSummary}} tests in Gherkin. We 
> don't currently have a way to assert very complex {{{}Map{}}}. The basic test 
> could be run multiple times to try to break up the results to fit with the 
> assertion capabilities?
>  ** Move {{playlistPths}} to {{Paths.feature}}
>  ** Remove {{ComplexTest}} as all relevant tests will have been moved to 
> Gherkin.
> * Remove {{PartitionStrategyProcessTest}} - seems to be covered in Gherkin at 
> this point.
> * Convert {{TernaryBooleanLogicsTest}} to Gherkin - add it to the 
> {{/semantics}} directory.
> * Remove all lambda based tests from Gherkin since they are not supported by 
> gremlin-language. Ensure that they all exist in the embedded tests. Perhaps 
> put them all in a {{LambdaStepTest}} and combine in other embedded tests 
> there so that they are all in once place. Remove all infrastructure for 
> processing lambdas in the Gherkin suite. Test lambdas in GLVs independently.
> For 4.x
>  * Remove {{ProcessLimitedSuite}} in favor of {{ProcessEmbeddedSuite}}
>  * Since {{Tree}} and {{Graph}} will be present in 4.x for all languages, 
> ensure that test suites are updated in support of those assertions as these 
> tests will have been skipped prior.
> h3. Open questions
>  * Make a decision about {{profile()}} and {{explain()}} in terms of how they 
> are tested. Leaning toward them remaining an embedded case as they have 
> implementation specific output potentially
>  * Examine "Given an unsupported test" definitions....can any be supported 
> now? what do we do with those that cant?
> Note the linked JIRAs below as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to