Proposal to modify the testing framework for OFBiz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Proposal to modify the testing framework for OFBiz

taher
Hello Everyone,

After refactoring the start component and while starting on the base
component I realized that the testing framework for OFBiz is not good. You
cannot do real test driven development or red-green-refactor with the
current setup, hence my proposal to change it. I explain below:

Problem with current design
----------------------------------------
- What we have right now is not unit tests, it's really integration tests.
You have to start the framework, the database, the service engine, the
entity engine and pretty much everything.
- Testing is very slow, because it's an integration test as I mentioned
above. 10 minutes on a good computer!
- There is zero mocking! We actually have to --load-data for things to
work. Again, these are integration tests.
- Too complex: Integration tests by their nature are grabbing too much.
Mind you, I am not objecting to integration tests (I actually like them)
but I am objecting to not having real unit-tests. Unit tests should all run
in a few seconds.

Proposed solution
--------------------------
- We keep what is considered real integration tests the way they are right
now and keep using them
- We move what should be unit tests into simple JUnit classes, and we do
not run them using java -jar ofbiz.jar --test, but instead run them
directly from the build.xml script, so these files are not identified in
any XML document, but are simply called immediately from the build scripts.
- We clearly mark the difference between integration tests and unit tests
(inside the source files or in the suite declarations).
- We change the run-tests target in build.xml to run both unit tests and
integration tests.

I intend to heavily refactor the framework and I would feel better about
introducing this change while refactoring. What do you guys think? Ideas?
Suggestions? Approvals and thumbs up?

Regards,

Taher Alkhateeb
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Pranay Pandey-3
Hi Taher,

There is one thing that I want to confirm based my understanding, as long
as I know, we can run tests independently as well e.g.

*Running tests for a component: *

java -jar ofbiz.jar -test component=‘order’

*Running a specific test Suite from a component:*

ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
ordertests'

*Running a test case from a component:*

java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'

I may be completely wrong here but just want to confirm and understand your
proposal.

Best regards,

Pranay Pandey
HotWax Systems
http://www.hotwaxsystems.com/

On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <[hidden email]>
wrote:

> Hello Everyone,
>
> After refactoring the start component and while starting on the base
> component I realized that the testing framework for OFBiz is not good. You
> cannot do real test driven development or red-green-refactor with the
> current setup, hence my proposal to change it. I explain below:
>
> Problem with current design
> ----------------------------------------
> - What we have right now is not unit tests, it's really integration tests.
> You have to start the framework, the database, the service engine, the
> entity engine and pretty much everything.
> - Testing is very slow, because it's an integration test as I mentioned
> above. 10 minutes on a good computer!
> - There is zero mocking! We actually have to --load-data for things to
> work. Again, these are integration tests.
> - Too complex: Integration tests by their nature are grabbing too much.
> Mind you, I am not objecting to integration tests (I actually like them)
> but I am objecting to not having real unit-tests. Unit tests should all run
> in a few seconds.
>
> Proposed solution
> --------------------------
> - We keep what is considered real integration tests the way they are right
> now and keep using them
> - We move what should be unit tests into simple JUnit classes, and we do
> not run them using java -jar ofbiz.jar --test, but instead run them
> directly from the build.xml script, so these files are not identified in
> any XML document, but are simply called immediately from the build scripts.
> - We clearly mark the difference between integration tests and unit tests
> (inside the source files or in the suite declarations).
> - We change the run-tests target in build.xml to run both unit tests and
> integration tests.
>
> I intend to heavily refactor the framework and I would feel better about
> introducing this change while refactoring. What do you guys think? Ideas?
> Suggestions? Approvals and thumbs up?
>
> Regards,
>
> Taher Alkhateeb
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Jacques Le Roux
Administrator
In reply to this post by taher
That sounds like a more than reasonable proposition to me

+ 1

Jacques


Le 08/06/2016 à 11:11, Taher Alkhateeb a écrit :

> Hello Everyone,
>
> After refactoring the start component and while starting on the base
> component I realized that the testing framework for OFBiz is not good. You
> cannot do real test driven development or red-green-refactor with the
> current setup, hence my proposal to change it. I explain below:
>
> Problem with current design
> ----------------------------------------
> - What we have right now is not unit tests, it's really integration tests.
> You have to start the framework, the database, the service engine, the
> entity engine and pretty much everything.
> - Testing is very slow, because it's an integration test as I mentioned
> above. 10 minutes on a good computer!
> - There is zero mocking! We actually have to --load-data for things to
> work. Again, these are integration tests.
> - Too complex: Integration tests by their nature are grabbing too much.
> Mind you, I am not objecting to integration tests (I actually like them)
> but I am objecting to not having real unit-tests. Unit tests should all run
> in a few seconds.
>
> Proposed solution
> --------------------------
> - We keep what is considered real integration tests the way they are right
> now and keep using them
> - We move what should be unit tests into simple JUnit classes, and we do
> not run them using java -jar ofbiz.jar --test, but instead run them
> directly from the build.xml script, so these files are not identified in
> any XML document, but are simply called immediately from the build scripts.
> - We clearly mark the difference between integration tests and unit tests
> (inside the source files or in the suite declarations).
> - We change the run-tests target in build.xml to run both unit tests and
> integration tests.
>
> I intend to heavily refactor the framework and I would feel better about
> introducing this change while refactoring. What do you guys think? Ideas?
> Suggestions? Approvals and thumbs up?
>
> Regards,
>
> Taher Alkhateeb
>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

taher
In reply to this post by Pranay Pandey-3
Hi Pranay,

What you are talking about is integration tests (ones that you can run per
component)

Unit tests do not need to be run per component. The entire unit test
library for the entire framework should run in probably less than 5
seconds. So there is no need to make them run per component.

My proposal is to simply have a target like run-unit-tests which would run
all the unit tests. These tests do not talk to the database or server or
anything, You can run them while flying in an airplane 30,000 feet above
the ocean.

Mind you I will not remove the integration tests, I'm just adding unit
tests (and probably moving some integration tests to unit tests).

Naturally, my proposition means that those tests are only JUnit tests (for
now) but that is a quick solution that I think is rather clean because
we're not really radically modifying anything, we're just adding JUnit
classes and running them.

Regards,

Taher Alkhateeb

On Wed, Jun 8, 2016 at 12:23 PM, Pranay Pandey <
[hidden email]> wrote:

> Hi Taher,
>
> There is one thing that I want to confirm based my understanding, as long
> as I know, we can run tests independently as well e.g.
>
> *Running tests for a component: *
>
> java -jar ofbiz.jar -test component=‘order’
>
> *Running a specific test Suite from a component:*
>
> ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
> ordertests'
>
> *Running a test case from a component:*
>
> java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'
>
> I may be completely wrong here but just want to confirm and understand your
> proposal.
>
> Best regards,
>
> Pranay Pandey
> HotWax Systems
> http://www.hotwaxsystems.com/
>
> On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <
> [hidden email]>
> wrote:
>
> > Hello Everyone,
> >
> > After refactoring the start component and while starting on the base
> > component I realized that the testing framework for OFBiz is not good.
> You
> > cannot do real test driven development or red-green-refactor with the
> > current setup, hence my proposal to change it. I explain below:
> >
> > Problem with current design
> > ----------------------------------------
> > - What we have right now is not unit tests, it's really integration
> tests.
> > You have to start the framework, the database, the service engine, the
> > entity engine and pretty much everything.
> > - Testing is very slow, because it's an integration test as I mentioned
> > above. 10 minutes on a good computer!
> > - There is zero mocking! We actually have to --load-data for things to
> > work. Again, these are integration tests.
> > - Too complex: Integration tests by their nature are grabbing too much.
> > Mind you, I am not objecting to integration tests (I actually like them)
> > but I am objecting to not having real unit-tests. Unit tests should all
> run
> > in a few seconds.
> >
> > Proposed solution
> > --------------------------
> > - We keep what is considered real integration tests the way they are
> right
> > now and keep using them
> > - We move what should be unit tests into simple JUnit classes, and we do
> > not run them using java -jar ofbiz.jar --test, but instead run them
> > directly from the build.xml script, so these files are not identified in
> > any XML document, but are simply called immediately from the build
> scripts.
> > - We clearly mark the difference between integration tests and unit tests
> > (inside the source files or in the suite declarations).
> > - We change the run-tests target in build.xml to run both unit tests and
> > integration tests.
> >
> > I intend to heavily refactor the framework and I would feel better about
> > introducing this change while refactoring. What do you guys think? Ideas?
> > Suggestions? Approvals and thumbs up?
> >
> > Regards,
> >
> > Taher Alkhateeb
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Gil Portenseigne
In reply to this post by Jacques Le Roux
Same here : +1

Gil

On 08/06/2016 11:24, Jacques Le Roux wrote:
That sounds like a more than reasonable proposition to me

+ 1

Jacques


Le 08/06/2016 à 11:11, Taher Alkhateeb a écrit :
Hello Everyone,

After refactoring the start component and while starting on the base
component I realized that the testing framework for OFBiz is not good. You
cannot do real test driven development or red-green-refactor with the
current setup, hence my proposal to change it. I explain below:

Problem with current design
----------------------------------------
- What we have right now is not unit tests, it's really integration tests.
You have to start the framework, the database, the service engine, the
entity engine and pretty much everything.
- Testing is very slow, because it's an integration test as I mentioned
above. 10 minutes on a good computer!
- There is zero mocking! We actually have to --load-data for things to
work. Again, these are integration tests.
- Too complex: Integration tests by their nature are grabbing too much.
Mind you, I am not objecting to integration tests (I actually like them)
but I am objecting to not having real unit-tests. Unit tests should all run
in a few seconds.

Proposed solution
--------------------------
- We keep what is considered real integration tests the way they are right
now and keep using them
- We move what should be unit tests into simple JUnit classes, and we do
not run them using java -jar ofbiz.jar --test, but instead run them
directly from the build.xml script, so these files are not identified in
any XML document, but are simply called immediately from the build scripts.
- We clearly mark the difference between integration tests and unit tests
(inside the source files or in the suite declarations).
- We change the run-tests target in build.xml to run both unit tests and
integration tests.

I intend to heavily refactor the framework and I would feel better about
introducing this change while refactoring. What do you guys think? Ideas?
Suggestions? Approvals and thumbs up?

Regards,

Taher Alkhateeb



Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Divesh Dutta-2
In reply to this post by taher
Hi Taher,

What I understand from your proposal is, we will like to test a small unit
which can be a Java method as well. And framework does not allows that. And
you want to introduce such support in framework . Is that what you mean ?

And if this what you are thinking, then I think its nice proposal.

Also this article by Martin Fowler on Unit test is good read:
http://martinfowler.com/bliki/UnitTest.html


Thanks
--
Divesh Dutta.

On Wed, Jun 8, 2016 at 3:02 PM, Taher Alkhateeb <[hidden email]>
wrote:

> Hi Pranay,
>
> What you are talking about is integration tests (ones that you can run per
> component)
>
> Unit tests do not need to be run per component. The entire unit test
> library for the entire framework should run in probably less than 5
> seconds. So there is no need to make them run per component.
>
> My proposal is to simply have a target like run-unit-tests which would run
> all the unit tests. These tests do not talk to the database or server or
> anything, You can run them while flying in an airplane 30,000 feet above
> the ocean.
>
> Mind you I will not remove the integration tests, I'm just adding unit
> tests (and probably moving some integration tests to unit tests).
>
> Naturally, my proposition means that those tests are only JUnit tests (for
> now) but that is a quick solution that I think is rather clean because
> we're not really radically modifying anything, we're just adding JUnit
> classes and running them.
>
> Regards,
>
> Taher Alkhateeb
>
> On Wed, Jun 8, 2016 at 12:23 PM, Pranay Pandey <
> [hidden email]> wrote:
>
> > Hi Taher,
> >
> > There is one thing that I want to confirm based my understanding, as long
> > as I know, we can run tests independently as well e.g.
> >
> > *Running tests for a component: *
> >
> > java -jar ofbiz.jar -test component=‘order’
> >
> > *Running a specific test Suite from a component:*
> >
> > ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
> > ordertests'
> >
> > *Running a test case from a component:*
> >
> > java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'
> >
> > I may be completely wrong here but just want to confirm and understand
> your
> > proposal.
> >
> > Best regards,
> >
> > Pranay Pandey
> > HotWax Systems
> > http://www.hotwaxsystems.com/
> >
> > On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <
> > [hidden email]>
> > wrote:
> >
> > > Hello Everyone,
> > >
> > > After refactoring the start component and while starting on the base
> > > component I realized that the testing framework for OFBiz is not good.
> > You
> > > cannot do real test driven development or red-green-refactor with the
> > > current setup, hence my proposal to change it. I explain below:
> > >
> > > Problem with current design
> > > ----------------------------------------
> > > - What we have right now is not unit tests, it's really integration
> > tests.
> > > You have to start the framework, the database, the service engine, the
> > > entity engine and pretty much everything.
> > > - Testing is very slow, because it's an integration test as I mentioned
> > > above. 10 minutes on a good computer!
> > > - There is zero mocking! We actually have to --load-data for things to
> > > work. Again, these are integration tests.
> > > - Too complex: Integration tests by their nature are grabbing too much.
> > > Mind you, I am not objecting to integration tests (I actually like
> them)
> > > but I am objecting to not having real unit-tests. Unit tests should all
> > run
> > > in a few seconds.
> > >
> > > Proposed solution
> > > --------------------------
> > > - We keep what is considered real integration tests the way they are
> > right
> > > now and keep using them
> > > - We move what should be unit tests into simple JUnit classes, and we
> do
> > > not run them using java -jar ofbiz.jar --test, but instead run them
> > > directly from the build.xml script, so these files are not identified
> in
> > > any XML document, but are simply called immediately from the build
> > scripts.
> > > - We clearly mark the difference between integration tests and unit
> tests
> > > (inside the source files or in the suite declarations).
> > > - We change the run-tests target in build.xml to run both unit tests
> and
> > > integration tests.
> > >
> > > I intend to heavily refactor the framework and I would feel better
> about
> > > introducing this change while refactoring. What do you guys think?
> Ideas?
> > > Suggestions? Approvals and thumbs up?
> > >
> > > Regards,
> > >
> > > Taher Alkhateeb
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

taher
Hi Divesh,

Yes correct. To give you a metaphor, think of integration tests as taking
your car and driving it to make sure it works, and think of unit tests like
checking your car engine piece by piece in isolation by measuring and
inspecting every piece by itself.

You can read here for more information:
http://www.jamesshore.com/Blog/Red-Green-Refactor.html
https://en.wikipedia.org/wiki/Test-driven_development

Regards,

Taher Alkhateeb

On Wed, Jun 8, 2016 at 1:07 PM, Divesh Dutta <[hidden email]
> wrote:

> Hi Taher,
>
> What I understand from your proposal is, we will like to test a small unit
> which can be a Java method as well. And framework does not allows that. And
> you want to introduce such support in framework . Is that what you mean ?
>
> And if this what you are thinking, then I think its nice proposal.
>
> Also this article by Martin Fowler on Unit test is good read:
> http://martinfowler.com/bliki/UnitTest.html
>
>
> Thanks
> --
> Divesh Dutta.
>
> On Wed, Jun 8, 2016 at 3:02 PM, Taher Alkhateeb <
> [hidden email]>
> wrote:
>
> > Hi Pranay,
> >
> > What you are talking about is integration tests (ones that you can run
> per
> > component)
> >
> > Unit tests do not need to be run per component. The entire unit test
> > library for the entire framework should run in probably less than 5
> > seconds. So there is no need to make them run per component.
> >
> > My proposal is to simply have a target like run-unit-tests which would
> run
> > all the unit tests. These tests do not talk to the database or server or
> > anything, You can run them while flying in an airplane 30,000 feet above
> > the ocean.
> >
> > Mind you I will not remove the integration tests, I'm just adding unit
> > tests (and probably moving some integration tests to unit tests).
> >
> > Naturally, my proposition means that those tests are only JUnit tests
> (for
> > now) but that is a quick solution that I think is rather clean because
> > we're not really radically modifying anything, we're just adding JUnit
> > classes and running them.
> >
> > Regards,
> >
> > Taher Alkhateeb
> >
> > On Wed, Jun 8, 2016 at 12:23 PM, Pranay Pandey <
> > [hidden email]> wrote:
> >
> > > Hi Taher,
> > >
> > > There is one thing that I want to confirm based my understanding, as
> long
> > > as I know, we can run tests independently as well e.g.
> > >
> > > *Running tests for a component: *
> > >
> > > java -jar ofbiz.jar -test component=‘order’
> > >
> > > *Running a specific test Suite from a component:*
> > >
> > > ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
> > > ordertests'
> > >
> > > *Running a test case from a component:*
> > >
> > > java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'
> > >
> > > I may be completely wrong here but just want to confirm and understand
> > your
> > > proposal.
> > >
> > > Best regards,
> > >
> > > Pranay Pandey
> > > HotWax Systems
> > > http://www.hotwaxsystems.com/
> > >
> > > On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <
> > > [hidden email]>
> > > wrote:
> > >
> > > > Hello Everyone,
> > > >
> > > > After refactoring the start component and while starting on the base
> > > > component I realized that the testing framework for OFBiz is not
> good.
> > > You
> > > > cannot do real test driven development or red-green-refactor with the
> > > > current setup, hence my proposal to change it. I explain below:
> > > >
> > > > Problem with current design
> > > > ----------------------------------------
> > > > - What we have right now is not unit tests, it's really integration
> > > tests.
> > > > You have to start the framework, the database, the service engine,
> the
> > > > entity engine and pretty much everything.
> > > > - Testing is very slow, because it's an integration test as I
> mentioned
> > > > above. 10 minutes on a good computer!
> > > > - There is zero mocking! We actually have to --load-data for things
> to
> > > > work. Again, these are integration tests.
> > > > - Too complex: Integration tests by their nature are grabbing too
> much.
> > > > Mind you, I am not objecting to integration tests (I actually like
> > them)
> > > > but I am objecting to not having real unit-tests. Unit tests should
> all
> > > run
> > > > in a few seconds.
> > > >
> > > > Proposed solution
> > > > --------------------------
> > > > - We keep what is considered real integration tests the way they are
> > > right
> > > > now and keep using them
> > > > - We move what should be unit tests into simple JUnit classes, and we
> > do
> > > > not run them using java -jar ofbiz.jar --test, but instead run them
> > > > directly from the build.xml script, so these files are not identified
> > in
> > > > any XML document, but are simply called immediately from the build
> > > scripts.
> > > > - We clearly mark the difference between integration tests and unit
> > tests
> > > > (inside the source files or in the suite declarations).
> > > > - We change the run-tests target in build.xml to run both unit tests
> > and
> > > > integration tests.
> > > >
> > > > I intend to heavily refactor the framework and I would feel better
> > about
> > > > introducing this change while refactoring. What do you guys think?
> > Ideas?
> > > > Suggestions? Approvals and thumbs up?
> > > >
> > > > Regards,
> > > >
> > > > Taher Alkhateeb
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Pranay Pandey-3
In reply to this post by taher
thanks so much Taher for the explaining it further, makes perfect sense.


Best regards,

Pranay Pandey
HotWax Systems
http://www.hotwaxsystems.com/

On Wed, Jun 8, 2016 at 3:02 PM, Taher Alkhateeb <[hidden email]>
wrote:

> Hi Pranay,
>
> What you are talking about is integration tests (ones that you can run per
> component)
>
> Unit tests do not need to be run per component. The entire unit test
> library for the entire framework should run in probably less than 5
> seconds. So there is no need to make them run per component.
>
> My proposal is to simply have a target like run-unit-tests which would run
> all the unit tests. These tests do not talk to the database or server or
> anything, You can run them while flying in an airplane 30,000 feet above
> the ocean.
>
> Mind you I will not remove the integration tests, I'm just adding unit
> tests (and probably moving some integration tests to unit tests).
>
> Naturally, my proposition means that those tests are only JUnit tests (for
> now) but that is a quick solution that I think is rather clean because
> we're not really radically modifying anything, we're just adding JUnit
> classes and running them.
>
> Regards,
>
> Taher Alkhateeb
>
> On Wed, Jun 8, 2016 at 12:23 PM, Pranay Pandey <
> [hidden email]> wrote:
>
> > Hi Taher,
> >
> > There is one thing that I want to confirm based my understanding, as long
> > as I know, we can run tests independently as well e.g.
> >
> > *Running tests for a component: *
> >
> > java -jar ofbiz.jar -test component=‘order’
> >
> > *Running a specific test Suite from a component:*
> >
> > ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
> > ordertests'
> >
> > *Running a test case from a component:*
> >
> > java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'
> >
> > I may be completely wrong here but just want to confirm and understand
> your
> > proposal.
> >
> > Best regards,
> >
> > Pranay Pandey
> > HotWax Systems
> > http://www.hotwaxsystems.com/
> >
> > On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <
> > [hidden email]>
> > wrote:
> >
> > > Hello Everyone,
> > >
> > > After refactoring the start component and while starting on the base
> > > component I realized that the testing framework for OFBiz is not good.
> > You
> > > cannot do real test driven development or red-green-refactor with the
> > > current setup, hence my proposal to change it. I explain below:
> > >
> > > Problem with current design
> > > ----------------------------------------
> > > - What we have right now is not unit tests, it's really integration
> > tests.
> > > You have to start the framework, the database, the service engine, the
> > > entity engine and pretty much everything.
> > > - Testing is very slow, because it's an integration test as I mentioned
> > > above. 10 minutes on a good computer!
> > > - There is zero mocking! We actually have to --load-data for things to
> > > work. Again, these are integration tests.
> > > - Too complex: Integration tests by their nature are grabbing too much.
> > > Mind you, I am not objecting to integration tests (I actually like
> them)
> > > but I am objecting to not having real unit-tests. Unit tests should all
> > run
> > > in a few seconds.
> > >
> > > Proposed solution
> > > --------------------------
> > > - We keep what is considered real integration tests the way they are
> > right
> > > now and keep using them
> > > - We move what should be unit tests into simple JUnit classes, and we
> do
> > > not run them using java -jar ofbiz.jar --test, but instead run them
> > > directly from the build.xml script, so these files are not identified
> in
> > > any XML document, but are simply called immediately from the build
> > scripts.
> > > - We clearly mark the difference between integration tests and unit
> tests
> > > (inside the source files or in the suite declarations).
> > > - We change the run-tests target in build.xml to run both unit tests
> and
> > > integration tests.
> > >
> > > I intend to heavily refactor the framework and I would feel better
> about
> > > introducing this change while refactoring. What do you guys think?
> Ideas?
> > > Suggestions? Approvals and thumbs up?
> > >
> > > Regards,
> > >
> > > Taher Alkhateeb
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Nicolas Malin-2
I'm on the same case, +1

Le 08/06/2016 13:42, Pranay Pandey a écrit :

> thanks so much Taher for the explaining it further, makes perfect sense.
>
>
> Best regards,
>
> Pranay Pandey
> HotWax Systems
> http://www.hotwaxsystems.com/
>
> On Wed, Jun 8, 2016 at 3:02 PM, Taher Alkhateeb <[hidden email]>
> wrote:
>
>> Hi Pranay,
>>
>> What you are talking about is integration tests (ones that you can run per
>> component)
>>
>> Unit tests do not need to be run per component. The entire unit test
>> library for the entire framework should run in probably less than 5
>> seconds. So there is no need to make them run per component.
>>
>> My proposal is to simply have a target like run-unit-tests which would run
>> all the unit tests. These tests do not talk to the database or server or
>> anything, You can run them while flying in an airplane 30,000 feet above
>> the ocean.
>>
>> Mind you I will not remove the integration tests, I'm just adding unit
>> tests (and probably moving some integration tests to unit tests).
>>
>> Naturally, my proposition means that those tests are only JUnit tests (for
>> now) but that is a quick solution that I think is rather clean because
>> we're not really radically modifying anything, we're just adding JUnit
>> classes and running them.
>>
>> Regards,
>>
>> Taher Alkhateeb
>>
>> On Wed, Jun 8, 2016 at 12:23 PM, Pranay Pandey <
>> [hidden email]> wrote:
>>
>>> Hi Taher,
>>>
>>> There is one thing that I want to confirm based my understanding, as long
>>> as I know, we can run tests independently as well e.g.
>>>
>>> *Running tests for a component: *
>>>
>>> java -jar ofbiz.jar -test component=‘order’
>>>
>>> *Running a specific test Suite from a component:*
>>>
>>> ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
>>> ordertests'
>>>
>>> *Running a test case from a component:*
>>>
>>> java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'
>>>
>>> I may be completely wrong here but just want to confirm and understand
>> your
>>> proposal.
>>>
>>> Best regards,
>>>
>>> Pranay Pandey
>>> HotWax Systems
>>> http://www.hotwaxsystems.com/
>>>
>>> On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <
>>> [hidden email]>
>>> wrote:
>>>
>>>> Hello Everyone,
>>>>
>>>> After refactoring the start component and while starting on the base
>>>> component I realized that the testing framework for OFBiz is not good.
>>> You
>>>> cannot do real test driven development or red-green-refactor with the
>>>> current setup, hence my proposal to change it. I explain below:
>>>>
>>>> Problem with current design
>>>> ----------------------------------------
>>>> - What we have right now is not unit tests, it's really integration
>>> tests.
>>>> You have to start the framework, the database, the service engine, the
>>>> entity engine and pretty much everything.
>>>> - Testing is very slow, because it's an integration test as I mentioned
>>>> above. 10 minutes on a good computer!
>>>> - There is zero mocking! We actually have to --load-data for things to
>>>> work. Again, these are integration tests.
>>>> - Too complex: Integration tests by their nature are grabbing too much.
>>>> Mind you, I am not objecting to integration tests (I actually like
>> them)
>>>> but I am objecting to not having real unit-tests. Unit tests should all
>>> run
>>>> in a few seconds.
>>>>
>>>> Proposed solution
>>>> --------------------------
>>>> - We keep what is considered real integration tests the way they are
>>> right
>>>> now and keep using them
>>>> - We move what should be unit tests into simple JUnit classes, and we
>> do
>>>> not run them using java -jar ofbiz.jar --test, but instead run them
>>>> directly from the build.xml script, so these files are not identified
>> in
>>>> any XML document, but are simply called immediately from the build
>>> scripts.
>>>> - We clearly mark the difference between integration tests and unit
>> tests
>>>> (inside the source files or in the suite declarations).
>>>> - We change the run-tests target in build.xml to run both unit tests
>> and
>>>> integration tests.
>>>>
>>>> I intend to heavily refactor the framework and I would feel better
>> about
>>>> introducing this change while refactoring. What do you guys think?
>> Ideas?
>>>> Suggestions? Approvals and thumbs up?
>>>>
>>>> Regards,
>>>>
>>>> Taher Alkhateeb
>>>>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Pierre Smits
+1

I suggest the first thing to start with is bring the proposed solution over
to an improvement issue in JIRA and work from there.

Best regards,

Pierre Smits

ORRTIZ.COM <http://www.orrtiz.com>
OFBiz based solutions & services

OFBiz Extensions Marketplace
http://oem.ofbizci.net/oci-2/

On Wed, Jun 8, 2016 at 1:45 PM, Nicolas Malin <[hidden email]>
wrote:

> I'm on the same case, +1
>
>
> Le 08/06/2016 13:42, Pranay Pandey a écrit :
>
>> thanks so much Taher for the explaining it further, makes perfect sense.
>>
>>
>> Best regards,
>>
>> Pranay Pandey
>> HotWax Systems
>> http://www.hotwaxsystems.com/
>>
>> On Wed, Jun 8, 2016 at 3:02 PM, Taher Alkhateeb <
>> [hidden email]>
>> wrote:
>>
>> Hi Pranay,
>>>
>>> What you are talking about is integration tests (ones that you can run
>>> per
>>> component)
>>>
>>> Unit tests do not need to be run per component. The entire unit test
>>> library for the entire framework should run in probably less than 5
>>> seconds. So there is no need to make them run per component.
>>>
>>> My proposal is to simply have a target like run-unit-tests which would
>>> run
>>> all the unit tests. These tests do not talk to the database or server or
>>> anything, You can run them while flying in an airplane 30,000 feet above
>>> the ocean.
>>>
>>> Mind you I will not remove the integration tests, I'm just adding unit
>>> tests (and probably moving some integration tests to unit tests).
>>>
>>> Naturally, my proposition means that those tests are only JUnit tests
>>> (for
>>> now) but that is a quick solution that I think is rather clean because
>>> we're not really radically modifying anything, we're just adding JUnit
>>> classes and running them.
>>>
>>> Regards,
>>>
>>> Taher Alkhateeb
>>>
>>> On Wed, Jun 8, 2016 at 12:23 PM, Pranay Pandey <
>>> [hidden email]> wrote:
>>>
>>> Hi Taher,
>>>>
>>>> There is one thing that I want to confirm based my understanding, as
>>>> long
>>>> as I know, we can run tests independently as well e.g.
>>>>
>>>> *Running tests for a component: *
>>>>
>>>> java -jar ofbiz.jar -test component=‘order’
>>>>
>>>> *Running a specific test Suite from a component:*
>>>>
>>>> ant run-single-test-suite -Dtest.component=‘order’ -Dtest.suiteName='
>>>> ordertests'
>>>>
>>>> *Running a test case from a component:*
>>>>
>>>> java -jar ofbiz.jar -test -component='order' -case='salesOrder-test'
>>>>
>>>> I may be completely wrong here but just want to confirm and understand
>>>>
>>> your
>>>
>>>> proposal.
>>>>
>>>> Best regards,
>>>>
>>>> Pranay Pandey
>>>> HotWax Systems
>>>> http://www.hotwaxsystems.com/
>>>>
>>>> On Wed, Jun 8, 2016 at 2:41 PM, Taher Alkhateeb <
>>>> [hidden email]>
>>>> wrote:
>>>>
>>>> Hello Everyone,
>>>>>
>>>>> After refactoring the start component and while starting on the base
>>>>> component I realized that the testing framework for OFBiz is not good.
>>>>>
>>>> You
>>>>
>>>>> cannot do real test driven development or red-green-refactor with the
>>>>> current setup, hence my proposal to change it. I explain below:
>>>>>
>>>>> Problem with current design
>>>>> ----------------------------------------
>>>>> - What we have right now is not unit tests, it's really integration
>>>>>
>>>> tests.
>>>>
>>>>> You have to start the framework, the database, the service engine, the
>>>>> entity engine and pretty much everything.
>>>>> - Testing is very slow, because it's an integration test as I mentioned
>>>>> above. 10 minutes on a good computer!
>>>>> - There is zero mocking! We actually have to --load-data for things to
>>>>> work. Again, these are integration tests.
>>>>> - Too complex: Integration tests by their nature are grabbing too much.
>>>>> Mind you, I am not objecting to integration tests (I actually like
>>>>>
>>>> them)
>>>
>>>> but I am objecting to not having real unit-tests. Unit tests should all
>>>>>
>>>> run
>>>>
>>>>> in a few seconds.
>>>>>
>>>>> Proposed solution
>>>>> --------------------------
>>>>> - We keep what is considered real integration tests the way they are
>>>>>
>>>> right
>>>>
>>>>> now and keep using them
>>>>> - We move what should be unit tests into simple JUnit classes, and we
>>>>>
>>>> do
>>>
>>>> not run them using java -jar ofbiz.jar --test, but instead run them
>>>>> directly from the build.xml script, so these files are not identified
>>>>>
>>>> in
>>>
>>>> any XML document, but are simply called immediately from the build
>>>>>
>>>> scripts.
>>>>
>>>>> - We clearly mark the difference between integration tests and unit
>>>>>
>>>> tests
>>>
>>>> (inside the source files or in the suite declarations).
>>>>> - We change the run-tests target in build.xml to run both unit tests
>>>>>
>>>> and
>>>
>>>> integration tests.
>>>>>
>>>>> I intend to heavily refactor the framework and I would feel better
>>>>>
>>>> about
>>>
>>>> introducing this change while refactoring. What do you guys think?
>>>>>
>>>> Ideas?
>>>
>>>> Suggestions? Approvals and thumbs up?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Taher Alkhateeb
>>>>>
>>>>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Jacopo Cappellato-5
In reply to this post by taher
Totally agree that what we have right now is a set of integration tests,
not unit tests.
Big +1 to the proposal to implement unit tests and mocking.

Jacopo

On Wed, Jun 8, 2016 at 11:11 AM, Taher Alkhateeb <[hidden email]
> wrote:

> Hello Everyone,
>
> After refactoring the start component and while starting on the base
> component I realized that the testing framework for OFBiz is not good. You
> cannot do real test driven development or red-green-refactor with the
> current setup, hence my proposal to change it. I explain below:
>
> Problem with current design
> ----------------------------------------
> - What we have right now is not unit tests, it's really integration tests.
> You have to start the framework, the database, the service engine, the
> entity engine and pretty much everything.
> - Testing is very slow, because it's an integration test as I mentioned
> above. 10 minutes on a good computer!
> - There is zero mocking! We actually have to --load-data for things to
> work. Again, these are integration tests.
> - Too complex: Integration tests by their nature are grabbing too much.
> Mind you, I am not objecting to integration tests (I actually like them)
> but I am objecting to not having real unit-tests. Unit tests should all run
> in a few seconds.
>
> Proposed solution
> --------------------------
> - We keep what is considered real integration tests the way they are right
> now and keep using them
> - We move what should be unit tests into simple JUnit classes, and we do
> not run them using java -jar ofbiz.jar --test, but instead run them
> directly from the build.xml script, so these files are not identified in
> any XML document, but are simply called immediately from the build scripts.
> - We clearly mark the difference between integration tests and unit tests
> (inside the source files or in the suite declarations).
> - We change the run-tests target in build.xml to run both unit tests and
> integration tests.
>
> I intend to heavily refactor the framework and I would feel better about
> introducing this change while refactoring. What do you guys think? Ideas?
> Suggestions? Approvals and thumbs up?
>
> Regards,
>
> Taher Alkhateeb
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Mridul Pathak-4
In reply to this post by taher
+1

Makes perfect sense.

--
Thanks & Regards,
Mridul Pathak
Senior Manager
HotWax Systems
http://www.hotwaxsystems.com

> On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <[hidden email]> wrote:
>
> Hello Everyone,
>
> After refactoring the start component and while starting on the base
> component I realized that the testing framework for OFBiz is not good. You
> cannot do real test driven development or red-green-refactor with the
> current setup, hence my proposal to change it. I explain below:
>
> Problem with current design
> ----------------------------------------
> - What we have right now is not unit tests, it's really integration tests.
> You have to start the framework, the database, the service engine, the
> entity engine and pretty much everything.
> - Testing is very slow, because it's an integration test as I mentioned
> above. 10 minutes on a good computer!
> - There is zero mocking! We actually have to --load-data for things to
> work. Again, these are integration tests.
> - Too complex: Integration tests by their nature are grabbing too much.
> Mind you, I am not objecting to integration tests (I actually like them)
> but I am objecting to not having real unit-tests. Unit tests should all run
> in a few seconds.
>
> Proposed solution
> --------------------------
> - We keep what is considered real integration tests the way they are right
> now and keep using them
> - We move what should be unit tests into simple JUnit classes, and we do
> not run them using java -jar ofbiz.jar --test, but instead run them
> directly from the build.xml script, so these files are not identified in
> any XML document, but are simply called immediately from the build scripts.
> - We clearly mark the difference between integration tests and unit tests
> (inside the source files or in the suite declarations).
> - We change the run-tests target in build.xml to run both unit tests and
> integration tests.
>
> I intend to heavily refactor the framework and I would feel better about
> introducing this change while refactoring. What do you guys think? Ideas?
> Suggestions? Approvals and thumbs up?
>
> Regards,
>
> Taher Alkhateeb

Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Deepak Dixit-3
+1

Thanks & Regards
--
Deepak Dixit
www.hotwaxsystems.com

On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
[hidden email]> wrote:

> +1
>
> Makes perfect sense.
>
> --
> Thanks & Regards,
> Mridul Pathak
> Senior Manager
> HotWax Systems
> http://www.hotwaxsystems.com
>
> > On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <[hidden email]>
> wrote:
> >
> > Hello Everyone,
> >
> > After refactoring the start component and while starting on the base
> > component I realized that the testing framework for OFBiz is not good.
> You
> > cannot do real test driven development or red-green-refactor with the
> > current setup, hence my proposal to change it. I explain below:
> >
> > Problem with current design
> > ----------------------------------------
> > - What we have right now is not unit tests, it's really integration
> tests.
> > You have to start the framework, the database, the service engine, the
> > entity engine and pretty much everything.
> > - Testing is very slow, because it's an integration test as I mentioned
> > above. 10 minutes on a good computer!
> > - There is zero mocking! We actually have to --load-data for things to
> > work. Again, these are integration tests.
> > - Too complex: Integration tests by their nature are grabbing too much.
> > Mind you, I am not objecting to integration tests (I actually like them)
> > but I am objecting to not having real unit-tests. Unit tests should all
> run
> > in a few seconds.
> >
> > Proposed solution
> > --------------------------
> > - We keep what is considered real integration tests the way they are
> right
> > now and keep using them
> > - We move what should be unit tests into simple JUnit classes, and we do
> > not run them using java -jar ofbiz.jar --test, but instead run them
> > directly from the build.xml script, so these files are not identified in
> > any XML document, but are simply called immediately from the build
> scripts.
> > - We clearly mark the difference between integration tests and unit tests
> > (inside the source files or in the suite declarations).
> > - We change the run-tests target in build.xml to run both unit tests and
> > integration tests.
> >
> > I intend to heavily refactor the framework and I would feel better about
> > introducing this change while refactoring. What do you guys think? Ideas?
> > Suggestions? Approvals and thumbs up?
> >
> > Regards,
> >
> > Taher Alkhateeb
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

taher
Hi Everyone,

Thank you all for your support, JIRA created in
https://issues.apache.org/jira/browse/OFBIZ-7254

I will start working on it and try to implement ASAP to get my focus back
on refactoring.

Cheers!

Taher Alkhateeb

On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <[hidden email]
> wrote:

> +1
>
> Thanks & Regards
> --
> Deepak Dixit
> www.hotwaxsystems.com
>
> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
> [hidden email]> wrote:
>
> > +1
> >
> > Makes perfect sense.
> >
> > --
> > Thanks & Regards,
> > Mridul Pathak
> > Senior Manager
> > HotWax Systems
> > http://www.hotwaxsystems.com
> >
> > > On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
> [hidden email]>
> > wrote:
> > >
> > > Hello Everyone,
> > >
> > > After refactoring the start component and while starting on the base
> > > component I realized that the testing framework for OFBiz is not good.
> > You
> > > cannot do real test driven development or red-green-refactor with the
> > > current setup, hence my proposal to change it. I explain below:
> > >
> > > Problem with current design
> > > ----------------------------------------
> > > - What we have right now is not unit tests, it's really integration
> > tests.
> > > You have to start the framework, the database, the service engine, the
> > > entity engine and pretty much everything.
> > > - Testing is very slow, because it's an integration test as I mentioned
> > > above. 10 minutes on a good computer!
> > > - There is zero mocking! We actually have to --load-data for things to
> > > work. Again, these are integration tests.
> > > - Too complex: Integration tests by their nature are grabbing too much.
> > > Mind you, I am not objecting to integration tests (I actually like
> them)
> > > but I am objecting to not having real unit-tests. Unit tests should all
> > run
> > > in a few seconds.
> > >
> > > Proposed solution
> > > --------------------------
> > > - We keep what is considered real integration tests the way they are
> > right
> > > now and keep using them
> > > - We move what should be unit tests into simple JUnit classes, and we
> do
> > > not run them using java -jar ofbiz.jar --test, but instead run them
> > > directly from the build.xml script, so these files are not identified
> in
> > > any XML document, but are simply called immediately from the build
> > scripts.
> > > - We clearly mark the difference between integration tests and unit
> tests
> > > (inside the source files or in the suite declarations).
> > > - We change the run-tests target in build.xml to run both unit tests
> and
> > > integration tests.
> > >
> > > I intend to heavily refactor the framework and I would feel better
> about
> > > introducing this change while refactoring. What do you guys think?
> Ideas?
> > > Suggestions? Approvals and thumbs up?
> > >
> > > Regards,
> > >
> > > Taher Alkhateeb
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

taher
Hello Everyone,

I was able to get a few tests running and this is very doable. But I faced
a big problem in designing the testing framework because of ANT.

The problem
----------------
The way the build scripts are designed in OFBiz are very complex. A master
file calls other files which call other files. And in the middle you have
external libraries (ant-contrib) and macros, and variables, and class path
declarations, and and and ....

I cannot declare the tests programmatically (with JUnit test suites)
because this means lower level components would depend on higher level
components. So I have to do it in ANT, by navigating this maze of build
scripts, and it was a headache for me just to read them, let alone modify
them to create a testing framework.

Suggested Solution
------------------------
I suggest to implement the testing framework in Gradle, and simply call it
from within ant. This is a middle solution that sustains ant for now, but
can allow us to switch out later.

This means I will just add one more file called build.gradle in the top
level directory, and figure out the business logic for calling the test
suites from that file

I look forward to your feedback.

Regards,

Taher Alkhateeb

On Wed, Jun 8, 2016 at 6:00 PM, Taher Alkhateeb <[hidden email]>
wrote:

> Hi Everyone,
>
> Thank you all for your support, JIRA created in
> https://issues.apache.org/jira/browse/OFBIZ-7254
>
> I will start working on it and try to implement ASAP to get my focus back
> on refactoring.
>
> Cheers!
>
> Taher Alkhateeb
>
> On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <
> [hidden email]> wrote:
>
>> +1
>>
>> Thanks & Regards
>> --
>> Deepak Dixit
>> www.hotwaxsystems.com
>>
>> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
>> [hidden email]> wrote:
>>
>> > +1
>> >
>> > Makes perfect sense.
>> >
>> > --
>> > Thanks & Regards,
>> > Mridul Pathak
>> > Senior Manager
>> > HotWax Systems
>> > http://www.hotwaxsystems.com
>> >
>> > > On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
>> [hidden email]>
>> > wrote:
>> > >
>> > > Hello Everyone,
>> > >
>> > > After refactoring the start component and while starting on the base
>> > > component I realized that the testing framework for OFBiz is not good.
>> > You
>> > > cannot do real test driven development or red-green-refactor with the
>> > > current setup, hence my proposal to change it. I explain below:
>> > >
>> > > Problem with current design
>> > > ----------------------------------------
>> > > - What we have right now is not unit tests, it's really integration
>> > tests.
>> > > You have to start the framework, the database, the service engine, the
>> > > entity engine and pretty much everything.
>> > > - Testing is very slow, because it's an integration test as I
>> mentioned
>> > > above. 10 minutes on a good computer!
>> > > - There is zero mocking! We actually have to --load-data for things to
>> > > work. Again, these are integration tests.
>> > > - Too complex: Integration tests by their nature are grabbing too
>> much.
>> > > Mind you, I am not objecting to integration tests (I actually like
>> them)
>> > > but I am objecting to not having real unit-tests. Unit tests should
>> all
>> > run
>> > > in a few seconds.
>> > >
>> > > Proposed solution
>> > > --------------------------
>> > > - We keep what is considered real integration tests the way they are
>> > right
>> > > now and keep using them
>> > > - We move what should be unit tests into simple JUnit classes, and we
>> do
>> > > not run them using java -jar ofbiz.jar --test, but instead run them
>> > > directly from the build.xml script, so these files are not identified
>> in
>> > > any XML document, but are simply called immediately from the build
>> > scripts.
>> > > - We clearly mark the difference between integration tests and unit
>> tests
>> > > (inside the source files or in the suite declarations).
>> > > - We change the run-tests target in build.xml to run both unit tests
>> and
>> > > integration tests.
>> > >
>> > > I intend to heavily refactor the framework and I would feel better
>> about
>> > > introducing this change while refactoring. What do you guys think?
>> Ideas?
>> > > Suggestions? Approvals and thumbs up?
>> > >
>> > > Regards,
>> > >
>> > > Taher Alkhateeb
>> >
>> >
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Jacopo Cappellato-5
It sounds a reasonable approach to me.
Especially because it will let you proceed with the important work you are
contributing without loosing the momentum to study old configuration code
that would require some cleanups regardless.

Thanks,

Jacopo

On Fri, Jun 10, 2016 at 4:16 PM, Taher Alkhateeb <[hidden email]
> wrote:

> Hello Everyone,
>
> I was able to get a few tests running and this is very doable. But I faced
> a big problem in designing the testing framework because of ANT.
>
> The problem
> ----------------
> The way the build scripts are designed in OFBiz are very complex. A master
> file calls other files which call other files. And in the middle you have
> external libraries (ant-contrib) and macros, and variables, and class path
> declarations, and and and ....
>
> I cannot declare the tests programmatically (with JUnit test suites)
> because this means lower level components would depend on higher level
> components. So I have to do it in ANT, by navigating this maze of build
> scripts, and it was a headache for me just to read them, let alone modify
> them to create a testing framework.
>
> Suggested Solution
> ------------------------
> I suggest to implement the testing framework in Gradle, and simply call it
> from within ant. This is a middle solution that sustains ant for now, but
> can allow us to switch out later.
>
> This means I will just add one more file called build.gradle in the top
> level directory, and figure out the business logic for calling the test
> suites from that file
>
> I look forward to your feedback.
>
> Regards,
>
> Taher Alkhateeb
>
> On Wed, Jun 8, 2016 at 6:00 PM, Taher Alkhateeb <
> [hidden email]>
> wrote:
>
> > Hi Everyone,
> >
> > Thank you all for your support, JIRA created in
> > https://issues.apache.org/jira/browse/OFBIZ-7254
> >
> > I will start working on it and try to implement ASAP to get my focus back
> > on refactoring.
> >
> > Cheers!
> >
> > Taher Alkhateeb
> >
> > On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <
> > [hidden email]> wrote:
> >
> >> +1
> >>
> >> Thanks & Regards
> >> --
> >> Deepak Dixit
> >> www.hotwaxsystems.com
> >>
> >> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
> >> [hidden email]> wrote:
> >>
> >> > +1
> >> >
> >> > Makes perfect sense.
> >> >
> >> > --
> >> > Thanks & Regards,
> >> > Mridul Pathak
> >> > Senior Manager
> >> > HotWax Systems
> >> > http://www.hotwaxsystems.com
> >> >
> >> > > On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
> >> [hidden email]>
> >> > wrote:
> >> > >
> >> > > Hello Everyone,
> >> > >
> >> > > After refactoring the start component and while starting on the base
> >> > > component I realized that the testing framework for OFBiz is not
> good.
> >> > You
> >> > > cannot do real test driven development or red-green-refactor with
> the
> >> > > current setup, hence my proposal to change it. I explain below:
> >> > >
> >> > > Problem with current design
> >> > > ----------------------------------------
> >> > > - What we have right now is not unit tests, it's really integration
> >> > tests.
> >> > > You have to start the framework, the database, the service engine,
> the
> >> > > entity engine and pretty much everything.
> >> > > - Testing is very slow, because it's an integration test as I
> >> mentioned
> >> > > above. 10 minutes on a good computer!
> >> > > - There is zero mocking! We actually have to --load-data for things
> to
> >> > > work. Again, these are integration tests.
> >> > > - Too complex: Integration tests by their nature are grabbing too
> >> much.
> >> > > Mind you, I am not objecting to integration tests (I actually like
> >> them)
> >> > > but I am objecting to not having real unit-tests. Unit tests should
> >> all
> >> > run
> >> > > in a few seconds.
> >> > >
> >> > > Proposed solution
> >> > > --------------------------
> >> > > - We keep what is considered real integration tests the way they are
> >> > right
> >> > > now and keep using them
> >> > > - We move what should be unit tests into simple JUnit classes, and
> we
> >> do
> >> > > not run them using java -jar ofbiz.jar --test, but instead run them
> >> > > directly from the build.xml script, so these files are not
> identified
> >> in
> >> > > any XML document, but are simply called immediately from the build
> >> > scripts.
> >> > > - We clearly mark the difference between integration tests and unit
> >> tests
> >> > > (inside the source files or in the suite declarations).
> >> > > - We change the run-tests target in build.xml to run both unit tests
> >> and
> >> > > integration tests.
> >> > >
> >> > > I intend to heavily refactor the framework and I would feel better
> >> about
> >> > > introducing this change while refactoring. What do you guys think?
> >> Ideas?
> >> > > Suggestions? Approvals and thumbs up?
> >> > >
> >> > > Regards,
> >> > >
> >> > > Taher Alkhateeb
> >> >
> >> >
> >>
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Jacques Le Roux
Administrator
+1, we need to move ahead

Jacques

Le 10/06/2016 à 16:29, Jacopo Cappellato a écrit :

> It sounds a reasonable approach to me.
> Especially because it will let you proceed with the important work you are
> contributing without loosing the momentum to study old configuration code
> that would require some cleanups regardless.
>
> Thanks,
>
> Jacopo
>
> On Fri, Jun 10, 2016 at 4:16 PM, Taher Alkhateeb <[hidden email]
>> wrote:
>> Hello Everyone,
>>
>> I was able to get a few tests running and this is very doable. But I faced
>> a big problem in designing the testing framework because of ANT.
>>
>> The problem
>> ----------------
>> The way the build scripts are designed in OFBiz are very complex. A master
>> file calls other files which call other files. And in the middle you have
>> external libraries (ant-contrib) and macros, and variables, and class path
>> declarations, and and and ....
>>
>> I cannot declare the tests programmatically (with JUnit test suites)
>> because this means lower level components would depend on higher level
>> components. So I have to do it in ANT, by navigating this maze of build
>> scripts, and it was a headache for me just to read them, let alone modify
>> them to create a testing framework.
>>
>> Suggested Solution
>> ------------------------
>> I suggest to implement the testing framework in Gradle, and simply call it
>> from within ant. This is a middle solution that sustains ant for now, but
>> can allow us to switch out later.
>>
>> This means I will just add one more file called build.gradle in the top
>> level directory, and figure out the business logic for calling the test
>> suites from that file
>>
>> I look forward to your feedback.
>>
>> Regards,
>>
>> Taher Alkhateeb
>>
>> On Wed, Jun 8, 2016 at 6:00 PM, Taher Alkhateeb <
>> [hidden email]>
>> wrote:
>>
>>> Hi Everyone,
>>>
>>> Thank you all for your support, JIRA created in
>>> https://issues.apache.org/jira/browse/OFBIZ-7254
>>>
>>> I will start working on it and try to implement ASAP to get my focus back
>>> on refactoring.
>>>
>>> Cheers!
>>>
>>> Taher Alkhateeb
>>>
>>> On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <
>>> [hidden email]> wrote:
>>>
>>>> +1
>>>>
>>>> Thanks & Regards
>>>> --
>>>> Deepak Dixit
>>>> www.hotwaxsystems.com
>>>>
>>>> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
>>>> [hidden email]> wrote:
>>>>
>>>>> +1
>>>>>
>>>>> Makes perfect sense.
>>>>>
>>>>> --
>>>>> Thanks & Regards,
>>>>> Mridul Pathak
>>>>> Senior Manager
>>>>> HotWax Systems
>>>>> http://www.hotwaxsystems.com
>>>>>
>>>>>> On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
>>>> [hidden email]>
>>>>> wrote:
>>>>>> Hello Everyone,
>>>>>>
>>>>>> After refactoring the start component and while starting on the base
>>>>>> component I realized that the testing framework for OFBiz is not
>> good.
>>>>> You
>>>>>> cannot do real test driven development or red-green-refactor with
>> the
>>>>>> current setup, hence my proposal to change it. I explain below:
>>>>>>
>>>>>> Problem with current design
>>>>>> ----------------------------------------
>>>>>> - What we have right now is not unit tests, it's really integration
>>>>> tests.
>>>>>> You have to start the framework, the database, the service engine,
>> the
>>>>>> entity engine and pretty much everything.
>>>>>> - Testing is very slow, because it's an integration test as I
>>>> mentioned
>>>>>> above. 10 minutes on a good computer!
>>>>>> - There is zero mocking! We actually have to --load-data for things
>> to
>>>>>> work. Again, these are integration tests.
>>>>>> - Too complex: Integration tests by their nature are grabbing too
>>>> much.
>>>>>> Mind you, I am not objecting to integration tests (I actually like
>>>> them)
>>>>>> but I am objecting to not having real unit-tests. Unit tests should
>>>> all
>>>>> run
>>>>>> in a few seconds.
>>>>>>
>>>>>> Proposed solution
>>>>>> --------------------------
>>>>>> - We keep what is considered real integration tests the way they are
>>>>> right
>>>>>> now and keep using them
>>>>>> - We move what should be unit tests into simple JUnit classes, and
>> we
>>>> do
>>>>>> not run them using java -jar ofbiz.jar --test, but instead run them
>>>>>> directly from the build.xml script, so these files are not
>> identified
>>>> in
>>>>>> any XML document, but are simply called immediately from the build
>>>>> scripts.
>>>>>> - We clearly mark the difference between integration tests and unit
>>>> tests
>>>>>> (inside the source files or in the suite declarations).
>>>>>> - We change the run-tests target in build.xml to run both unit tests
>>>> and
>>>>>> integration tests.
>>>>>>
>>>>>> I intend to heavily refactor the framework and I would feel better
>>>> about
>>>>>> introducing this change while refactoring. What do you guys think?
>>>> Ideas?
>>>>>> Suggestions? Approvals and thumbs up?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Taher Alkhateeb
>>>>>
>>>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Sharan-F
+1, I agree with Jacques and Jacopo.

Thanks
Sharan

On 10/06/16 16:43, Jacques Le Roux wrote:

> +1, we need to move ahead
>
> Jacques
>
> Le 10/06/2016 à 16:29, Jacopo Cappellato a écrit :
>> It sounds a reasonable approach to me.
>> Especially because it will let you proceed with the important work
>> you are
>> contributing without loosing the momentum to study old configuration
>> code
>> that would require some cleanups regardless.
>>
>> Thanks,
>>
>> Jacopo
>>
>> On Fri, Jun 10, 2016 at 4:16 PM, Taher Alkhateeb
>> <[hidden email]
>>> wrote:
>>> Hello Everyone,
>>>
>>> I was able to get a few tests running and this is very doable. But I
>>> faced
>>> a big problem in designing the testing framework because of ANT.
>>>
>>> The problem
>>> ----------------
>>> The way the build scripts are designed in OFBiz are very complex. A
>>> master
>>> file calls other files which call other files. And in the middle you
>>> have
>>> external libraries (ant-contrib) and macros, and variables, and
>>> class path
>>> declarations, and and and ....
>>>
>>> I cannot declare the tests programmatically (with JUnit test suites)
>>> because this means lower level components would depend on higher level
>>> components. So I have to do it in ANT, by navigating this maze of build
>>> scripts, and it was a headache for me just to read them, let alone
>>> modify
>>> them to create a testing framework.
>>>
>>> Suggested Solution
>>> ------------------------
>>> I suggest to implement the testing framework in Gradle, and simply
>>> call it
>>> from within ant. This is a middle solution that sustains ant for
>>> now, but
>>> can allow us to switch out later.
>>>
>>> This means I will just add one more file called build.gradle in the top
>>> level directory, and figure out the business logic for calling the test
>>> suites from that file
>>>
>>> I look forward to your feedback.
>>>
>>> Regards,
>>>
>>> Taher Alkhateeb
>>>
>>> On Wed, Jun 8, 2016 at 6:00 PM, Taher Alkhateeb <
>>> [hidden email]>
>>> wrote:
>>>
>>>> Hi Everyone,
>>>>
>>>> Thank you all for your support, JIRA created in
>>>> https://issues.apache.org/jira/browse/OFBIZ-7254
>>>>
>>>> I will start working on it and try to implement ASAP to get my
>>>> focus back
>>>> on refactoring.
>>>>
>>>> Cheers!
>>>>
>>>> Taher Alkhateeb
>>>>
>>>> On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <
>>>> [hidden email]> wrote:
>>>>
>>>>> +1
>>>>>
>>>>> Thanks & Regards
>>>>> --
>>>>> Deepak Dixit
>>>>> www.hotwaxsystems.com
>>>>>
>>>>> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
>>>>> [hidden email]> wrote:
>>>>>
>>>>>> +1
>>>>>>
>>>>>> Makes perfect sense.
>>>>>>
>>>>>> --
>>>>>> Thanks & Regards,
>>>>>> Mridul Pathak
>>>>>> Senior Manager
>>>>>> HotWax Systems
>>>>>> http://www.hotwaxsystems.com
>>>>>>
>>>>>>> On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
>>>>> [hidden email]>
>>>>>> wrote:
>>>>>>> Hello Everyone,
>>>>>>>
>>>>>>> After refactoring the start component and while starting on the
>>>>>>> base
>>>>>>> component I realized that the testing framework for OFBiz is not
>>> good.
>>>>>> You
>>>>>>> cannot do real test driven development or red-green-refactor with
>>> the
>>>>>>> current setup, hence my proposal to change it. I explain below:
>>>>>>>
>>>>>>> Problem with current design
>>>>>>> ----------------------------------------
>>>>>>> - What we have right now is not unit tests, it's really integration
>>>>>> tests.
>>>>>>> You have to start the framework, the database, the service engine,
>>> the
>>>>>>> entity engine and pretty much everything.
>>>>>>> - Testing is very slow, because it's an integration test as I
>>>>> mentioned
>>>>>>> above. 10 minutes on a good computer!
>>>>>>> - There is zero mocking! We actually have to --load-data for things
>>> to
>>>>>>> work. Again, these are integration tests.
>>>>>>> - Too complex: Integration tests by their nature are grabbing too
>>>>> much.
>>>>>>> Mind you, I am not objecting to integration tests (I actually like
>>>>> them)
>>>>>>> but I am objecting to not having real unit-tests. Unit tests should
>>>>> all
>>>>>> run
>>>>>>> in a few seconds.
>>>>>>>
>>>>>>> Proposed solution
>>>>>>> --------------------------
>>>>>>> - We keep what is considered real integration tests the way they
>>>>>>> are
>>>>>> right
>>>>>>> now and keep using them
>>>>>>> - We move what should be unit tests into simple JUnit classes, and
>>> we
>>>>> do
>>>>>>> not run them using java -jar ofbiz.jar --test, but instead run them
>>>>>>> directly from the build.xml script, so these files are not
>>> identified
>>>>> in
>>>>>>> any XML document, but are simply called immediately from the build
>>>>>> scripts.
>>>>>>> - We clearly mark the difference between integration tests and unit
>>>>> tests
>>>>>>> (inside the source files or in the suite declarations).
>>>>>>> - We change the run-tests target in build.xml to run both unit
>>>>>>> tests
>>>>> and
>>>>>>> integration tests.
>>>>>>>
>>>>>>> I intend to heavily refactor the framework and I would feel better
>>>>> about
>>>>>>> introducing this change while refactoring. What do you guys think?
>>>>> Ideas?
>>>>>>> Suggestions? Approvals and thumbs up?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Taher Alkhateeb
>>>>>>
>>>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Mridul Pathak-4
In reply to this post by taher
+1

--
Thanks & Regards,
Mridul Pathak
HotWax Systems
http://www.hotwaxsystems.com

> On Jun 10, 2016, at 7:46 PM, Taher Alkhateeb <[hidden email]> wrote:
>
> Hello Everyone,
>
> I was able to get a few tests running and this is very doable. But I faced
> a big problem in designing the testing framework because of ANT.
>
> The problem
> ----------------
> The way the build scripts are designed in OFBiz are very complex. A master
> file calls other files which call other files. And in the middle you have
> external libraries (ant-contrib) and macros, and variables, and class path
> declarations, and and and ....
>
> I cannot declare the tests programmatically (with JUnit test suites)
> because this means lower level components would depend on higher level
> components. So I have to do it in ANT, by navigating this maze of build
> scripts, and it was a headache for me just to read them, let alone modify
> them to create a testing framework.
>
> Suggested Solution
> ------------------------
> I suggest to implement the testing framework in Gradle, and simply call it
> from within ant. This is a middle solution that sustains ant for now, but
> can allow us to switch out later.
>
> This means I will just add one more file called build.gradle in the top
> level directory, and figure out the business logic for calling the test
> suites from that file
>
> I look forward to your feedback.
>
> Regards,
>
> Taher Alkhateeb
>
> On Wed, Jun 8, 2016 at 6:00 PM, Taher Alkhateeb <[hidden email]>
> wrote:
>
>> Hi Everyone,
>>
>> Thank you all for your support, JIRA created in
>> https://issues.apache.org/jira/browse/OFBIZ-7254
>>
>> I will start working on it and try to implement ASAP to get my focus back
>> on refactoring.
>>
>> Cheers!
>>
>> Taher Alkhateeb
>>
>> On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <
>> [hidden email]> wrote:
>>
>>> +1
>>>
>>> Thanks & Regards
>>> --
>>> Deepak Dixit
>>> www.hotwaxsystems.com
>>>
>>> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
>>> [hidden email]> wrote:
>>>
>>>> +1
>>>>
>>>> Makes perfect sense.
>>>>
>>>> --
>>>> Thanks & Regards,
>>>> Mridul Pathak
>>>> Senior Manager
>>>> HotWax Systems
>>>> http://www.hotwaxsystems.com
>>>>
>>>>> On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
>>> [hidden email]>
>>>> wrote:
>>>>>
>>>>> Hello Everyone,
>>>>>
>>>>> After refactoring the start component and while starting on the base
>>>>> component I realized that the testing framework for OFBiz is not good.
>>>> You
>>>>> cannot do real test driven development or red-green-refactor with the
>>>>> current setup, hence my proposal to change it. I explain below:
>>>>>
>>>>> Problem with current design
>>>>> ----------------------------------------
>>>>> - What we have right now is not unit tests, it's really integration
>>>> tests.
>>>>> You have to start the framework, the database, the service engine, the
>>>>> entity engine and pretty much everything.
>>>>> - Testing is very slow, because it's an integration test as I
>>> mentioned
>>>>> above. 10 minutes on a good computer!
>>>>> - There is zero mocking! We actually have to --load-data for things to
>>>>> work. Again, these are integration tests.
>>>>> - Too complex: Integration tests by their nature are grabbing too
>>> much.
>>>>> Mind you, I am not objecting to integration tests (I actually like
>>> them)
>>>>> but I am objecting to not having real unit-tests. Unit tests should
>>> all
>>>> run
>>>>> in a few seconds.
>>>>>
>>>>> Proposed solution
>>>>> --------------------------
>>>>> - We keep what is considered real integration tests the way they are
>>>> right
>>>>> now and keep using them
>>>>> - We move what should be unit tests into simple JUnit classes, and we
>>> do
>>>>> not run them using java -jar ofbiz.jar --test, but instead run them
>>>>> directly from the build.xml script, so these files are not identified
>>> in
>>>>> any XML document, but are simply called immediately from the build
>>>> scripts.
>>>>> - We clearly mark the difference between integration tests and unit
>>> tests
>>>>> (inside the source files or in the suite declarations).
>>>>> - We change the run-tests target in build.xml to run both unit tests
>>> and
>>>>> integration tests.
>>>>>
>>>>> I intend to heavily refactor the framework and I would feel better
>>> about
>>>>> introducing this change while refactoring. What do you guys think?
>>> Ideas?
>>>>> Suggestions? Approvals and thumbs up?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Taher Alkhateeb
>>>>
>>>>
>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal to modify the testing framework for OFBiz

Pranay Pandey-3
In reply to this post by taher
+1

Best regards,

Pranay Pandey
HotWax Systems
http://www.hotwaxsystems.com/

On Fri, Jun 10, 2016 at 7:46 PM, Taher Alkhateeb <[hidden email]
> wrote:

> Hello Everyone,
>
> I was able to get a few tests running and this is very doable. But I faced
> a big problem in designing the testing framework because of ANT.
>
> The problem
> ----------------
> The way the build scripts are designed in OFBiz are very complex. A master
> file calls other files which call other files. And in the middle you have
> external libraries (ant-contrib) and macros, and variables, and class path
> declarations, and and and ....
>
> I cannot declare the tests programmatically (with JUnit test suites)
> because this means lower level components would depend on higher level
> components. So I have to do it in ANT, by navigating this maze of build
> scripts, and it was a headache for me just to read them, let alone modify
> them to create a testing framework.
>
> Suggested Solution
> ------------------------
> I suggest to implement the testing framework in Gradle, and simply call it
> from within ant. This is a middle solution that sustains ant for now, but
> can allow us to switch out later.
>
> This means I will just add one more file called build.gradle in the top
> level directory, and figure out the business logic for calling the test
> suites from that file
>
> I look forward to your feedback.
>
> Regards,
>
> Taher Alkhateeb
>
> On Wed, Jun 8, 2016 at 6:00 PM, Taher Alkhateeb <
> [hidden email]>
> wrote:
>
> > Hi Everyone,
> >
> > Thank you all for your support, JIRA created in
> > https://issues.apache.org/jira/browse/OFBIZ-7254
> >
> > I will start working on it and try to implement ASAP to get my focus back
> > on refactoring.
> >
> > Cheers!
> >
> > Taher Alkhateeb
> >
> > On Wed, Jun 8, 2016 at 4:58 PM, Deepak Dixit <
> > [hidden email]> wrote:
> >
> >> +1
> >>
> >> Thanks & Regards
> >> --
> >> Deepak Dixit
> >> www.hotwaxsystems.com
> >>
> >> On Wed, Jun 8, 2016 at 7:12 PM, Mridul Pathak <
> >> [hidden email]> wrote:
> >>
> >> > +1
> >> >
> >> > Makes perfect sense.
> >> >
> >> > --
> >> > Thanks & Regards,
> >> > Mridul Pathak
> >> > Senior Manager
> >> > HotWax Systems
> >> > http://www.hotwaxsystems.com
> >> >
> >> > > On Jun 8, 2016, at 2:41 PM, Taher Alkhateeb <
> >> [hidden email]>
> >> > wrote:
> >> > >
> >> > > Hello Everyone,
> >> > >
> >> > > After refactoring the start component and while starting on the base
> >> > > component I realized that the testing framework for OFBiz is not
> good.
> >> > You
> >> > > cannot do real test driven development or red-green-refactor with
> the
> >> > > current setup, hence my proposal to change it. I explain below:
> >> > >
> >> > > Problem with current design
> >> > > ----------------------------------------
> >> > > - What we have right now is not unit tests, it's really integration
> >> > tests.
> >> > > You have to start the framework, the database, the service engine,
> the
> >> > > entity engine and pretty much everything.
> >> > > - Testing is very slow, because it's an integration test as I
> >> mentioned
> >> > > above. 10 minutes on a good computer!
> >> > > - There is zero mocking! We actually have to --load-data for things
> to
> >> > > work. Again, these are integration tests.
> >> > > - Too complex: Integration tests by their nature are grabbing too
> >> much.
> >> > > Mind you, I am not objecting to integration tests (I actually like
> >> them)
> >> > > but I am objecting to not having real unit-tests. Unit tests should
> >> all
> >> > run
> >> > > in a few seconds.
> >> > >
> >> > > Proposed solution
> >> > > --------------------------
> >> > > - We keep what is considered real integration tests the way they are
> >> > right
> >> > > now and keep using them
> >> > > - We move what should be unit tests into simple JUnit classes, and
> we
> >> do
> >> > > not run them using java -jar ofbiz.jar --test, but instead run them
> >> > > directly from the build.xml script, so these files are not
> identified
> >> in
> >> > > any XML document, but are simply called immediately from the build
> >> > scripts.
> >> > > - We clearly mark the difference between integration tests and unit
> >> tests
> >> > > (inside the source files or in the suite declarations).
> >> > > - We change the run-tests target in build.xml to run both unit tests
> >> and
> >> > > integration tests.
> >> > >
> >> > > I intend to heavily refactor the framework and I would feel better
> >> about
> >> > > introducing this change while refactoring. What do you guys think?
> >> Ideas?
> >> > > Suggestions? Approvals and thumbs up?
> >> > >
> >> > > Regards,
> >> > >
> >> > > Taher Alkhateeb
> >> >
> >> >
> >>
> >
> >
>
12