Reputation: 12680
When I run buildr test
, it doesn't even build my packages. This seems like normal behaviour for Buildr, which probably thinks that the packages shouldn't be created until the code is verified to work.
Trouble is, I'm currently trying to fix an issue which only happens when the code is run from a jar. If I run my tests, they all pass, but the code doesn't work at all in production.
Therefore, I would to build the package before running the tests, and use only the package for the tests. This might also help continuous integration, where we like to separate compilation from testing, since testing is more easily divided into individual chunks.
Is there any way to do this?
(I thought that test.using :integration
would be the trick, but no... it prints out different information when it runs, but it still skips building the package and then proceeds to run against the bare files.)
Upvotes: 1
Views: 43
Reputation: 461
We do this by creating another project that has a dependency on the output of the first project and then test against that. i.e. An example from our integration testing looks something like
define 'myproject' do
...
define 'server' do
...
package(:jar)
end
...
define 'integration-tests' do
# Either add it as a dependency
test.with project('server').package(:jar)
# Or manually load jar so the classpath
# can be explicitly controlled and pass in system
# property to locate jar
test.enhance([project('server').package(:jar)])
test.using :properties =>
{
'jar.filename' => project('server').package(:jar).to_s,
}
end
Mostly we do this when testing war files but it should work fine for regular jars as well. Hope that helps!
Upvotes: 1