Interface World


  • public interface World
    This interface provides the context the test suite needs in order to execute the Gherkin tests. It is implemented by graph providers who wish to test their graph systems against the TinkerPop test suite. It is paired with a test that uses the Cucumber test runner (i.e. @RunWith(Cucumber.class)) and requires a dependency injection package (e.g. guice) to push an instance into the Cucumber execution.
    • Method Detail

      • beforeEachScenario

        default void beforeEachScenario​(io.cucumber.java.Scenario scenario)
        Called before each individual test is executed which provides an opportunity to do some setup. For example, if there is a specific test that can't be supported it can be ignored by checking for the name with scenario.getName() and then throwing an AssumptionViolatedException.
        Parameters:
        scenario -
      • afterEachScenario

        default void afterEachScenario()
        Called after each individual test is executed allowing for cleanup of any open resources.
      • changePathToDataFile

        default String changePathToDataFile​(String pathToFileFromGremlin)
        Called when g.io() is encountered in the Gherkin tests and allows the path to the data file to referenced to be changed. The default path will look something like: data/file.extension and will match one of the standard TinkerPop data files associated with the test framework. If the files need to be located somewhere else for a particular provider, this method can alter the path as needed.
        Parameters:
        pathToFileFromGremlin - the path to a data file as taken from the Gherkin tests
      • convertIdToScript

        default String convertIdToScript​(Object id,
                                         Class<? extends Element> type)
        Converts a graph element's T.id to a form that can be used in a script parsed by the grammar. For example, if the graph has numeric identifiers the default implementation of id().toString() would return "0" which would be interpreted by the grammar as a number when parsed in g.V(0). However, a graph that used UUID for an identifier would have a representation of "1c535978-dc36-4cd2-ab82-95a98a847757" which could not be parsed by the grammar directly as g.V(1c535978-dc36-4cd2-ab82-95a98a847757) and would need to be prefixed and suffixed with double or single quotes. Therefore, this method would be overridden for that graph to perform that function.