You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Rajesh Kanade <rk...@hotmail.com> on 2002/02/19 01:43:17 UTC

Doing scenario based testing

Hi All

I am new to cactus and new to testing arena itself.

My company writes web based applications ( using MVC ) and I am looking at 
automating testing at various levels.The server side code is entirely return 
in Java ( no EJB ).

I am trying to come up with a framework ( or use one if it exists already ) 
so that we can test our application at various levels like
class level, component level, sub system , system ( all this done without UI 
in picture )
So for a class level I can use JUnit to do my testing.
My idea was to build upon this to do component testing & then reuse these 
stuff as I move higher in the chain to do sub system and system testing.

I was planning on doing something like this.
I am taking an auction example where we wanted to test a ( auction creation 
/ bidding )scenario

So let's say we wanted to create company, users, set up an auction, Bid on 
the auction, Approve Winner.

So in this case a Scenario specification Definition file could look like

CreateCompany <DataFile to Use>
create Users<DataFile to Use>
Create Auction<DataFile to User>
Bid1<DataFile to User>
Bid2<DataFile to Use>
<parallel>
Bid3<DataFile to Use>
..
Bidn<DataFile to Use>
<parallel>

ApproveWinner<DataFile to Use>

The above file could be XML  or csv.
Probably it needs more parameters like expected result from this step etc.

For each of the activities( each step in the scenario file ) there is a 
executeActivity meta data file which is registered with the engine which 
tells the test engine what it needs to do when it encounters a specific 
activity
So for CreateCompany activity this file would specify something like
execute create() method com.mycompany.auction.Company object .

Now using jave reflection the test engine can go and execute this method 
with the data being read from the datafile specified to it from the scenario 
file .

One thing I have to think in detailed is how do I chain these activities  
pass results from one activity to another one etc. Might be we can have a 
vector of objects passed from one activity to another.

There are some engine specific tags like <parallel> which indicate that all 
the steps embedded in those tags should be run con currently.

Advantages of having such a engine are
Theritically we just identify the activities in a product & specify the 
execution details for this activity and we are ready to go.


My questions to you all is
Can I use Cactus to achive some thing like this.
Is there a commercial or open source tool to achieve something like this.


Thanx

Rajesh


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Doing scenario based testing

Posted by Vincent Massol <vm...@octo.com>.
Hi Rajesh,

> -----Original Message-----
> From: Rajesh Kanade [mailto:rkanade@hotmail.com]
> Sent: 19 February 2002 00:43
> To: cactus-user@jakarta.apache.org
> Cc: rkanade@hotmail.com
> Subject: Doing scenario based testing
> 
> Hi All
> 
> I am new to cactus and new to testing arena itself.
> 
> My company writes web based applications ( using MVC ) and I am
looking at
> automating testing at various levels.The server side code is entirely
> return
> in Java ( no EJB ).
> 
> I am trying to come up with a framework ( or use one if it exists
already
> )
> so that we can test our application at various levels like
> class level, component level, sub system , system ( all this done
without
> UI
> in picture )
> So for a class level I can use JUnit to do my testing.
> My idea was to build upon this to do component testing & then reuse
these
> stuff as I move higher in the chain to do sub system and system
testing.
> 
> I was planning on doing something like this.
> I am taking an auction example where we wanted to test a ( auction
> creation
> / bidding )scenario
> 
> So let's say we wanted to create company, users, set up an auction,
Bid on
> the auction, Approve Winner.
> 
> So in this case a Scenario specification Definition file could look
like
> 
> CreateCompany <DataFile to Use>
> create Users<DataFile to Use>
> Create Auction<DataFile to User>
> Bid1<DataFile to User>
> Bid2<DataFile to Use>
> <parallel>
> Bid3<DataFile to Use>
> ..
> Bidn<DataFile to Use>
> <parallel>
> 
> ApproveWinner<DataFile to Use>
> 
> The above file could be XML  or csv.

Or java ...

> Probably it needs more parameters like expected result from this step
etc.
> 
> For each of the activities( each step in the scenario file ) there is
a
> executeActivity meta data file which is registered with the engine
which
> tells the test engine what it needs to do when it encounters a
specific
> activity
> So for CreateCompany activity this file would specify something like
> execute create() method com.mycompany.auction.Company object .
> 
> Now using jave reflection the test engine can go and execute this
method
> with the data being read from the datafile specified to it from the
> scenario
> file .
> 

If you're testing java code, the best "scripting" engines to do that are
either java itself or something like jpython, beanshell, etc. You need
to be able to directly manipulate java objects. Forget XML, CSV, etc.
You'll find yourself very limited.

> One thing I have to think in detailed is how do I chain these
activities
> pass results from one activity to another one etc. Might be we can
have a
> vector of objects passed from one activity to another.
> 
> There are some engine specific tags like <parallel> which indicate
that
> all
> the steps embedded in those tags should be run con currently.
> 
> Advantages of having such a engine are
> Theritically we just identify the activities in a product & specify
the
> execution details for this activity and we are ready to go.
> 
> 
> My questions to you all is
> Can I use Cactus to achive some thing like this.
> Is there a commercial or open source tool to achieve something like
this.
> 

I think you're mixing 2 requirements :
1/ the ability to test at the method level, i.e. verify that when you
call a method with such parameters it returns such values,
2/ the ability to fully test a use case

For 1/ you must use a unit testing framework : JUnit + mockobjects or
Cactus

For 2/ you need a functional testing framework : HttpUnit is a good one
if the interface of your application is HTTP.

> 
> Thanx
> 
> Rajesh
> 

Hope it helps
-Vincent

> 
> _________________________________________________________________
> Join the world's largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>