Casting From Generic Object
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2010
07:16 AM
02-17-2010
07:16 AM
Casting From Generic Object
This is probably more of a VBScript question. I know that it is a limited in functionality but I haven't been able to figure out how to cast out of a Generic Object.
I am using VS2008 to handle all the testing and am running the RunRoutineEx function for my parms. I am passing in an ArrayList that has two String Arrays in them. They pass in fine and I can see the values of each String inside the String Array in the Immediate Window but I thought I would be able to just call parm(0) to get the index 0 value but that does not work because it classified as an object when it gets into the TC Scripts. What's a little different is if I call IsArray it returns true and if I call TypeName it says that it is a String() which makes sense but why can't I use it as such?
Hopefully this all makes sense.
I am using VS2008 to handle all the testing and am running the RunRoutineEx function for my parms. I am passing in an ArrayList that has two String Arrays in them. They pass in fine and I can see the values of each String inside the String Array in the Immediate Window but I thought I would be able to just call parm(0) to get the index 0 value but that does not work because it classified as an object when it gets into the TC Scripts. What's a little different is if I call IsArray it returns true and if I call TypeName it says that it is a String() which makes sense but why can't I use it as such?
Hopefully this all makes sense.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2010
10:54 PM
02-17-2010
10:54 PM
Hi Matthew,
You should be able to do this in the following way:
...
Dim props(1) As Object
props(0) = "Property1"
props(1) = "Property2"
Dim vals(1) As Object
vals(0) = "Value1"
vals(1) = "Value2"
Dim params(1) As Object
params(0) = props
params(1) = vals
Call IntegrationObject.RunRoutineEx("MyProject", "MyUnit", "TestArrParam", params)
...
Sub TestArrParam(properties, values)
For i = 0 To UBound(properties)
Log.Message properties(i) & " = " & values(i)
Next
End Sub
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2010
12:24 AM
02-18-2010
12:24 AM
That worked. So the problem was that I could pass in a generic object but not a string array.
Thanks.
Thanks.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2010
11:22 PM
02-18-2010
11:22 PM
Hi Matthew,
A generic object is converted to a value of the Variant type when passed to a test script via TestComplete's COM object.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
