[openstack-dev] [Quantum] Testing Session Suggestions
Maru Newby
marun at redhat.com
Fri Apr 12 16:12:53 UTC 2013
Hi Salvatore,
I will be happy to provide some samples and walk through refactoring them. How much time would intend for such an exercise so that I could target my effort?
Cheers,
Maru
On Apr 11, 2013, at 2:04 PM, Salvatore Orlando <sorlando at nicira.com> wrote:
> [REPOSTING THIS REPLY]
>
> Please let me know if others want to jump in the discussion on Quantum unit tests
>
> Hi Maru,
>
> thanks for contributing to this topic.
> More comments inline.
>
>
> I was thinking of providing code samples during the summit session explaining how existing tests could be refactored. If you can provide some samples it would be great; also if you're ok with walking the audience through these samples, that would be awesome!
>
> Salvatore
>
>
> On 4 April 2013 03:34, Maru Newby <marun at redhat.com> wrote:
> Hi Salvatore,
>
> I'm working on a patch to swap pep8 for flake8, which will increase the automation of mechanical review. In the process of doing the cleanup required for the patch, I have seen some ways that quantum's test suite could be improved:
>
> - An api method and its serialization format (xml, json) are orthogonal (or should be) and could be tested as such. For plugins that test both serialization formats for each api method, test execution time is effectively doubled with no benefit to coverage.
>
> I totally agree. Once we get past the WSGI layer, there is not difference between the JSON or the XML use case. The Serialization tests should just validate data serialization and deserialization.
>
>
> - Many plugins contain duplicate code and tests (e.g. get_port_from_device and its associated tests appear in each of the nec, openvswitch, ryu, and linuxbridge plugins). Common code could be factored out and tested only once.
>
> That's another good point that I wanted to address. It seems these tests have the same coverage, so, as you say, they should be factored out in a test module aimed at covering that specific functionality.
>
>
> - Many quantum tests evaluate low-level functionality through a web api rather than isolating the functionality under test. Writing more focused unit tests (and fewer functional and integration tests ala http://www.martinfowler.com/bliki/TestPyramid.html) could allow for better coverage at a lower cost in both maintenance and execution.
>
> This is the first goal of reworking our unit tests. We have always been aware that those were not unit tests. However, those were the closest think we could provide to a gatetests. Now that we have proper gate tests - we should make sure our unit tests are proper unit tests! Also, it would be good to discuss what to make of the current unit tests, which are probably suitable for some sort of automated functional testing.
>
>
> The technical aspects of these potential improvements are straightforward, but will require a degree of developer and reviewer education to ensure that they are properly implemented and maintained going forward. Do you think the summit session you've proposed would be an appropriate venue, or should it be done separately?
>
> I think the summit session is just a starter. 'Education' should be enforced via code reviews. The main goal of the summit session is achieve consensus on the general direction, identify priorities, and possibly resources.
>
>
>
> Cheers,
>
>
> Maru
>
>
> On 3 April 2013 18:34, Maru Newby <marun at redhat.com> wrote:
> Hi Salvatore,
>
> I'm working on a patch to swap pep8 for flake8, which will increase the automation of mechanical review. In the process of doing the cleanup required for the patch, I have seen some ways that quantum's test suite could be improved:
>
> - An api method and its serialization format (xml, json) are orthogonal (or should be) and could be tested as such. For plugins that test both serialization formats for each api method, test execution time is effectively doubled with no benefit to coverage.
>
> - Many plugins contain duplicate code and tests (e.g. get_port_from_device and its associated tests appear in each of the nec, openvswitch, ryu, and linuxbridge plugins). Common code could be factored out and tested only once.
>
> - Many quantum tests evaluate low-level functionality through a web api rather than isolating the functionality under test. Writing more focused unit tests (and fewer functional and integration tests ala http://www.martinfowler.com/bliki/TestPyramid.html) could allow for better coverage at a lower cost in both maintenance and execution.
>
> The technical aspects of these potential improvements are straightforward, but will require a degree of developer and reviewer education to ensure that they are properly implemented and maintained going forward. Do you think the summit session you've proposed would be an appropriate venue, or should it be done separately?
>
> Cheers,
>
>
> Maru
>
More information about the OpenStack-dev
mailing list