Adam,

It might sound crazy but I would actually suggest doing this inside another 
NiFi flow (cue the Inception drone sound). Place the components under test 
inside a process group with an input and output port, and in the parent group, 
use GenerateFlowFile or GetFile to supply known data to the input port. Then 
take the data coming from the output port and verify it using ValidateRecord, 
RouteOnAttribute, FuzzyHashContent, etc. Once you have the flow verified, you 
can simply export the process group as your template. With the existing parent 
flow, you can also drag on new templates into a PG and connect the input(s) 
(test fixtures) and output(s) (verifiers) to make this fairly quick.

As far as automating it programmatically, I don’t have a great suggestion here 
but I know Matt Burgess has done work on a unit tester [1] for the scripts used 
by ExecuteScript, which isn’t quite the same but might be a good starting point.

Any insights you gain would certainly be welcomed by the community. Thanks.

[1] 
https://funnifi.blogspot.com/2016/06/testing-executescript-processor-scripts.html
 
<https://funnifi.blogspot.com/2016/06/testing-executescript-processor-scripts.html>


Andy LoPresto
[email protected]
[email protected]
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Sep 29, 2017, at 8:19 AM, Adam J. Shook <[email protected]> wrote:
> 
> Hello all,
> 
> I am curious if anyone has done any work/design around creating a harness for 
> testing templates?  I'm looking for a (relatively) easy way to create a 
> template within NiFi, export it, and have some unit-test-like functionality 
> for validating output based on different types of input -- clean data, 
> malformed data, wrong schema, etc.  Integration with other tools like Kafka 
> is extra credit.  I feel like this could be an interesting use case for 
> MiNiFi.
> 
> Thank you,
> --Adam

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to