Skip to content

Passing Parameters to Tests #1240

Closed Answered by glados-verma
wtt901 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

dynamicTestPhases.append(htf.measures(pmeasurement)(byteCountTest.with_args(lic="HDR-04-1")))

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by glados-verma
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants