Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Loading data to test harness


Hi guys.

I'm trying to debug a user defined procedure using the test harness as described by Max De Marzi's blog. I'm struggling with adding test data to debug against.

Does the test harness require the data fixture to be embedded in java as a string? I have found no other way (that works) to load data to the harness other than calling .withFixture(String MODEL_STATEMENT) where that model statement is a single cypher statement.

I attempted to load exported cypher scripts files (using apoc) from other databases but those scripts are not compatible with withFixture(File cypherFile) unless there is exactly one cypher statement in the file.

Using .copyFrom(File sourceDirectory) does not load the databases in the folders (properly setup according to the now working javadocs as data/databases/neo4j).

Even if I wanted to launch the Harness and use apoc to execute the exported cypher to preload data during initialization, the harness would have no access to the cypher script file as there's no way to mount the folder or copy the file in.

I'm coming to the conclusion that if I want to debug any stored procedure in Neo4j that leverages apoc, it requires this:

  • Neo4j version 4.0.5
  • APOC version
  • Single cypher statement test fixture as a java string.

Am I missing something?

Edit: I was able to load the cypher script file by splitting it by semicolon and line separator:

    static void initialize() throws URISyntaxException, IOException  {

        var pluginDirContainingApocJar = new File(

        var builder = Neo4jBuilders.newInProcessBuilder()
            .withConfig(GraphDatabaseSettings.plugin_dir, pluginDirContainingApocJar)
            .withConfig(GraphDatabaseSettings.procedure_unrestricted, List.of("apoc.*"))
            .withConfig(ApocSettings.apoc_import_file_enabled, true)
            .withConfig(ApocSettings.apoc_export_file_enabled, true)
        Path cypherScript = Path.of("/import/export-plain.cypher");        
        String fileContents = Files.readString(cypherScript);
        List<String> statements = Arrays.asList(fileContents.split(";\n"));

        for (String statement : statements) {  
        neo4j =;

Node Clone

not sure if this is still relevant but you can
A. ,

  • publish you package to the plugins folder
  • start your db in desktop
  • attach debugger to running desktop
  • in browser execute CALL myfunctrion()
  • break point happiness


  • debug using TestServerBuilders
        File f = new File("....\\data");
        this.embeddedDatabaseServer = TestServerBuilders

then step into your breakpoints ( of course make sure that your apoc lib is a system dependency )