You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Andrew Christianson <an...@nextcentury.com> on 2017/05/30 15:13:56 UTC

MiNiFi C++ Unit Test Example

Hi All,

I am currently working on final preparations for the merge request on MINIFI-244. I see that a unit test framework has been added to the code base. Looking through the extant unit tests, there is a significant amount of boilerplate and it is unclear to me what would be an idiomatic unit test for MiNiFi C++.

Is there/could someone produce an example minimal unit test source code for a MiNiFi processor? Alternatively, are there plans/efforts to extract out some of this boilerplate?

Regards,

Andy

Re: MiNiFi C++ Unit Test Example

Posted by Andrew Christianson <an...@nextcentury.com>.
Thanks, Marc.

I checked out the TEST_CASE and it looks like an improvement. From my perspective on the test harness, the most important thing would be minimizing boilerplate increasing the expressiveness of the TEST case. The new test harness is a nice step in that direction as it encapsulates a lot of the underlying infrastructure. The line count is significantly lower and the lines that do exist pertain mostly to what's actually being tested.

I will rebase onto this once merged and use the new plan, unless you had any significant changes planned for the near term.

Regards,

Andy
________________________________________
From: Marc <ph...@apache.org>
Sent: Tuesday, June 13, 2017 12:51:39 PM
To: dev@nifi.apache.org
Subject: Re: MiNiFi C++ Unit Test Example

Hi Andrew,
  I've created a ticket [1] that captures a simple discussion for a test
harness along with a reference to a commit that contains an example. This
example isn't intended to be a complete. I'm sure it will evolve or change
completely, but I wanted to provide an example from which we could work so
we had something to discuss in the ticket. Please let me know your
wants/desires for this harness. Would love some feedback/help on this from
you or anyone else. We can also incorporate gmock to make some of this
easier and am completely open to that idea.

[1] https://issues.apache.org/jira/browse/MINIFI-335

   Best Regards,
   Marc Parisi


On Mon, Jun 5, 2017 at 11:22 AM, Andrew Christianson <
andrew.christianson@nextcentury.com> wrote:

> Sounds good. I will keep an eye out for those merges.
>
> " For example, it would be nice to eat our own dog food by creating
> interfaces for easily instantiating and connecting processors."
>
> Hits the nail on the head. Creating all the underlying
> infrastructure/connections when I really just want to test onTrigger is the
> real headache at this point.
>
> Regards,
>
> Andy
> ________________________________________
> From: Marc <ph...@apache.org>
> Sent: Monday, June 5, 2017 10:42:18 AM
> To: dev@nifi.apache.org
> Subject: Re: MiNiFi C++ Unit Test Example
>
> Andrew,
>    To come back around to this I wanted to let you know I have a PR to
> complete some of the activities regarding volatile repos. Provenance and
> FlowFile volatile repos are mostly complete with a pending PR to tie in the
> reporting functionality to it. I'm nearly read to update said PR for the
> content repo. The goal here is to move most tests over to volatile repos
> unless those tests specifically need, which I'm testing now. Currently we
> write content to the test folder, I want this to go away before I jump into
> a test harness.
>   In regards to your question about an example minimal test. We have the
> ProcessorTests.cpp and various other processor specific tests; however,
> there is still a lot to add. I'd like to get to a point that we can more
> easily build some of these tests using the code that exists to run the
> agent. For example, it would be nice to eat our own dog food by creating
> interfaces for easily instantiating and connecting processors. I have some
> ideas, so I'll put them up in a ticket once my current effort is finished.
>
> On Tue, May 30, 2017 at 11:19 AM, Marc <ph...@apache.org> wrote:
>
> > Andrew,
> >    That is something we would love to see I think. We could certainly
> > facilitate testing and is something that has been discussed. I'm unsure
> if
> > a ticket exists, though. Feel free to make a ticket to begin building
> some
> > of the test framework for functional components. I'll be happy to help
> when
> > I have some cycles.
> >
> > On May 30, 2017 11:14 AM, "Andrew Christianson" <andrew.christianson@
> > nextcentury.com> wrote:
> >
> >> Hi All,
> >>
> >> I am currently working on final preparations for the merge request on
> >> MINIFI-244. I see that a unit test framework has been added to the code
> >> base. Looking through the extant unit tests, there is a significant
> amount
> >> of boilerplate and it is unclear to me what would be an idiomatic unit
> test
> >> for MiNiFi C++.
> >>
> >> Is there/could someone produce an example minimal unit test source code
> >> for a MiNiFi processor? Alternatively, are there plans/efforts to
> extract
> >> out some of this boilerplate?
> >>
> >> Regards,
> >>
> >> Andy
> >
> >
>

Re: MiNiFi C++ Unit Test Example

Posted by Marc <ph...@apache.org>.
Hi Andrew,
  I've created a ticket [1] that captures a simple discussion for a test
harness along with a reference to a commit that contains an example. This
example isn't intended to be a complete. I'm sure it will evolve or change
completely, but I wanted to provide an example from which we could work so
we had something to discuss in the ticket. Please let me know your
wants/desires for this harness. Would love some feedback/help on this from
you or anyone else. We can also incorporate gmock to make some of this
easier and am completely open to that idea.

[1] https://issues.apache.org/jira/browse/MINIFI-335

   Best Regards,
   Marc Parisi


On Mon, Jun 5, 2017 at 11:22 AM, Andrew Christianson <
andrew.christianson@nextcentury.com> wrote:

> Sounds good. I will keep an eye out for those merges.
>
> " For example, it would be nice to eat our own dog food by creating
> interfaces for easily instantiating and connecting processors."
>
> Hits the nail on the head. Creating all the underlying
> infrastructure/connections when I really just want to test onTrigger is the
> real headache at this point.
>
> Regards,
>
> Andy
> ________________________________________
> From: Marc <ph...@apache.org>
> Sent: Monday, June 5, 2017 10:42:18 AM
> To: dev@nifi.apache.org
> Subject: Re: MiNiFi C++ Unit Test Example
>
> Andrew,
>    To come back around to this I wanted to let you know I have a PR to
> complete some of the activities regarding volatile repos. Provenance and
> FlowFile volatile repos are mostly complete with a pending PR to tie in the
> reporting functionality to it. I'm nearly read to update said PR for the
> content repo. The goal here is to move most tests over to volatile repos
> unless those tests specifically need, which I'm testing now. Currently we
> write content to the test folder, I want this to go away before I jump into
> a test harness.
>   In regards to your question about an example minimal test. We have the
> ProcessorTests.cpp and various other processor specific tests; however,
> there is still a lot to add. I'd like to get to a point that we can more
> easily build some of these tests using the code that exists to run the
> agent. For example, it would be nice to eat our own dog food by creating
> interfaces for easily instantiating and connecting processors. I have some
> ideas, so I'll put them up in a ticket once my current effort is finished.
>
> On Tue, May 30, 2017 at 11:19 AM, Marc <ph...@apache.org> wrote:
>
> > Andrew,
> >    That is something we would love to see I think. We could certainly
> > facilitate testing and is something that has been discussed. I'm unsure
> if
> > a ticket exists, though. Feel free to make a ticket to begin building
> some
> > of the test framework for functional components. I'll be happy to help
> when
> > I have some cycles.
> >
> > On May 30, 2017 11:14 AM, "Andrew Christianson" <andrew.christianson@
> > nextcentury.com> wrote:
> >
> >> Hi All,
> >>
> >> I am currently working on final preparations for the merge request on
> >> MINIFI-244. I see that a unit test framework has been added to the code
> >> base. Looking through the extant unit tests, there is a significant
> amount
> >> of boilerplate and it is unclear to me what would be an idiomatic unit
> test
> >> for MiNiFi C++.
> >>
> >> Is there/could someone produce an example minimal unit test source code
> >> for a MiNiFi processor? Alternatively, are there plans/efforts to
> extract
> >> out some of this boilerplate?
> >>
> >> Regards,
> >>
> >> Andy
> >
> >
>

Re: MiNiFi C++ Unit Test Example

Posted by Andrew Christianson <an...@nextcentury.com>.
Sounds good. I will keep an eye out for those merges.

" For example, it would be nice to eat our own dog food by creating
interfaces for easily instantiating and connecting processors."

Hits the nail on the head. Creating all the underlying infrastructure/connections when I really just want to test onTrigger is the real headache at this point.

Regards,

Andy
________________________________________
From: Marc <ph...@apache.org>
Sent: Monday, June 5, 2017 10:42:18 AM
To: dev@nifi.apache.org
Subject: Re: MiNiFi C++ Unit Test Example

Andrew,
   To come back around to this I wanted to let you know I have a PR to
complete some of the activities regarding volatile repos. Provenance and
FlowFile volatile repos are mostly complete with a pending PR to tie in the
reporting functionality to it. I'm nearly read to update said PR for the
content repo. The goal here is to move most tests over to volatile repos
unless those tests specifically need, which I'm testing now. Currently we
write content to the test folder, I want this to go away before I jump into
a test harness.
  In regards to your question about an example minimal test. We have the
ProcessorTests.cpp and various other processor specific tests; however,
there is still a lot to add. I'd like to get to a point that we can more
easily build some of these tests using the code that exists to run the
agent. For example, it would be nice to eat our own dog food by creating
interfaces for easily instantiating and connecting processors. I have some
ideas, so I'll put them up in a ticket once my current effort is finished.

On Tue, May 30, 2017 at 11:19 AM, Marc <ph...@apache.org> wrote:

> Andrew,
>    That is something we would love to see I think. We could certainly
> facilitate testing and is something that has been discussed. I'm unsure if
> a ticket exists, though. Feel free to make a ticket to begin building some
> of the test framework for functional components. I'll be happy to help when
> I have some cycles.
>
> On May 30, 2017 11:14 AM, "Andrew Christianson" <andrew.christianson@
> nextcentury.com> wrote:
>
>> Hi All,
>>
>> I am currently working on final preparations for the merge request on
>> MINIFI-244. I see that a unit test framework has been added to the code
>> base. Looking through the extant unit tests, there is a significant amount
>> of boilerplate and it is unclear to me what would be an idiomatic unit test
>> for MiNiFi C++.
>>
>> Is there/could someone produce an example minimal unit test source code
>> for a MiNiFi processor? Alternatively, are there plans/efforts to extract
>> out some of this boilerplate?
>>
>> Regards,
>>
>> Andy
>
>

Re: MiNiFi C++ Unit Test Example

Posted by Marc <ph...@apache.org>.
Andrew,
   To come back around to this I wanted to let you know I have a PR to
complete some of the activities regarding volatile repos. Provenance and
FlowFile volatile repos are mostly complete with a pending PR to tie in the
reporting functionality to it. I'm nearly read to update said PR for the
content repo. The goal here is to move most tests over to volatile repos
unless those tests specifically need, which I'm testing now. Currently we
write content to the test folder, I want this to go away before I jump into
a test harness.
  In regards to your question about an example minimal test. We have the
ProcessorTests.cpp and various other processor specific tests; however,
there is still a lot to add. I'd like to get to a point that we can more
easily build some of these tests using the code that exists to run the
agent. For example, it would be nice to eat our own dog food by creating
interfaces for easily instantiating and connecting processors. I have some
ideas, so I'll put them up in a ticket once my current effort is finished.

On Tue, May 30, 2017 at 11:19 AM, Marc <ph...@apache.org> wrote:

> Andrew,
>    That is something we would love to see I think. We could certainly
> facilitate testing and is something that has been discussed. I'm unsure if
> a ticket exists, though. Feel free to make a ticket to begin building some
> of the test framework for functional components. I'll be happy to help when
> I have some cycles.
>
> On May 30, 2017 11:14 AM, "Andrew Christianson" <andrew.christianson@
> nextcentury.com> wrote:
>
>> Hi All,
>>
>> I am currently working on final preparations for the merge request on
>> MINIFI-244. I see that a unit test framework has been added to the code
>> base. Looking through the extant unit tests, there is a significant amount
>> of boilerplate and it is unclear to me what would be an idiomatic unit test
>> for MiNiFi C++.
>>
>> Is there/could someone produce an example minimal unit test source code
>> for a MiNiFi processor? Alternatively, are there plans/efforts to extract
>> out some of this boilerplate?
>>
>> Regards,
>>
>> Andy
>
>

Re: MiNiFi C++ Unit Test Example

Posted by Marc <ph...@apache.org>.
Andrew,
   That is something we would love to see I think. We could certainly
facilitate testing and is something that has been discussed. I'm unsure if
a ticket exists, though. Feel free to make a ticket to begin building some
of the test framework for functional components. I'll be happy to help when
I have some cycles.

On May 30, 2017 11:14 AM, "Andrew Christianson" <
andrew.christianson@nextcentury.com> wrote:

> Hi All,
>
> I am currently working on final preparations for the merge request on
> MINIFI-244. I see that a unit test framework has been added to the code
> base. Looking through the extant unit tests, there is a significant amount
> of boilerplate and it is unclear to me what would be an idiomatic unit test
> for MiNiFi C++.
>
> Is there/could someone produce an example minimal unit test source code
> for a MiNiFi processor? Alternatively, are there plans/efforts to extract
> out some of this boilerplate?
>
> Regards,
>
> Andy