NiFi Developer's Guide
Also available as:
loading table of contents...

Instantiate TestRunner

Most unit tests for a Processor or a Controller Service start by creating an instance of the TestRunner class. In order to add the necessary classes to your Processor, you can use the Maven dependency:

        <version>${nifi version}</version>

We create a new TestRunner by calling one of the static newTestRunner methods of the TestRunners class (located in the org.apache.nifi.util package). These methods take an argument for the Processor under test (can either be the class of the Processor to test or can be an instance of a Processor), and allow the setting of the processor name as well.