RE:RE Data driven approach?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RE:RE Data driven approach?

siva sakthi ganesh
Hi Chris

I followed a similar approach by reading a list of values using Junit test setup method from a file. I tried to used those set of values as the input to a method....
In the method i looped through the input values and tried to assert the values.....But the big problem with junit test method is once an assert fails it quits from that method and does not continue further execution of that method...So you cant use assert for a set of values as input ....
Is there a better way to execute a set of test methods for different inputs....?

Rgds
Siva



From: Erskine, Chris <chris@ed...>
RE: Data driven approach?  
2005-10-20 04:47


The way to handle this is to allow your JUnit test to read the values
that in needs from a file. There is nothing about JUnit or HTMLunit
that requires the values be coded in the file. I just developed an
integration test that is executed under JUnit. It reads from a CSV file
and uses the first like to send to the server and the second line to
determine what the response from the server should look like.



Chris Erskine



EDS Consulting Services

Colorado Springs, CO



Phone: 719-265-5962

Cell: 719-640-6488

________________________________

From: [hidden email]
[mailto:[hidden email]] On Behalf Of siva
sakthi ganesh
Sent: Wednesday, October 19, 2005 8:34 PM
To: [hidden email]
Subject: [Htmlunit-user] Data driven approach?



Hi,

As far as i understand htmlunit uses junit to write test cases.....

And test case written with junit are not data driven...........

you provide the data to a method and u assert whether it is equal to a
particular value or not.......

Is there an approach by which u specific the list of data in xml and
read that xml and send it to htmlunit...to execute the test cases......

And using ant i know we can format the output into html ............


Rgds,
Siva


Reply | Threaded
Open this post in threaded view
|

RE: RE:RE Data driven approach?

Erskine, Chris

This is why they talk about building many tests with each test testing one thing.  If you are trying to build a script that you want to report multiple errors from a single procedure, the JUnit is not the platform that you want to work with although you could adapt it and change the model that you are working with to use it.  You can also use it to start your test but then as you know, you do not want to use asserts.  You could also use the asserts and trap them yourself to log the message and then continue processing.  This is something you will have to decide on.

 

The other thing that you can do is to build your own framework that works the way that you want it to.  

 

The starting premise that you have to use JUnit to use HTMLunit is false.  HTMLunit does not require you to use JUnit.

 

Chris Erskine

 

EDS Consulting Services

Colorado Springs, CO 

 

Phone: 719-265-5962

Cell: 719-640-6488


From: [hidden email] [mailto:[hidden email]] On Behalf Of siva sakthi ganesh
Sent: Thursday, October 20, 2005 8:54 PM
To: [hidden email]
Subject: [Htmlunit-user] RE:RE Data driven approach?

 

Hi Chris

I followed a similar approach by reading a list of values using Junit test setup method from a file. I tried to used those set of values as the input to a method....
In the method i looped through the input values and tried to assert the values.....But the big problem with junit test method is once an assert fails it quits from that method and does not continue further execution of that method...So you cant use assert for a set of values as input ....
Is there a better way to execute a set of test methods for different inputs....?

Rgds
Siva



From: Erskine, Chris <chris@ed...>
RE: Data driven approach?  
2005-10-20 04:47



The way to handle this is to allow your JUnit test to read the values
that in needs from a file.  There is nothing about JUnit or HTMLunit
that requires the values be coded in the file.  I just developed an

integration test that is executed under JUnit.  It reads from a CSV file
and uses the first like to send to the server and the second line to
determine what the response from the server should look like.


 

Chris Erskine

 

EDS Consulting Services

Colorado Springs, CO

 

Phone: 719-265-5962

Cell: 719-640-6488

________________________________

From: [hidden email]
[hidden email]
[mailto:[hidden email]] On Behalf Of siva
sakthi ganesh
Sent: Wednesday, October 19, 2005 8:34 PM

To: [hidden email]
Subject: [Htmlunit-user] Data driven approach?

 

Hi,

As far as i understand htmlunit uses junit to write test cases.....


And test case written with junit are not data driven...........

you provide the data to a method and u assert whether it is equal to  a
particular value or not.......

Is there an approach by which u specific the list of data in xml and

read that xml and send it to htmlunit...to execute the test cases......

And using ant i know we can format the output into html ............


Rgds,
Siva