[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, "1 \
test")</span><br style="font-family: courier new,monospace;"> <span \
style="font-family: courier new,monospace;">test2 = Test(2, "run 2 \
tests")</span><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;">test3 = Test(3, "run 4 \
tests")</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;"> log ("Hello")</span><br \
style="font-family: courier new,monospace;"> <span style="font-family: courier \
new,monospace;"> 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;"> unit1()</span><br style="font-family: courier \
new,monospace;"><span style="font-family: courier new,monospace;"> \
unit1()</span><br style="font-family: courier new,monospace;"> <span \
style="font-family: courier new,monospace;"> log \
("Hello1")</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;"> two1()</span><br \
style="font-family: courier new,monospace;"><span style="font-family: courier \
new,monospace;"> two1()</span><br style="font-family: courier \
new,monospace;"> <span style="font-family: courier new,monospace;"> \
log ("Hello2")</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;"> def __call__(self):</span><br style="font-family: \
courier new,monospace;"> <span style="font-family: courier \
new,monospace;"> 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 <<a href="mailto:philipa@mail.com">philipa@mail.com</a>>:</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> > Hello,<br> ><br> \
> In test tool like LoadRunner, you usually define (so did i a long time<br> > \
away ) a functional test as a group of some unitary functional test.<br> > With \
the grinder, you defined tour test as a wrapper to an object :<br> > test1, test2 \
...<br> > So you have the unitary functional test in TheGrinder without \
problem.<br> ><br> > In the console you can follow the TPS, response time of \
all tests and<br> > you have a Total which is the total of each unitary tests.<br> \
> (TPS,responseTime ...)<br> > But this is not the same as statistics for the \
whole test (or more<br> > generally a group of test)<br> ><br> ><br> > \
The idea behind is perhaps to wrap several tests (a wrapper of wrapper ).<br> \
><br> ><br> > Do you think it's possible ?<br> <br> <br>Sure, tests \
wrapping tests works fine. E.g.<br> <br> test1 =Test(1, "unitary test")<br> \
test2 = Test(2, "run 2 tests")<br> test3 = Test(3, "run 4 \
tests")<br> <br> def unit():<br> print "Hello"<br> unit = \
test1.wrap(unit)<br> <br> def two():<br> unit()<br> unit()<br> \
two=test2.wrap(two)<br> <br> def \
four():<br> two()<br> two()<br> four=test3.wrap(four)<br> <br> \
class TestRunner:<br> def \
__call__(self):<br> 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