You have two options:
1) -- Use nested params:
<method name="testVector" test-case="simplehashmap">
<params>
<param name="vectorTest" type="java.util.Vector"
key-type="" value-type="java.lang.String">
<param name="">item1</param>
<param name="">item2</param>
<param name="">item3</param>
</param>
</params>
</method>
and the java test is :
public void testVector() throws Exception {
Vector testCases = null;
HashMap params = null;
_jtestcase = new JTestCase(dataFile);
testCases = _jtestcase.getTestCaseInstances("GetParamTest",
"testVector");
// for each test case
for (int i = 0; i < testCases.size(); i++) {
TestCaseInstance testCase = ((TestCaseInstance) testCases
.elementAt(i));
params = testCase.getTestCaseParams();
Vector vectorTest = (Vector) params.get("vectorTest");
assertTrue("vector has not the right size ", vectorTest.size() ==
3);
String item1 = (String) vectorTest.get(0);
assertTrue("vector first item is not equal to item1 ", item1
.equals("item1"));
String item2 = (String) vectorTest.get(1);
assertTrue("vector first item is not equal to item2 ", item2
.equals("item2"));
String item3 = (String) vectorTest.get(2);
assertTrue("vector first item is not equal to item3 ", item3
.equals("item3"));
}
}
---- 2) Use Jice for collections
http://jtestcase.sourceforge.net/jicecollections.html
(the example is really about hashmap but i'm sure it will be
easy to
figure out how to do for vector)
Let me know if this solves your problem
Fausto
Try to make sure that the method
Vector userVector =
(Vector)getTestCaseVectorParameter(method, testCase, "userVector");
you are passing the right values for "method" and "testCase" parameter.
I'm afraid I can't tell nothing more appropriate just from code
inspection.
My advice would be to upgrade to the last release, just because the use
API
tries to cope exactly with this type of problems.
If you still have your problem, then try to upload your testcase I'll
take a look
at it personally as soon as I can.
Fausto
Thank you for your help, it works *_*
Kindly, regards
yanyan
On 3/9/06, Yuqing Wang <yuqing...@yahoo.com> wrote:
Hi YanYan,
I've been out of date from the latest veriosn of JTestCase for a while.
Luckily I still have the JTestCase 2.2.0 installed in my machine.
Here's the suggestion:
1) the data file is correct
2) try following code:
// get hashed params for this test case
Hashtable params = _jtestcase.getTestCaseParams("testLogin",
testCase);
try {
Vector userVector = (Vector)params.get("userVector");
...
Hope this helps.
Yuqing