Exemplo n.º 1
0
 class CpuLocust(Locust):
     wait_time = constant(0)
     class task_set(TaskSet):
         @task
         def cpu_task(self):
             for i in range(1000000):
                 _ = 3 / 2
Exemplo n.º 2
0
        class BaseLocust(Locust):
            wait_time = constant(1)

            class task_set(TaskSet):
                @task
                def trigger(self):
                    triggered[0] = True
Exemplo n.º 3
0
        class User(Locust):
            wait_time = constant(1)

            class task_set(TaskSet):
                @task
                def my_task(self):
                    pass
Exemplo n.º 4
0
        class User(Locust):
            wait_time = constant(1)
            task_run_count = 0

            @task
            def my_task(self):
                User.task_run_count += 1
Exemplo n.º 5
0
 class MySubTaskSet(TaskSet):
     wait_time = constant(0.001)
     @task()
     def a_task(self):
         self.locust.sub_taskset_args = self.args
         self.locust.sub_taskset_kwargs = self.kwargs
         self.interrupt()
Exemplo n.º 6
0
            class CpuLocust(Locust):
                wait_time = constant(0.001)

                @task
                def cpu_task(self):
                    for i in range(1000000):
                        _ = 3 / 2
Exemplo n.º 7
0
 class task_set(TaskSet):
     wait_time = constant(0)
     @task
     def the_task(self):
         MyTestLocust._test_state = 1
         gevent.sleep(0.2)
         MyTestLocust._test_state = 2
Exemplo n.º 8
0
        class MySubTaskSet(TaskSet):
            constant(1)

            @task()
            def a_task(self):
                self.locust.sub_locust_task_executed = True
                self.interrupt()
Exemplo n.º 9
0
 class MyTestLocust(Locust):
     _test_state = 0
     wait_time = constant(0)
     @task
     def the_task(self):
         MyTestLocust._test_state = 1
         gevent.sleep(0.2)
         MyTestLocust._test_state = 2
Exemplo n.º 10
0
 class TestUser(Locust):
     wait_time = constant(0)
     test_state = 0
     @task
     def t(self):
         self.test_state = 1
         sleep(0.1)
         self.test_state = 2
Exemplo n.º 11
0
        class TestUser(Locust):
            wait_time = constant(0.01)

            @task
            def t(self):
                log.append(0)
                self.wait()
                log.append(1)
                raise StopLocust()
Exemplo n.º 12
0
 class TestUser(Locust):
     wait_time = constant(0.1)
     @task
     def incr_stats(l):
         l.environment.events.request_success.fire(
             request_type="GET",
             name="/",
             response_time=1337,
             response_length=666,
         )
Exemplo n.º 13
0
 class MyLocust(Locust):
     wait_time = constant(0)
     @task
     def t1(self):
         pass
     @task
     class MyTaskSet(TaskSet):
         @task
         def subtask(self):
             state[0] = 1
             raise StopLocust()
Exemplo n.º 14
0
 class User(Locust):
     setup_run_count = 0
     task_run_count = 0
     locust_error_count = 0
     wait_time = constant(1)
     class task_set(TaskSet):
         def setup(self):
             User.setup_run_count += 1
             raise Exception("some exception")
         @task
         def my_task(self):
             User.task_run_count += 1
Exemplo n.º 15
0
        class User(Locust):
            wait_time = constant(0)

            class task_set(TaskSet):
                @task
                def my_task(self):
                    self.locust.environment.events.request_success.fire(
                        request_type="GET",
                        name="/test",
                        response_time=666,
                        response_length=1337,
                    )
                    sleep(2)
Exemplo n.º 16
0
 class MyTestLocust(Locust):
     task_set = MyTaskSet
     wait_time = constant(0)
Exemplo n.º 17
0
 class MyLocust(Locust):
     wait_time = constant(0.01)
     task_set = MyTaskSet
Exemplo n.º 18
0
            class TS(TaskSet):
                wait_time = constant(3)

                @task
                def t(self):
                    pass
Exemplo n.º 19
0
 class User(Locust):
     wait_time = constant(3)
Exemplo n.º 20
0
 class TestUser(Locust):
     wait_time = constant(10)
     @task
     def t(self):
         self.environment.runner.stats.log_request("GET", "/", 10, 10)
Exemplo n.º 21
0
 class MyTestLocust(Locust):
     tasks = [MyTaskSet]
     wait_time = constant(0)
Exemplo n.º 22
0
        class User(Locust):
            wait_time = constant(1)

            @task
            def my_task(self):
                pass
Exemplo n.º 23
0
 class MyLocust(Locust):
     wait_time = constant(0.01)
     tasks = [MyTaskSet]
Exemplo n.º 24
0
class MyHttpLocust(HttpLocust):
    task_set = MyTaskSet
    wait_time = constant(1)
    host = "http://example.com"
Exemplo n.º 25
0
class MyHttpLocust(HttpLocust):
    task_set = UserBehavior
    wait_time = constant(0)
    host = "http://example.com"
Exemplo n.º 26
0
class MySocketIOLocust(SocketIOLocust):
    task_set = UserBehaviour
    wait_time = constant(0)
    if __name__ == "__main__":
        host = "http://example.com"
Exemplo n.º 27
0
 class User(Locust):
     wait_time = constant(0.5)
     tasks = [MyTasks]
Exemplo n.º 28
0
        class MyUser(Locust):
            t2_executed = False
            on_stop_executed = False

            tasks = [MyTasks]
            wait_time = constant(0.1)
Exemplo n.º 29
0
class MyHttpLocust(FastHttpLocust):
    task_set = UserBehavior
    wait_time = constant(0)
Exemplo n.º 30
0
class MyHttpLocust(HttpLocust):
    task_set = UserBehavior
    wait_time = constant(1)
    if __name__ == "__main__":
        host = "https://www.example.com"