git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mass changes to various projects under Ant umbrella - should we be doing it?


2018-04-15 9:59 GMT+00:00 Stefan Bodewig <bodewig@xxxxxxxxxx>:

> On 2018-04-15, Gintautas Grigelionis wrote:
>
> > Could you please explain what alternative approach does the "root"
> > property support
>
> It has been added with
> https://github.com/apache/ant/commit/71333195c9d57d80d1a44cd8362a64
> 1c62d5e214
> and the commit message states the main use case "running tests from
> an arbitrary directory". I don't recall the details, you may want to
> look at the mailing list archive of December 2004.
>
> My main point is this is something that has been working for more than
> thirteen years and I don't want to break it for people who rely on it
> just because it makes running the tests from an IDE slightly
> inconvenient (by having to remember something).
>

Thanks for the pointer. The idea with assumptions is that they serve as a
reminder
and the way they should be used is by splitting the tests so that they are
executed or not dependent
on assumptions -- which makes test cases simple. See RmicTest, for example.

Moreover, the refactoring of tests is not about extracting repetitive code
into "smart" methods;
it's about parameterizing -- which is another nice thing about JUnit 4 --
and we'll be getting to that.
Yet another thing is splitting the tests in order to extract the fixtures
which belong to @Before.

> _and_ add assumptions checks, since it causes nasty NPEs when not set?
>
> IIRC the fallback would be to use the current working directory instead
> of the "root" property if the former is not set. We can easily deal with
> this by using
>
> System.getProperty("root", System.getProperty("user.dir"))
>
> instead, right?
>

Rather,

System.getProperty("root",
buildRule.getProject().getBaseDir().getAbsolutePath())

but, yeah, good point. Have to check if it works everywhere, though.

> By the looks of it, JUnit 5 runner tests need an assumption check, too.
>
> Not sure why, but I may again be missing something.
>

Please have a look at TeamCity tests at JetBrains. They start with a clean
directory, then run
ant -Ddest=optional -f fetch.xml, then ./build.sh test, and fail with

java.lang.Exception: No runnable methods


Gintas


( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-ant-development/msg01832.html on line 132
Call Stack
#TimeMemoryFunctionLocation
10.0006368728{main}( ).../msg01832.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-ant-development/msg01832.html on line 132
Call Stack
#TimeMemoryFunctionLocation
10.0006368728{main}( ).../msg01832.html:0