Passing Parameters to Tests #1240
-
I now have parameterized test limits:
. However, the test itself needs a parameter: the signal to retrieve. I have this code:
In this example, the lic is hardcoded. I need to pass in the value to get. I tried to put a name on test.measurements.bytes but that didn't work. Any ideas appreciated! |
Beta Was this translation helpful? Give feedback.
Answered by
glados-verma
Jul 17, 2025
Replies: 2 comments
-
You can add args to your phases (should go after TestApi and any plugs):
Then "bind" the arg value to the phase descriptor using with_args:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
glados-verma
-
That did it. Thanks!
…________________________________
From: glados-verma ***@***.***>
Sent: Thursday, July 17, 2025 6:26 PM
To: google/openhtf ***@***.***>
Cc: William Tribley ***@***.***>; Author ***@***.***>
Subject: Re: [google/openhtf] Passing Parameters to Tests (Discussion #1240)
You can add args to your phases (should go after TestApi and any plugs):
@htf.plug(dv=PlugDataVac)
def byteCountTest(test, dv, lic):
test.measurements.bytes=dv.getLic(lic)
print(f'The value is {test.measurements.bytes}.')
if dv.getStatus():
return htf.PhaseResult.CONTINUE
else:
return htf.PhaseResult.STOP
Then "bind" the arg value to the phase descriptor using with_args<https://github.com/google/openhtf/blob/2b5fe5b02d05676114c961604d37bfd09c4b7b34/openhtf/core/phase_descriptor.py#L282>:
dynamicTestPhases.append(htf.measures(pmeasurement)(byteCountTest.with_args(lic="HDR-04-1")))
—
Reply to this email directly, view it on GitHub<#1240 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AR6TVWVSSACJ3YDQP2X2QJ33JAWIRAVCNFSM6AAAAACBZCTJKWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZZHEYTONA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add args to your phases (should go after TestApi and any plugs):
Then "bind" the arg value to the phase descriptor using with_args: