Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29279
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2012-09-15 20:24 -0700 |
| References | <e0d36274-3345-4eeb-bc0a-9da283b9778f@googlegroups.com> <CA+vVgJXBJJaMA-cocmTtHQbAr8WiF=_QoFmCnpXQ1C6GuFgiFA@mail.gmail.com> <mailman.730.1347679967.27098.python-list@python.org> |
| Subject | Re: unit test strategy |
| From | Aaron Brady <castironpi@gmail.com> |
| Message-ID | <mailman.779.1347766616.27098.python-list@python.org> (permalink) |
On Friday, September 14, 2012 10:32:47 PM UTC-5, David Hutto wrote:
> On Fri, Sep 14, 2012 at 11:26 PM, Dwight Hutto <dwightdhutto@gmail.com> wrote:
>
> > On Fri, Sep 14, 2012 at 10:59 PM, Aaron Brady <castironpi@gmail.com> wrote:
>
> >> Hello,
>
> >>
>
> >> I've developing a test script. There's a lot of repetition. I want to introduce a strategy for approaching it, but I don't want the program to be discredited because of the test script. Therefore, I'd like to know what people's reactions to and thoughts about it are.
>
> >>
>
> >> The first strategy I used created an iterator and advanced it between each step:
>
> >
>
> > That isn't a refined iterator below:
>
> What I mean is look at the similarities, and the differences, then
>
> replace the differences with interpolation, in eval even.
>
>
>
>
>
> >
>
> >> self.op_chain(range(5), ('add', 5))
>
> >> self.op_chain(range(5), ('add', -2), ('add', -1))
>
> >> self.op_chain(range(5), ('discard', -1), ('add', 5))
>
> >> self.op_chain_ok(range(5), ('update', [0, 1]))
>
> >> Etc.
>
> >>
>
> >> I'm considering something more complicated. 'iN' creates iterator N, 'nN' advances iterator N, an exception calls 'assertRaises', and the rest are function calls.
>
>
>
> iN = [N for N in range(0,5)]
>
>
>
>
>
> >> dsi= dict.__setitem__
>
> >> ddi= dict.__delitem__
>
> >> dsd= dict.setdefault
>
> >> KE= KeyError
>
> >> IE= IterationError
>
> >> self.chain(range(10), 'i0', (dsi, 0, 1), 'n0', (dsi, 10, 1), (IE, 'n0'))
>
> >> self.chain(range(10), 'i0', 'n0', (dsd, 0, 0), 'n0', (dsd, 10, 1), (IE, 'n0'))
>
> >> self.chain(range(10), 'i0', (KE, ddi, 10), 'n0', (ddi, 9), (IE, 'n0'))
>
> >>
>
> >> Do you think the 2nd version is legible? Could it interfere with the accuracy of the test?
>
>
>
> Define the 2nd version
>
>
>
>
>
> >
>
> > Show the test, which should show instances of what you want called.
>
> >
>
> > I could rewrite the above, but it seems you're more in need of refining
>
> > your iterations, and the values given within them.
>
> >
>
>
>
> --
>
> Best Regards,
>
> David Hutto
>
> CEO: http://www.hitwebdevelopment.com
Hi David,
I'm interested in your comments, but I had difficulty interpreting them. What I want to know is, do people think that the 2nd version I presented would be a more effective test script?
Do you think it would be more useful to run the tests in the function call directly? Or would it be more useful to output a program script and then run that? Is there some risk that the direct test would interfere with the results? And, is the 2nd version legible? That is, is it easy for other programmers to tell what the purpose and actual effects of a given test are?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-14 19:59 -0700
Re: unit test strategy Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-14 23:26 -0400
Re: unit test strategy Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-14 23:32 -0400
Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-15 20:24 -0700
Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-15 20:24 -0700
Re: unit test strategy Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 07:42 +0000
Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-16 11:38 -0700
Re: unit test strategy Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 20:01 +0000
Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-22 20:07 -0700
Re: unit test strategy Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-16 13:28 +0100
csiph-web