buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <martin.grot...@javakaffee.de>
Subject Re: Create junit reports from testng tests - pass additional args to testng
Date Sat, 01 Aug 2009 23:17:07 GMT
Hi,

now I want to pick this up...

I added
  cmd_args.concat(options[:args] || [])
to the run method of the TestNG TestFramework (see also [1]).

After that I was able to set custom args in my buildfile with
  test.using :args=>['-usedefaultlisteners', 'false', '-listener', 'org.testng.reporters.JUnitXMLReporter']

Unfortunately, the JUnitXMLReporter does not simply write to the
test.report_to path, but to <test.report_to> + <project.id>. This failed
because this directory does not exist.

Just to make the JUnitXMLReporter happy I added the line
  mkdir_p File.join(task.report_to.to_s, task.project.id)
to the run method of the TestNG TestFramework.

Of course this is not the right place for this. Right now I see two
options:
1) only create this directory if the JUnitXMLReporter listener is
specified in the args
2) provide a :junitreport option in the testng test framework that sets
the options shown above and creates the required directory.

None of them seems really good to me, but if I had to choose I'd prefer
2).

Do you see other solutions? What would you suggest/prefer?

Thanx && cheers,
Martin
  

[1] http://github.com/magro/buildr/commit/92a621057a6fd22274ac78e2f5ba64eafc03279c


On Wed, 2009-07-22 at 17:59 +0200, Martin Grotzke wrote:
> On Wed, 2009-07-22 at 01:55 -0700, Assaf Arkin wrote:
> > On Tue, Jul 21, 2009 at 4:36 PM, Martin Grotzke <
> > martin.grotzke@javakaffee.de> wrote:
> > 
> > > Hi,
> > >
> > > we want to get junit reports from testng tests, so that the junit
> > > reports can be processed by our build server (hudson).
> > >
> > > For this we want to pass additional arguments to testng
> > > ('-usedefaultlisteners', 'false', '-listeners',
> > > 'org.testng.reporters.JUnitXMLReporter').
> > >
> > > Is this possible using the existing using(options) approach?
> > 
> > 
> > http://buildr.apache.org/languages.html
> > 
> > Scroll down to the section that deals with TestNG specifically: you have
> > :properties and :java_args.  I don't think either one will do what you want.
> Correct, I already tried both, without luck.
> 
> So I would have to add support for an additional :args property to the
> test options, so that one could set e.g.
>   test.using(:args=>['arg1', 'arg2'])
> ?
> 
> Cheers,
> Martin
> 
> 
> > 
> > Assaf
> > 
> > 
> > >
> > >
> > > AFAICS it seems that this is currently not supported - at least one
> > > would need to get the additional args (e.g. using :args=>...) and add
> > > them as an array to the cmd_args.
> > >
> > > What do you think?
> > >
> > > Cheers,
> > > Martin
> > >
> > >

Mime
View raw message