Maven SureFire Plugin: Android Provider

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven SureFire Plugin: Android Provider

Shane Isbell
Hi all,

I'm working on an android provider for surefire. Generally, I have things
working but have encountered a specific problem. The unit tests are running
remotely on a device (not the build machine). For the surefire xml report,
I need to pull in the system properties on the device, not those on the
build machine.

The StartupReportConfiguration.instantiateXmlReporter is hardcoded to
return XMLReporter. AbstractSurefireMojo.createForkStarter is, in turn,
hardcoded to use StartReportConfiguration.

So I'm unable to replace the StartReportConfiguration with a class
implementation that will return a specialized XMLReporter instance that
will return device system properties.

Is there a way to handle this situation through the surefire API or is this
something I need to create a patch for?

Thanks,
Shane
Reply | Threaded
Open this post in threaded view
|

Re: Maven SureFire Plugin: Android Provider

Kristian Rosenvold-4
I would somehow assume that the sensible way to implement an android
provider would be to extend the current forking logic to serialize the
entire fork to a remote machine. Furthermore there is already support
for bringing the system properties from the fork back to the plugin,
which would come for "free" in this case. I would be considering
starting the fork in/around the "ForkStarter" java class.

Something in your question makes me think you're starting the fork differently?

Kristian


2012/6/13 Shane Isbell <[hidden email]>:

> Hi all,
>
> I'm working on an android provider for surefire. Generally, I have things
> working but have encountered a specific problem. The unit tests are running
> remotely on a device (not the build machine). For the surefire xml report,
> I need to pull in the system properties on the device, not those on the
> build machine.
>
> The StartupReportConfiguration.instantiateXmlReporter is hardcoded to
> return XMLReporter. AbstractSurefireMojo.createForkStarter is, in turn,
> hardcoded to use StartReportConfiguration.
>
> So I'm unable to replace the StartReportConfiguration with a class
> implementation that will return a specialized XMLReporter instance that
> will return device system properties.
>
> Is there a way to handle this situation through the surefire API or is this
> something I need to create a patch for?
>
> Thanks,
> Shane

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Maven SureFire Plugin: Android Provider

Manfred Moser
In reply to this post by Shane Isbell
On Wed, June 13, 2012 12:17 pm, Shane Isbell wrote:
> Hi all,
>
> I'm working on an android provider for surefire. Generally, I have things
> working but have encountered a specific problem. The unit tests are
> running
> remotely on a device (not the build machine). For the surefire xml report,
> I need to pull in the system properties on the device, not those on the
> build machine.

If you use ddmlib you can pull them in via that api from the device to the
build machine. The android maven plugin actually already has a class that
does that as well as one that assembles the junit test report on the build
machine rather than the device .. which works much better. Ping me for
pointers since I wrote all that..

manfred
http://www.simpligility.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Maven SureFire Plugin: Android Provider

Shane Isbell
In reply to this post by Kristian Rosenvold-4
Android has it's own RemoteAndroidTestRunner, so I just invoke the
RemoteAndroidTestRunner.run method to kick off the Android junit tests.

Surefire has a report test lifecycle: testSetStarting, testFailed...These
methods map closely to the events in the RemoteAndroidTestRunner. So I just
created a simple mapping. For an early prototype see:

http://tinyurl.com/7rrv6cx

So I would prefer not to run surefire code directly on the device.

I follow the path:

AbstractSurefireMojo.executeProvider - >
AbstractSurefireMojo.createForkStarter ->
AbstractSurefireMojo.getStartupReportConfiguration - > ForkStarter.new

I just don't see how to configure the StartupReportConfiguration to return
a customized XMLReporter (this reporter implementation queries the device
for its system properties).

I'll keep digging around...but appreciate any further pointers.

Thanks,
Shane

On Wed, Jun 13, 2012 at 1:12 PM, Kristian Rosenvold <
[hidden email]> wrote:

> I would somehow assume that the sensible way to implement an android
> provider would be to extend the current forking logic to serialize the
> entire fork to a remote machine. Furthermore there is already support
> for bringing the system properties from the fork back to the plugin,
> which would come for "free" in this case. I would be considering
> starting the fork in/around the "ForkStarter" java class.
>
> Something in your question makes me think you're starting the fork
> differently?
>
> Kristian
>
>
> 2012/6/13 Shane Isbell <[hidden email]>:
> > Hi all,
> >
> > I'm working on an android provider for surefire. Generally, I have things
> > working but have encountered a specific problem. The unit tests are
> running
> > remotely on a device (not the build machine). For the surefire xml
> report,
> > I need to pull in the system properties on the device, not those on the
> > build machine.
> >
> > The StartupReportConfiguration.instantiateXmlReporter is hardcoded to
> > return XMLReporter. AbstractSurefireMojo.createForkStarter is, in turn,
> > hardcoded to use StartReportConfiguration.
> >
> > So I'm unable to replace the StartReportConfiguration with a class
> > implementation that will return a specialized XMLReporter instance that
> > will return device system properties.
> >
> > Is there a way to handle this situation through the surefire API or is
> this
> > something I need to create a patch for?
> >
> > Thanks,
> > Shane
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Maven SureFire Plugin: Android Provider

Shane Isbell
Thanks for the responses Kristian, Manfred. I did find that in the the
android provider I can specialize the StartupReportConfiguration class
(that returns custom xml reporter). Then I just use the
StartupReportConfiguration as a parameter in FileReporterFactory.new. The
reporter is then setup correctly.

Thanks,
Shane

On Wed, Jun 13, 2012 at 4:38 PM, Shane Isbell <[hidden email]>wrote:

> Android has it's own RemoteAndroidTestRunner, so I just invoke the
> RemoteAndroidTestRunner.run method to kick off the Android junit tests.
>
> Surefire has a report test lifecycle: testSetStarting, testFailed...These
> methods map closely to the events in the RemoteAndroidTestRunner. So I just
> created a simple mapping. For an early prototype see:
>
> http://tinyurl.com/7rrv6cx
>
> So I would prefer not to run surefire code directly on the device.
>
> I follow the path:
>
> AbstractSurefireMojo.executeProvider - >
> AbstractSurefireMojo.createForkStarter ->
> AbstractSurefireMojo.getStartupReportConfiguration - > ForkStarter.new
>
> I just don't see how to configure the StartupReportConfiguration to return
> a customized XMLReporter (this reporter implementation queries the device
> for its system properties).
>
> I'll keep digging around...but appreciate any further pointers.
>
> Thanks,
> Shane
>
>
> On Wed, Jun 13, 2012 at 1:12 PM, Kristian Rosenvold <
> [hidden email]> wrote:
>
>> I would somehow assume that the sensible way to implement an android
>> provider would be to extend the current forking logic to serialize the
>> entire fork to a remote machine. Furthermore there is already support
>> for bringing the system properties from the fork back to the plugin,
>> which would come for "free" in this case. I would be considering
>> starting the fork in/around the "ForkStarter" java class.
>>
>> Something in your question makes me think you're starting the fork
>> differently?
>>
>> Kristian
>>
>>
>> 2012/6/13 Shane Isbell <[hidden email]>:
>> > Hi all,
>> >
>> > I'm working on an android provider for surefire. Generally, I have
>> things
>> > working but have encountered a specific problem. The unit tests are
>> running
>> > remotely on a device (not the build machine). For the surefire xml
>> report,
>> > I need to pull in the system properties on the device, not those on the
>> > build machine.
>> >
>> > The StartupReportConfiguration.instantiateXmlReporter is hardcoded to
>> > return XMLReporter. AbstractSurefireMojo.createForkStarter is, in turn,
>> > hardcoded to use StartReportConfiguration.
>> >
>> > So I'm unable to replace the StartReportConfiguration with a class
>> > implementation that will return a specialized XMLReporter instance that
>> > will return device system properties.
>> >
>> > Is there a way to handle this situation through the surefire API or is
>> this
>> > something I need to create a patch for?
>> >
>> > Thanks,
>> > Shane
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Maven SureFire Plugin: Android Provider

Manfred Moser
Great... well done. This looks really good from my glance at the code..

manfred

On Thu, June 14, 2012 3:24 pm, Shane Isbell wrote:

> Thanks for the responses Kristian, Manfred. I did find that in the the
> android provider I can specialize the StartupReportConfiguration class
> (that returns custom xml reporter). Then I just use the
> StartupReportConfiguration as a parameter in FileReporterFactory.new. The
> reporter is then setup correctly.
>
> Thanks,
> Shane
>
> On Wed, Jun 13, 2012 at 4:38 PM, Shane Isbell
> <[hidden email]>wrote:
>
>> Android has it's own RemoteAndroidTestRunner, so I just invoke the
>> RemoteAndroidTestRunner.run method to kick off the Android junit tests.
>>
>> Surefire has a report test lifecycle: testSetStarting,
>> testFailed...These
>> methods map closely to the events in the RemoteAndroidTestRunner. So I
>> just
>> created a simple mapping. For an early prototype see:
>>
>> http://tinyurl.com/7rrv6cx
>>
>> So I would prefer not to run surefire code directly on the device.
>>
>> I follow the path:
>>
>> AbstractSurefireMojo.executeProvider - >
>> AbstractSurefireMojo.createForkStarter ->
>> AbstractSurefireMojo.getStartupReportConfiguration - > ForkStarter.new
>>
>> I just don't see how to configure the StartupReportConfiguration to
>> return
>> a customized XMLReporter (this reporter implementation queries the
>> device
>> for its system properties).
>>
>> I'll keep digging around...but appreciate any further pointers.
>>
>> Thanks,
>> Shane
>>
>>
>> On Wed, Jun 13, 2012 at 1:12 PM, Kristian Rosenvold <
>> [hidden email]> wrote:
>>
>>> I would somehow assume that the sensible way to implement an android
>>> provider would be to extend the current forking logic to serialize the
>>> entire fork to a remote machine. Furthermore there is already support
>>> for bringing the system properties from the fork back to the plugin,
>>> which would come for "free" in this case. I would be considering
>>> starting the fork in/around the "ForkStarter" java class.
>>>
>>> Something in your question makes me think you're starting the fork
>>> differently?
>>>
>>> Kristian
>>>
>>>
>>> 2012/6/13 Shane Isbell <[hidden email]>:
>>> > Hi all,
>>> >
>>> > I'm working on an android provider for surefire. Generally, I have
>>> things
>>> > working but have encountered a specific problem. The unit tests are
>>> running
>>> > remotely on a device (not the build machine). For the surefire xml
>>> report,
>>> > I need to pull in the system properties on the device, not those on
>>> the
>>> > build machine.
>>> >
>>> > The StartupReportConfiguration.instantiateXmlReporter is hardcoded to
>>> > return XMLReporter. AbstractSurefireMojo.createForkStarter is, in
>>> turn,
>>> > hardcoded to use StartReportConfiguration.
>>> >
>>> > So I'm unable to replace the StartReportConfiguration with a class
>>> > implementation that will return a specialized XMLReporter instance
>>> that
>>> > will return device system properties.
>>> >
>>> > Is there a way to handle this situation through the surefire API or
>>> is
>>> this
>>> > something I need to create a patch for?
>>> >
>>> > Thanks,
>>> > Shane
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]