github seleniumbase/SeleniumBase v4.5.6
4.5.6 - Performance Testing decorators

latest releases: v4.26.3, v4.26.2, v4.26.1...
19 months ago

Performance Testing decorators

  • Add Python decorators for performance testing
    --> 06c1959
    --> This resolves #1544
  • Refresh Python dependencies
    --> d69964b
  • Update tests with examples of performance testing
    --> 759423a

  • print_runtime(description=None, limit=None)
  • runtime_limit(limit, description=None)

  • print_runtime(description=None, limit=None)

Print the total runtime of the method / function or code block. The description option can be used for organizing the output when a test calls this multiple times. The limit option can be used to optionally set a time limit so that the test fails if the decorated code block takes longer than the time limit to complete (after it completes).

Method / Function example usage ->

from seleniumbase import decorators

@decorators.print_runtime("My Method")
def my_method():
    # code ...
    # code ...

with-block example usage ->

from seleniumbase import decorators

with decorators.print_runtime("My Code Block"):
    # code ...
    # code ...

  • runtime_limit(limit, description=None)

Fail if the runtime duration of a method or "with"-block exceeds the limit. (The failure won't occur until after the method or "with"-block completes.) The description option can be used for making the output more clear about which code block failed.

Method / Function example usage ->

from seleniumbase import decorators

@decorators.runtime_limit(4.5)
def my_method():
    # code ...
    # code ...

``with``-block example usage ->

```python
from seleniumbase import decorators

with decorators.runtime_limit(32):
    # code ...
    # code ...

Don't miss a new SeleniumBase release

NewReleases is sending notifications on new releases.