From 07d4d951521ae2503cdd7a963bef37be6b1a30b6 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 23 Apr 2020 14:54:12 +0200 Subject: [PATCH] Add info about tasks directly under User, to Changelog --- docs/changelog.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2fae2ec13a..c301df4a8e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,35 @@ We've renamed the ``Locust`` and ``HttpLocust`` classes to ``User`` and ``HttpUs :py:class:`TaskSet ` instances has been renamed to :py:attr:`user `. +Ability to declare @task directly under the ``User`` class +---------------------------------------------------------- + +It's now possible to declare tasks directly under a User class like this: + +.. code-block:: python + + class WebUser(User): + @task + def some_task(self): + pass + +In tasks declared under a User class (e.g. ``some_task`` in the example above), ``self`` refers to the User +instance, as one would expect. For tasks defined under a :py:class:`TaskSet ` class, ``self`` +would refer to the ``TaskSet`` instance. + +The ``task_set`` attribute on the ``User`` class (previously ``Locust`` class) has been removed. To declare a +``User`` class with a single ``TaskSet`` one would now use the the :py:attr:`tasks ` +attribute instead: + +.. code-block:: python + + class MyTaskSet(TaskSet): + ... + + class WebUser(User): + tasks = [MyTaskSet] + + Other breaking changes ----------------------