Separating unit and functional tests

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Separating unit and functional tests

sebastian keßler
Hi community,

are there any plans to separate the functional (e.g. zend_controller_test_case) tests
and the raw unit tests in different directories?

Right now there are mixed together in the same directories, which is confusing in my opinion.

There are different in its goals and this should be also made visible in the directory structure.

Greetings,
Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: [fw-core] Separating unit and functional tests

weierophinney
Administrator
-- sebastian keßler <[hidden email]> wrote
(on Sunday, 24 July 2011, 10:53 AM -0700):
> are there any plans to separate the functional (e.g.
> zend_controller_test_case) tests
> and the raw unit tests in different directories?
>
> Right now there are mixed together in the same directories, which is
> confusing in my opinion.
>
> There are different in its goals and this should be also made visible
> in the directory structure.

Perhaps you could elaborate on this? This would be a non-trivial
undertaking, for little benefit to my eyes, so I'd need a better
justification, to be honest.

The tests under tests/Zend/Controller/ are not typically functional
tests -- they are instead testing discrete units of functionality in the
Zend_Controller component. Some of these include interactions of
(sub-)components, but that's in large part due to the fact that a number
of objects are being passed around in these scenarios. This is less
functional testing, and more controlling state to create reproduce cases
for either common use cases or specific edge cases.

We provide a functional testing framework via
Zend_Test_PHPUnit_ControllerTestCase -- but this is for userland
(quasi-)functional testing. Our recommendation for using that suite of
test cases and assertions is to separate functional from library tests.
But these are quite different than the tests you might find in
Zend_Controller, to be honest.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: [fw-core] Separating unit and functional tests

sebastian keßler

Sorry, i was actually talking about the mentioned Zend_Test_PHPUnit_ControllerTestCase.

In the current zf2 repository there are some tests (e.g. layout) which inherit from it and
named "FunctionalTest".

Of course for the framework itself there is maybe not that much benefit to separate this,
as the most tests are unit tests (at least now).

But in many projects people who start with TDD are looking for best practices and of course they are often mimic the solutions they found in the framework.

So i believe it is considered as good practice to separate at least this two kinds of tests.
The use case in many projects is to run them separately and doing this via annotation (@group) is not really pretty.

So it would be a great guide and hint to common practices when adding this to the default project structure and having a part in the documentation which gives some advices doing
test driven development with zf.


weierophinney wrote
-- sebastian keßler <[hidden email]> wrote
(on Sunday, 24 July 2011, 10:53 AM -0700):
> are there any plans to separate the functional (e.g.
> zend_controller_test_case) tests
> and the raw unit tests in different directories?
>
> Right now there are mixed together in the same directories, which is
> confusing in my opinion.
>
> There are different in its goals and this should be also made visible
> in the directory structure.

Perhaps you could elaborate on this? This would be a non-trivial
undertaking, for little benefit to my eyes, so I'd need a better
justification, to be honest.

The tests under tests/Zend/Controller/ are not typically functional
tests -- they are instead testing discrete units of functionality in the
Zend_Controller component. Some of these include interactions of
(sub-)components, but that's in large part due to the fact that a number
of objects are being passed around in these scenarios. This is less
functional testing, and more controlling state to create reproduce cases
for either common use cases or specific edge cases.

We provide a functional testing framework via
Zend_Test_PHPUnit_ControllerTestCase -- but this is for userland
(quasi-)functional testing. Our recommendation for using that suite of
test cases and assertions is to separate functional from library tests.
But these are quite different than the tests you might find in
Zend_Controller, to be honest.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]