[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grinder-use
Subject:    Re: [Grinder-use] How to group functional tests ?
From:       "olivier merlin" <omerlin13 () gmail ! com>
Date:       2008-03-17 14:09:09
Message-ID: 99350390803170709v38e10bb0ofa7016fa89931e64 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Phil,

Excellent !
I achieve to do it working on a complex sample just by renaming the
TestRunner class to a Runner class
and then wrapping the Runner in the TestRunner __call__() method

I update your example with this to work :

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test


log = grinder.logger.output


test1 = Test(1, "1 test")
test2 = Test(2, "run 2 tests")
test3 = Test(3, "run 4 tests")

def unit():
    log ("Hello")
    grinder.sleep (1000)

def two():
    unit1()
    unit1()
    log ("Hello1")

def four():
    two1()
    two1()
    log ("Hello2")

unit1=test1.wrap(unit)
two1=test2.wrap(two)
four1=test3.wrap(four)

class TestRunner:
    def __call__(self):
    four1()

rgds,
Olivier

2008/3/15, Philip Aston <philipa@mail.com>:
>
> olivier merlin wrote:
> > Hello,
> >
> > In test tool like LoadRunner, you usually define (so did i a long time
> > away ) a functional test as a group of some unitary functional test.
> > With the grinder, you defined tour test as a wrapper to an object :
> > test1, test2 ...
> > So you have the unitary functional test in TheGrinder without problem.
> >
> > In the console you can follow the TPS, response time of all tests and
> > you have a Total which is the total of each unitary tests.
> > (TPS,responseTime ...)
> > But this is not the same as statistics for the whole test (or more
> > generally a group of test)
> >
> >
> > The idea behind is perhaps to wrap several tests (a wrapper of wrapper
> ).
> >
> >
> > Do you think it's possible ?
>
>
> Sure, tests wrapping tests works fine. E.g.
>
> test1 =Test(1, "unitary test")
> test2 = Test(2, "run 2 tests")
> test3 = Test(3, "run 4 tests")
>
> def unit():
>   print "Hello"
> unit = test1.wrap(unit)
>
> def two():
>   unit()
>   unit()
> two=test2.wrap(two)
>
> def four():
>   two()
>   two()
> four=test3.wrap(four)
>
> class TestRunner:
>   def __call__(self):
>     four()
>
>
>
> - Phil
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> grinder-use mailing list
> grinder-use@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>

[Attachment #5 (text/html)]

Hi Phil,<br><br>Excellent !<br>I achieve to do it working on a complex sample just by \
renaming the TestRunner class to a Runner class<br>and then wrapping the Runner in \
the TestRunner __call__() method<br><br>I update your example with this to work :<br> \
<br><span style="font-family: courier new,monospace;">from net.grinder.script.Grinder \
import grinder</span><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">from net.grinder.script import \
Test</span><br style="font-family: courier new,monospace;"> <br style="font-family: \
courier new,monospace;"><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">log = grinder.logger.output</span><br \
style="font-family: courier new,monospace;"> <br style="font-family: courier \
new,monospace;"><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">test1 = Test(1, &quot;1 \
test&quot;)</span><br style="font-family: courier new,monospace;"> <span \
style="font-family: courier new,monospace;">test2 = Test(2, &quot;run 2 \
tests&quot;)</span><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">test3 = Test(3, &quot;run 4 \
tests&quot;)</span><br> <br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">def unit():</span><br style="font-family: \
courier new,monospace;"><span style="font-family: courier \
new,monospace;">&nbsp;&nbsp;&nbsp; log (&quot;Hello&quot;)</span><br \
style="font-family: courier new,monospace;"> <span style="font-family: courier \
new,monospace;">&nbsp;&nbsp;&nbsp; grinder.sleep (1000)</span><br style="font-family: \
courier new,monospace;"><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">def two():</span><br style="font-family: \
courier new,monospace;"> <span style="font-family: courier \
new,monospace;">&nbsp;&nbsp;&nbsp; unit1()</span><br style="font-family: courier \
new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; \
unit1()</span><br style="font-family: courier new,monospace;"> <span \
style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; log \
(&quot;Hello1&quot;)</span><br style="font-family: courier new,monospace;"><br \
style="font-family: courier new,monospace;"><span style="font-family: courier \
new,monospace;">def four():</span><br style="font-family: courier new,monospace;"> \
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; two1()</span><br \
style="font-family: courier new,monospace;"><span style="font-family: courier \
new,monospace;">&nbsp;&nbsp;&nbsp; two1()</span><br style="font-family: courier \
new,monospace;"> <span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; \
log (&quot;Hello2&quot;)</span><br style="font-family: courier new,monospace;"><br \
style="font-family: courier new,monospace;"><span style="font-family: courier \
new,monospace;">unit1=test1.wrap(unit)</span><br style="font-family: courier \
new,monospace;"> <span style="font-family: courier \
new,monospace;">two1=test2.wrap(two)</span><br style="font-family: courier \
new,monospace;"><span style="font-family: courier \
new,monospace;">four1=test3.wrap(four)</span><br style="font-family: courier \
new,monospace;"> <br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">class TestRunner:</span><br \
style="font-family: courier new,monospace;"><span style="font-family: courier \
new,monospace;">&nbsp;&nbsp;&nbsp; def __call__(self):</span><br style="font-family: \
courier new,monospace;"> <span style="font-family: courier \
new,monospace;">&nbsp;&nbsp;&nbsp; four1()</span><br style="font-family: courier \
new,monospace;"><br>rgds,<br>Olivier<br><br><div><span class="gmail_quote">2008/3/15, \
Philip Aston &lt;<a href="mailto:philipa@mail.com">philipa@mail.com</a>&gt;:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> olivier merlin wrote:<br> &gt; Hello,<br> &gt;<br> \
&gt; In test tool like LoadRunner, you usually define (so did i a long time<br> &gt; \
away ) a functional test as a group of some unitary functional test.<br> &gt; With \
the grinder, you defined tour test as a wrapper to an object :<br>  &gt; test1, test2 \
...<br> &gt; So you have the unitary functional test in TheGrinder without \
problem.<br> &gt;<br> &gt; In the console you can follow the TPS, response time of \
all tests and<br> &gt; you have a Total which is the total of each unitary tests.<br> \
&gt; (TPS,responseTime ...)<br> &gt; But this is not the same as statistics for the \
whole test (or more<br> &gt; generally a group of test)<br> &gt;<br> &gt;<br> &gt; \
The idea behind is perhaps to wrap several tests (a wrapper of wrapper ).<br>  \
&gt;<br> &gt;<br> &gt; Do you think it&#39;s possible ?<br> <br> <br>Sure, tests \
wrapping tests works fine. E.g.<br> <br> test1 =Test(1, &quot;unitary test&quot;)<br> \
test2 = Test(2, &quot;run 2 tests&quot;)<br> test3 = Test(3, &quot;run 4 \
tests&quot;)<br>  <br> def unit():<br>&nbsp;&nbsp;print &quot;Hello&quot;<br> unit = \
test1.wrap(unit)<br> <br> def two():<br>&nbsp;&nbsp;unit()<br>&nbsp;&nbsp;unit()<br> \
two=test2.wrap(two)<br> <br> def \
four():<br>&nbsp;&nbsp;two()<br>&nbsp;&nbsp;two()<br> four=test3.wrap(four)<br> <br> \
class TestRunner:<br> &nbsp;&nbsp;def \
__call__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;four()<br> <br> <br> <br> - Phil<br> <br> \
-------------------------------------------------------------------------<br> This \
SF.net email is sponsored by: Microsoft<br> Defy all challenges. Microsoft(R) Visual \
Studio 2008.<br>  <a \
href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a><br> \
_______________________________________________<br> grinder-use mailing list<br> <a \
href="mailto:grinder-use@lists.sourceforge.net">grinder-use@lists.sourceforge.net</a><br>
  <a href="https://lists.sourceforge.net/lists/listinfo/grinder-use">https://lists.sourceforge.net/lists/listinfo/grinder-use</a><br> \
</blockquote></div><br>



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
grinder-use mailing list
grinder-use@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/grinder-use


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic