Re: ant git commit: Add magic names for tests, run more tests in Surefire
On Mon, 29 Oct 2018 at 10:00, Stefan Bodewig wrote: > There is no cycle: core <- testutil <- tests of core > > It is just Maven's model that doesn't allow you to introduce test scope > dependencies that depend on your code under test. A model I disagree > with. > > So in the maven POMs we might be cheating Maven, but only because we > have to circumvent Maven's model which doesn't fit ours. > Maven wants to isolate each module [1]. This is where I went down the rabbit hole and lost sight of the bigger picture, namely, that POM build creates isolation on the fly (which is cheating on Maven :-), because I was thinking of launcher-core and core-junit interdependencies on the test level, and I'd still like to figure out a way of running all Ant tests in Surefire while producing artifacts corresponding to Ant build as closely as possible. Gintas [1] https://blog.sonatype.com/2010/01/how-to-create-two-jars-from-one-project-and-why-you-shouldnt/
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: > Even if running unit tests with different tools is a no-goal for you, it's > a good check of robustness -- ACK > I'm afraid we're cheating a little anyway by compiling testutil with core > tests first, and then building a separate jar file. This is only if you are willing to accept to the dependency model of Maven :-) To me there is no cheating. In my model we have Ant's core code. We have Ant Testutil which contains helpers and we have the tests for Ant's core which depend on both core and testutil. There is no cycle: core <- testutil <- tests of core It is just Maven's model that doesn't allow you to introduce test scope dependencies that depend on your code under test. A model I disagree with. So in the maven POMs we might be cheating Maven, but only because we have to circumvent Maven's model which doesn't fit ours. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-29, Gintautas Grigelionis wrote: >> Thanks, I'll merge it to master, then. > I've notice in Nightly that Ant treats MagicTestNames as a test, too. Uhm, it shouldn't. > Would it make sense to add a test method, checking for documented > properties? Adding a test that asserts the constants defined in the interface are defined? Sounds a bit backwards to me. For now I'll just ensure the tests aren't run. Thanks for the heads-up Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
> Thanks, I'll merge it to master, then. > I've notice in Nightly that Ant treats MagicTestNames as a test, too. Would it make sense to add a test method, checking for documented properties? Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: >> The tests for core fail for me (CommandlineJava) anyway. I think I've >> already said that running Ant's unit tests in Maven is a non-goal for me >> :-) > I'll have a closer look at it tomorrow, if you don't mind. Could you please > provide some details of your setup? Ubutu Linux 18.04, Oracle JDK 8 (1.8.0_171), Maven 3.5.4. > So your refactoring is fine. Thanks for bearing with me. Thanks, I'll merge it to master, then. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
> The tests for core fail for me (CommandlineJava) anyway. I think I've > already said that running Ant's unit tests in Maven is a non-goal for me > :-) > I'll have a closer look at it tomorrow, if you don't mind. Could you please provide some details of your setup? Even if running unit tests with different tools is a no-goal for you, it's a good check of robustness -- I noticed that the same tests which fail in Maven have a tendency to fail in IDE, too, and I'd like the possibility to run tests from IDE. Maybe that would also be of use should JUnit 5 be considered some day... As to the refactoring, I'm sorry I got carried away with all the dependency stuff. I'm afraid we're cheating a little anyway by compiling testutil with core tests first, and then building a separate jar file. So your refactoring is fine. Thanks for bearing with me. Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: > On Sun, 28 Oct 2018 at 21:02, Stefan Bodewig wrote: >> On 2018-10-28, Gintautas Grigelionis wrote: >>> On Sun, 28 Oct 2018 at 20:23, Stefan Bodewig wrote: I guess I need to create a branch to either convince you it is possible or convince me that it is not :-) >>> No branch is necessary, just activate launcher tests; the effect will be >>> the same. >> I'm afraid I can't follow you. >> What breaks in the remove-tests-constants-from-main-tree? >>> It is not a matter of test harness, either. It is a matter of >>> documentation and proper dependency management. >>> I'm only using a different tool to highlight the importance of the >>> latter (as far as running tests is concerned, anyway :-) >> And because of above I probably don't understand what you mean here >> either. > What I meant is the following: anyone who wishes to see the effect of > test dependencies can replace the bogus directory "testcases" with the > correct directory "tests/junit" in src/etc/poms/ant-launcher/pom.xml > (line 77, the definition of testSourceDirectory property). Which fails because the tests need the Os class - which is completely unrelated to the question where constants only used for tests are to be defined. > Then run "mvn -f src/etc/poms/pom.xml clean package" (what Jenkins > does). The tests for core fail for me (CommandlineJava) anyway. I think I've already said that running Ant's unit tests in Maven is a non-goal for me :-) > If test constants are removed from main, then Ant core must build yet > another jar containing test constants which would be a compile > dependency for the code in ant-testutil, No, just compile the constants as part of ant-testutil. That's what my branch does. > because Ant core in itself will not suffice. It is possible to cook > such a jar file using a Maven qualifier, and it will pollute every > build in the world which chooses to use Ant core. No such extra dependency is actually needed. > As the saying over here goes, "plague or cholera". Possibly. Our tests have never been designed to be run by a tool that allows test time deoendencies to influence the dependencies of non-test code. Please really take a look at my branch and explain why it cannot be done that way. I don't see any reason to keep test-only constants inside the main code base. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On Sun, 28 Oct 2018 at 21:02, Stefan Bodewig wrote: > On 2018-10-28, Gintautas Grigelionis wrote: > > On Sun, 28 Oct 2018 at 20:23, Stefan Bodewig wrote: > > >> I guess I need to create a branch to either convince you it is possible > >> or convince me that it is not :-) > > > No branch is necessary, just activate launcher tests; the effect will be > > the same. > > I'm afraid I can't follow you. > > What breaks in the remove-tests-constants-from-main-tree? > > > It is not a matter of test harness, either. It is a matter of > > documentation and proper dependency management. > > > I'm only using a different tool to highlight the importance of the > > latter (as far as running tests is concerned, anyway :-) > > And because of above I probably don't understand what you mean here > either. > What I meant is the following: anyone who wishes to see the effect of test dependencies can replace the bogus directory "testcases" with the correct directory "tests/junit" in src/etc/poms/ant-launcher/pom.xml (line 77, the definition of testSourceDirectory property). Then run "mvn -f src/etc/poms/pom.xml clean package" (what Jenkins does). If test constants are removed from main, then Ant core must build yet another jar containing test constants which would be a compile dependency for the code in ant-testutil, because Ant core in itself will not suffice. It is possible to cook such a jar file using a Maven qualifier, and it will pollute every build in the world which chooses to use Ant core. As the saying over here goes, "plague or cholera". Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: > On Sun, 28 Oct 2018 at 20:23, Stefan Bodewig wrote: >> I guess I need to create a branch to either convince you it is possible >> or convince me that it is not :-) > No branch is necessary, just activate launcher tests; the effect will be > the same. I'm afraid I can't follow you. What breaks in the remove-tests-constants-from-main-tree? > It is not a matter of test harness, either. It is a matter of > documentation and proper dependency management. > I'm only using a different tool to highlight the importance of the > latter (as far as running tests is concerned, anyway :-) And because of above I probably don't understand what you mean here either. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On Sun, 28 Oct 2018 at 20:23, Stefan Bodewig wrote: > On 2018-10-28, Gintautas Grigelionis wrote: > > On Sun, 28 Oct 2018 at 18:48, Stefan Bodewig wrote: > >> On 2018-10-28, Gintautas Grigelionis wrote: > >>> On Sun, 28 Oct 2018 at 18:17, Stefan Bodewig > wrote: > On 2018-10-28, Gintautas Grigelionis wrote: > > On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig > >> wrote: > > >> I wonder whether it wouldn't be a good idea to create a separate > class > >> for constants used during testing that lives in ant-testutil rather > >> than > >> poluting the "magic names" of Ant. > > > The problem is that should such class end up in ant-testutil, it > makes > ant > > dependent on ant-util and that creates a dependency loop. > > I'm talking about the "magic names" only used in tests. The four > properties with names that start with TEST_ should not be used inside > the rest of Ant, are they? > > >>> I understand your point. TEST_ properties are only for tests. But, the > >>> tests themselves are a part of Ant core. > > >> Are they? I really hope there are no test classes in ant.jar. > > >> The constants can be moved to the tests jar of Ant core (where Ant core > >> likely means org.apache.ant:ant in Maven speak) and ant-testutil. All > >> Maven artifacts that are not org.apache.ant:ant can have a test scope > >> dependency on ant-testutil. > > > > The scope does not matter, should the test constants be in ant-util, > there > > will be a dependency of ant on ant-testutil creating a loop. > > > Test classes in Ant core won't compile before ant-testutil is compiled > and > > packaged, which in turn would require ant to be compiled and packaged. > > I guess I need to create a branch to either convince you it is possible > or convince me that it is not :-) > No branch is necessary, just activate launcher tests; the effect will be the same. > > It's all nice and easy when there is a pile of code that can be compiled > at > > once and divided arbitrarily... not so simple when it has to be split > > beforehand (see my remarks on AssertionsTest depending JUnit tasks or > > launcher tests depending on Os). > > I'm not happy defining constants only used during testing in the main > source tree so that a build tool other than Ant can be used to run the > tests. Right now I believe this won't be necessary at all. > It is not a matter of test harness, either. It is a matter of documentation and proper dependency management. I'm only using a different tool to highlight the importance of the latter (as far as running tests is concerned, anyway :-) Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Stefan Bodewig wrote: > On 2018-10-28, Gintautas Grigelionis wrote: >> On Sun, 28 Oct 2018 at 18:48, Stefan Bodewig wrote: >>> On 2018-10-28, Gintautas Grigelionis wrote: On Sun, 28 Oct 2018 at 18:17, Stefan Bodewig wrote: > On 2018-10-28, Gintautas Grigelionis wrote: >> On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig >>> wrote: >>> I wonder whether it wouldn't be a good idea to create a separate class >>> for constants used during testing that lives in ant-testutil rather >>> than >>> poluting the "magic names" of Ant. >> The problem is that should such class end up in ant-testutil, it makes > ant >> dependent on ant-util and that creates a dependency loop. > I'm talking about the "magic names" only used in tests. The four > properties with names that start with TEST_ should not be used inside > the rest of Ant, are they? I understand your point. TEST_ properties are only for tests. But, the tests themselves are a part of Ant core. >>> Are they? I really hope there are no test classes in ant.jar. >>> The constants can be moved to the tests jar of Ant core (where Ant core >>> likely means org.apache.ant:ant in Maven speak) and ant-testutil. All >>> Maven artifacts that are not org.apache.ant:ant can have a test scope >>> dependency on ant-testutil. >> The scope does not matter, should the test constants be in ant-util, there >> will be a dependency of ant on ant-testutil creating a loop. >> Test classes in Ant core won't compile before ant-testutil is compiled and >> packaged, which in turn would require ant to be compiled and packaged. > I guess I need to create a branch to either convince you it is possibel > or convince me that it is not :-) See the branch remove-tests-constants-from-main-tree - actually it's been even easier that I tought as all classes that require the test constants are part of the tests run for the core artifact. If any of the other tests required the constants these other artifacts could have test-scope dependencies on ant-testutil (as testuitl itself only depends on core) so no loop would be created. But this doesn't even seem to be necessary. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: > On Sun, 28 Oct 2018 at 18:48, Stefan Bodewig wrote: >> On 2018-10-28, Gintautas Grigelionis wrote: >>> On Sun, 28 Oct 2018 at 18:17, Stefan Bodewig wrote: On 2018-10-28, Gintautas Grigelionis wrote: > On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig >> wrote: >> I wonder whether it wouldn't be a good idea to create a separate class >> for constants used during testing that lives in ant-testutil rather >> than >> poluting the "magic names" of Ant. > The problem is that should such class end up in ant-testutil, it makes ant > dependent on ant-util and that creates a dependency loop. I'm talking about the "magic names" only used in tests. The four properties with names that start with TEST_ should not be used inside the rest of Ant, are they? >>> I understand your point. TEST_ properties are only for tests. But, the >>> tests themselves are a part of Ant core. >> Are they? I really hope there are no test classes in ant.jar. >> The constants can be moved to the tests jar of Ant core (where Ant core >> likely means org.apache.ant:ant in Maven speak) and ant-testutil. All >> Maven artifacts that are not org.apache.ant:ant can have a test scope >> dependency on ant-testutil. > The scope does not matter, should the test constants be in ant-util, there > will be a dependency of ant on ant-testutil creating a loop. > Test classes in Ant core won't compile before ant-testutil is compiled and > packaged, which in turn would require ant to be compiled and packaged. I guess I need to create a branch to either convince you it is possibel or convince me that it is not :-) > It's all nice and easy when there is a pile of code that can be compiled at > once and divided arbitrarily... not so simple when it has to be split > beforehand (see my remarks on AssertionsTest depending JUnit tasks or > launcher tests depending on Os). I'm not happy defining constants only used during testing in the main source tree so that a build tool other than Ant can be used to run the tests. Right now I believe this won't be necessary at all. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On Sun, 28 Oct 2018 at 18:48, Stefan Bodewig wrote: > On 2018-10-28, Gintautas Grigelionis wrote: > > On Sun, 28 Oct 2018 at 18:17, Stefan Bodewig wrote: > >> On 2018-10-28, Gintautas Grigelionis wrote: > >>> On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig > wrote: > > I wonder whether it wouldn't be a good idea to create a separate class > for constants used during testing that lives in ant-testutil rather > than > poluting the "magic names" of Ant. > > >>> The problem is that should such class end up in ant-testutil, it makes > >> ant > >>> dependent on ant-util and that creates a dependency loop. > > >> I'm talking about the "magic names" only used in tests. The four > >> properties with names that start with TEST_ should not be used inside > >> the rest of Ant, are they? > > > I understand your point. TEST_ properties are only for tests. But, the > > tests themselves are a part of Ant core. > > Are they? I really hope there are no test classes in ant.jar. > > The constants can be moved to the tests jar of Ant core (where Ant core > likely means org.apache.ant:ant in Maven speak) and ant-testutil. All > Maven artifacts that are not org.apache.ant:ant can have a test scope > dependency on ant-testutil. > The scope does not matter, should the test constants be in ant-util, there will be a dependency of ant on ant-testutil creating a loop. Test classes in Ant core won't compile before ant-testutil is compiled and packaged, which in turn would require ant to be compiled and packaged. It's all nice and easy when there is a pile of code that can be compiled at once and divided arbitrarily... not so simple when it has to be split beforehand (see my remarks on AssertionsTest depending JUnit tasks or launcher tests depending on Os). Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: > On Sun, 28 Oct 2018 at 18:17, Stefan Bodewig wrote: >> On 2018-10-28, Gintautas Grigelionis wrote: >>> On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig wrote: I wonder whether it wouldn't be a good idea to create a separate class for constants used during testing that lives in ant-testutil rather than poluting the "magic names" of Ant. >>> The problem is that should such class end up in ant-testutil, it makes >> ant >>> dependent on ant-util and that creates a dependency loop. >> I'm talking about the "magic names" only used in tests. The four >> properties with names that start with TEST_ should not be used inside >> the rest of Ant, are they? > I understand your point. TEST_ properties are only for tests. But, the > tests themselves are a part of Ant core. Are they? I really hope there are no test classes in ant.jar. The constants can be moved to the tests jar of Ant core (where Ant core likely means org.apache.ant:ant in Maven speak) and ant-testutil. All Maven artifacts that are not org.apache.ant:ant can have a test scope dependency on ant-testutil. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On Sun, 28 Oct 2018 at 18:17, Stefan Bodewig wrote: > On 2018-10-28, Gintautas Grigelionis wrote: > > On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig wrote: > > >> I wonder whether it wouldn't be a good idea to create a separate class > >> for constants used during testing that lives in ant-testutil rather than > >> poluting the "magic names" of Ant. > > > The problem is that should such class end up in ant-testutil, it makes > ant > > dependent on ant-util and that creates a dependency loop. > > I'm talking about the "magic names" only used in tests. The four > properties with names that start with TEST_ should not be used inside > the rest of Ant, are they? > I understand your point. TEST_ properties are only for tests. But, the tests themselves are a part of Ant core. Therefore, a separate class (MagicTestNames or some such) would still be a part of Ant core. Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-28, Gintautas Grigelionis wrote: > On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig wrote: >> I wonder whether it wouldn't be a good idea to create a separate class >> for constants used during testing that lives in ant-testutil rather than >> poluting the "magic names" of Ant. > The problem is that should such class end up in ant-testutil, it makes ant > dependent on ant-util and that creates a dependency loop. I'm talking about the "magic names" only used in tests. The four properties with names that start with TEST_ shoul dnot be used inside the rest of Ant, are they? Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On Sun, 28 Oct 2018 at 17:59, Stefan Bodewig wrote: > On 2018-10-23, wrote: > > > > http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/main/org/apache/tools/ant/MagicNames.java > > >+/** > >+ * Magic property that makes unit tests based on BuildFileTest > >+ * or BuildFileRule ignore externally set basedir > >+ * (typically by Surefire/Failsafe) > >+ * > >+ * Value: {@value} > >+ * @since Ant 1.10.6 > >+ */ > >+public static final String TEST_BASEDIR_IGNORE = > "ant.test.basedir.ignore"; > > I wonder whether it wouldn't be a good idea to create a separate class > for constants used during testing that lives in ant-testutil rather than > poluting the "magic names" of Ant. > > Stefan > The problem is that should such class end up in ant-testutil, it makes ant dependent on ant-util and that creates a dependency loop. Gintas
Re: ant git commit: Add magic names for tests, run more tests in Surefire
On 2018-10-23, wrote: > http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/main/org/apache/tools/ant/MagicNames.java >+/** >+ * Magic property that makes unit tests based on BuildFileTest >+ * or BuildFileRule ignore externally set basedir >+ * (typically by Surefire/Failsafe) >+ * >+ * Value: {@value} >+ * @since Ant 1.10.6 >+ */ >+public static final String TEST_BASEDIR_IGNORE = >"ant.test.basedir.ignore"; I wonder whether it wouldn't be a good idea to create a separate class for constants used during testing that lives in ant-testutil rather than poluting the "magic names" of Ant. Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org