Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIL testing? #1089

Open
kehrazy opened this issue Mar 31, 2023 · 5 comments
Open

HIL testing? #1089

kehrazy opened this issue Mar 31, 2023 · 5 comments

Comments

@kehrazy
Copy link
Contributor

kehrazy commented Mar 31, 2023

how would i go about making a test that goes on for n amount of time? i need to

  • gather data
  • check the data
  • log the erroneous measurements, if needed
  • repeat, if the time has not passed

does this library has this functionality? thanks

@glados-verma
Copy link
Collaborator

I don't see a direct way to specify that a phase should be repeated until x time has passed (you can set a timeout, but that's not exactly what you're asking about here). I'd suggest setting a measurement that records the start time, and then running a phase on repeat until the desired time has passed. In that phase you can check this measurement and return PhaseResult.REPEAT until the desired amount of time has passed.

@kehrazy
Copy link
Contributor Author

kehrazy commented Apr 5, 2023

Hey, thanks for the response. Yeah, this kind of functionality might be out of the design goals of the library, however, something along the lines of

#: runs for 60 secods, with a .5 sleep in between the runs
@htf.PhaseOptions(looping=True, interval=.5, duration=60)
def polling_test():
    pass

def main():
    test = htf.Test(
        #: this behaviour should spawn a threading.Thread instead,
        #: and skip right into the next phase
        polling_test,
        some_other_phase
    )
    test.execute()


if __name__ == '__main__':
    main()

would be extremely useful.

@glados-verma
Copy link
Collaborator

Agreed it would be useful! One question I have is how do you make a phase run for exactly the amount of time specified "from outside the phase" i.e. from the framework. E.g. in your example, is polling_test run in a thread for 60 seconds, at the end of which the thread is terminated and a new one is started?

I suppose your use case could be met by adding a repeat_duration (perhaps with a better name) that works like repeat_limit but instead measures total time rather than number of repeats.

@kehrazy
Copy link
Contributor Author

kehrazy commented Apr 7, 2023

In my concrete example, I imagined the polling_test runs the phase body while the timeout has not been reached yet, the thread sleeps for the specified interval.

So, I would suppose it would run something along the lines of:

  • measure current time
  • time passed? if yes, stop/return from the thread.
  • run the phase body
  • sleep for the interval
  • repeat ;)

edit: the question was initially about the current functionality of the library, but seeing as such stuff isn't supported just yet, would we be able to achieve such feats sooner or later? thanks!

@kehrazy kehrazy closed this as completed Apr 7, 2023
@kehrazy kehrazy reopened this Apr 7, 2023
@kehrazy
Copy link
Contributor Author

kehrazy commented Apr 8, 2023

if anyone is wondering - you should look into the "core.monitors" file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants