buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Odelya Holiday <ode...@alicanto.com>
Subject Re: Run tasks only if all the tests from all the projects ran successfully
Date Fri, 24 Aug 2012 11:12:09 GMT
Please see here:

https://github.com/Odelya/Buildr-examples


On Thu, Aug 23, 2012 at 6:26 PM, Alex Boisvert <alex.boisvert@gmail.com> wrote:
> I'll look into it when I get to a computer.  In the mean time, can you
> upload a sample project on github/wherever so we can take the guesswork out
> of the equation?
>
> On Thursday, August 23, 2012, Odelya Holiday wrote:
>
>> Thanks,
>>
>> But now there is another problem:
>>
>> If my junit tests threw an exception (like null pointer exception) -
>> the main_project:copy_files is not being invoked.
>>
>> But: if the assertion failed without an exception such as
>> junit.framework.AssertionFailedError: expected:<20> but was:<10>, the
>> copy_files is being invoked.
>>
>> My Junits are actually integration tests.
>>
>> What is wrong?
>>
>> On Thu, Aug 23, 2012 at 6:05 PM, Alex Boisvert <alex.boisvert@gmail.com<javascript:;>>
>> wrote:
>> > You need to add "main_project:copy_files" to your command-line (and you
>> can
>> > drop "build" and "integration" sînce they are implicit dependencies.
>> >
>> > On Thursday, August 23, 2012, Odelya Holiday wrote:
>> >
>> >> Sorry - my mistake - the task is not being invoked.
>> >>
>> >> I defined it like this:
>> >>
>> >> task :copy_files => [task(:integration)] do
>> >>   // copy the files
>> >> end
>> >>
>> >> And my call to buildr is:
>> >>
>> >> buildr clean build package integration test:Suite junit:report
>> >> test=all --verbose --trace
>> >>
>> >> Thanks
>> >>
>> >> On Wed, Aug 22, 2012 at 10:14 PM, Odelya Holiday <odelya@alicanto.com<javascript:;>
>> <javascript:;>>
>> >> wrote:
>> >> > Thanks
>> >> >
>> >> > Now it works perfectly.
>> >> >
>> >> > On Wed, Aug 22, 2012 at 10:03 PM, Alex Boisvert <
>> alex.boisvert@gmail.com <javascript:;><javascript:;>>
>> >> wrote:
>> >> >> Oh forgot you were using integration.
>> >> >>
>> >> >> In that case, you can create a new task that depends on the
>> integration
>> >> >> task,
>> >> >>
>> >> >> define :main_project do
>> >> >>   # sub projects
>> >> >>
>> >> >>   task :copy_files => [task(:integration)] do
>> >> >>     # do stuff
>> >> >>   end
>> >> >> end
>> >> >>
>> >> >> and then add this task on the command line:
>> >> >>
>> >> >> buildr [other targets] main_project:copy_files
>> >> >>
>> >> >> On Wed, Aug 22, 2012 at 11:52 AM, Odelya Holiday <
>> odelya@alicanto.com <javascript:;><javascript:;>
>> >> >wrote:
>> >> >>
>> >> >>> This is not working for me.
>> >> >>>
>> >> >>> since I see that the build task is extending BEFORE the integration
>> >> >>> tests. In my integration tests I create the test war that will
be
>> >> >>> copied to the real environment in case of success test.
>> >> >>>
>> >> >>> If I extend build, it is being invoked before the integration.setup
>> >> >>> method that I declared.
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> On Wed, Aug 22, 2012 at 6:50 PM, Alex Boisvert <
>> >> alex.boisvert@gmail.com <javascript:;> <javascript:;>>
>> >> >>> wrote:
>> >> >>> > On Wed, Aug 22, 2012 at 6:54 AM, Odelya Holiday <
>> odelya@alicanto.com <javascript:;><javascript:;>
>> >> >
>> >> >>> wrote:
>> >> >>> >
>> >> >>> >> I have 3 projects which are defined in my buildfile.
>> >> >>> >>
>> >> >>> >> I would like to define, that if all the tests passed
>> successfully,
>> >> it
>> >> >>> >> should do specific tasks. (copying files).
>> >> >>> >>
>> >> >>> >> So I declared in the main project definition:
>> >> >>> >>
>> >> >>> >>  test.using :fail_on_failure=>true
>> >> >>> >>
>> >> >>> >
>> >> >>> > By the way, :fail_on_failre is true by default, so you
don't need
>> to
>> >> >>> > specify this unless you want to set it to false.
>> >> >>> >
>> >> >>> > Hooking into the main project definition is the right
approach
>> since
>> >> it
>> >> >>> > implicitly depends on sub-projects.
>> >> >>> >
>> >> >>> >
>> >> >>> >> and extended the test task like this:
>> >> >>> >>
>> >> >>> >> test do |test_task|
>> >> >>> >> end
>> >> >>> >>
>> >> >>> >> however, I see that if 2 of the 3 tests succeeded,
the extended
>> task
>> >> >>> >> is being created.
>> >> >>> >>
>> >> >>> >> I would like it to be create only if all 3 succeeded.
>> >> >>> >>
>> >> >>> >
>> >> >>> > Instead of enhancing the test task, use the build task.
>> >> >>> >
>> >> >>> > build do
>> >> >>> >   # whatever you want
>> >> >>> > end
>> >> >>> >
>> >> >>> > The build task depends on the test (see default dependencies
>> >> >>> > here<
>> >> >>>
>> >>
>> https://cwiki.apache.org/confluence/display/BUILDR/12+Things+to+Know+About+Buildr
>> >> >>> >)
>> >> >>> > so it will only be run if all the tests pass.
>> >> >>> >
>> >> >>> > alex
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Odelya
>> >> >>>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Odelya
>> >>
>> >>
>> >>
>> >> --
>> >> Odelya
>> >>
>>
>>
>>
>> --
>> Odelya
>>



-- 
Odelya

Mime
View raw message