04-11-2023 02:51 AM - edited 04-11-2023 02:53 AM
Hello,
I'm trying to pass an argument to a sequence using the teststand API and the "Engine.NewExecution" method. A container to be more accurate. I've managed to pass strings, numbers... but not containers, well, that's not true, I've passed empty container successfully.
I'm using python to do this but the API works the same as if I'd use VB. This is my code snippet :
# New property object of tye container containing sequence params
sequenceParams = self.tsEngine.NewPropertyObject(0x00, False, "", 0)
sequenceParams.SetValString("TestValue", 0x01, "Hello")
# Create new property object corresponding to TapData container then add it to sequenceParams
tapData = self.tsEngine.NewPropertyObject(0x00, False, "", 0)
tapData.SetValString("TapTest", 0x01, "Hello")
sequenceParams.InsertSubProperty("TapData", 0x01, 0, tapData)
seqExec = self.tsEngine.NewExecution(seqFile, "MainSequence", None, False, 0, sequenceParams)
Sorry about those configuration constants. I know I'm using the raw values instead of their names, but I havent figured out a way to include them in my python script yet.
This is the sequence parameters :
I get the following error (which is a bit ambiguous):
seqExec = self.tsEngine.NewExecution(seqFile, "MainSequence", None, False, 0, sequenceParams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nharel.ext\AppData\Local\Temp\gen_py\3.11\B2794EF3-C0B6-11D0-939C-0020AF68E893x0x1x0.py", line 3638, in NewExecution
ret = self._oleobj_.InvokeTypes(110, LCID, 1, (9, 0), ((9, 1), (8, 1), (9, 1), (11, 1), (3, 1), (12, 17), (12, 17), (12, 17)),sequenceFileParam
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'TSAPI', "Error calling sequence MainSequence.\nType of argument is incompatible with parameter 'TapData'. Expected Container, found Container.", None, 0, -17332), None)
Expected Container, found Container ? Anyone have any idea what I'm doing wrong, if I'm doing something wrong ?
Thank you, have a nice day.
04-12-2023 03:50 AM
Nothing ?
I'm guessing this is not a normal behaviour from Teststand...
04-14-2023 02:29 AM
Bumping this one last time.
04-14-2023 01:27 PM
Not sure about the bad error message. Does TapData in the parameters have a type?
Have you tried right-clicking on the sequence parameter and unchecking the Check Type option?
04-25-2023 02:16 AM
Hello James,
TapData was a container. The fields inside this container were just a bunch of integers, but I've also tried with strings, and tested pretty much everything. Always had the same error. The only thing that "works" is passing empty containers.
Anyway, we ended up deleting all our container params and replacing them with "classic" types. Not optimal at all, really dirty, but it works.
I haven't tried disabling the type check in Teststand.
06-21-2024 09:27 AM - edited 06-21-2024 09:29 AM
Hello everyone,
I'm still quite new to TestStand, so I'm not sure if this will be helpful.
I encountered the error message "Expected Container, found Container." when I used a container as a parameter.
The problem was that the elements in the container did not have the same names as the elements in the container in the sequence that was called. Unlike an array, the order in a container can be rearranged with drag and drop, but to identify them correctly, the names must be identical.
I hope this helps.
06-22-2024 09:19 AM
Names are used to identify container elements. Otherwise it would be hard to tell two or more elements of the same type apart.
BTW…. Probably consider using typedefs for containers