Coder Social home page Coder Social logo

HIL testing? about openhtf HOT 5 OPEN

kehrazy avatar kehrazy commented on June 15, 2024
HIL testing?

from openhtf.

Comments (5)

glados-verma avatar glados-verma commented on June 15, 2024

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.

from openhtf.

kehrazy avatar kehrazy commented on June 15, 2024

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.

from openhtf.

glados-verma avatar glados-verma commented on June 15, 2024

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.

from openhtf.

kehrazy avatar kehrazy commented on June 15, 2024

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!

from openhtf.

kehrazy avatar kehrazy commented on June 15, 2024

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

from openhtf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.