How to use test_get_rps_list method in yandex-tank

Best Python code snippet using yandex-tank

test_load_plan.py

Source:test_load_plan.py Github

copy

Full Screen

1import pytest2from yandextank.stepper.load_plan import create, Const, Line, Composite, Stairway3from yandextank.stepper.util import take4class TestLine(object):5 def test_get_rps_list(self):6 lp = create(["line(1, 100, 10s)"])7 rps_list = lp.get_rps_list()8 assert len(rps_list) == 119 assert rps_list[-1][0] == 10010@pytest.mark.parametrize(11 "rps, duration, rps_list",12 [(100, 3000, [(100, 3)]), (0, 3000, [(0, 3)]), (100, 0, [(100, 0)])])13class TestConst(object):14 @pytest.mark.parametrize(15 "check_point, expected",16 [(lambda duration: 0, lambda rps: rps),17 (lambda duration: duration / 2, lambda rps: rps),18 (lambda duration: duration + 1, lambda rps: 0),19 (lambda duration: -1, lambda rps: 0)])20 def test_rps_at(self, rps, duration, rps_list, check_point, expected):21 assert Const(rps,22 duration).rps_at(check_point(duration)) == expected(rps)23 def test_get_rps_list(self, rps, duration, rps_list):24 assert Const(rps, duration).get_rps_list() == rps_list25 assert isinstance(rps_list[0][1], int)26class TestLineNew(object):27 @pytest.mark.parametrize(28 "min_rps, max_rps, duration, check_point, expected",29 [(0, 10, 30 * 1000, 0, 0), (0, 10, 30 * 1000, 10, 3),30 (0, 10, 30 * 1000, 29, 10), (9, 10, 30 * 1000, 1, 9),31 (9, 10, 30 * 1000, 20, 10)])32 def test_rps_at(self, min_rps, max_rps, duration, check_point, expected):33 assert round(Line(min_rps, max_rps, duration).rps_at(34 check_point)) == expected35 @pytest.mark.parametrize(36 "min_rps, max_rps, duration, check_point, expected",37 [38 (0, 10, 20 * 1000, 9, (9, 2)),39 (0, 10, 30 * 1000, 0, (0, 2)),40 (0, 10, 30 * 1000, 5, (5, 3)),41 (0, 10, 30 * 1000, 10, (10, 2)),42 (0, 10, 3 * 1000, 0, (0, 1)),43 (0, 10, 3 * 1000, 1, (3, 1)),44 (0, 10, 3 * 1000, 2, (7, 1)),45 (0, 10, 3 * 1000, 3, (10, 1)),46 (9, 10, 30 * 1000, 0, (9, 15)),47 (9, 10, 30 * 1000, 1, (10, 16)),48 (10, 10, 30 * 1000, 0, (10, 31)), # strange49 (10, 0, 30 * 1000, 0, (10, 2)),50 (10, 0, 30 * 1000, 1, (9, 3)),51 (10, 0, 30 * 1000, 9, (1, 3)),52 (10, 0, 30 * 1000, 10, (0, 2)),53 ])54 def test_get_rps_list(55 self, min_rps, max_rps, duration, check_point, expected):56 assert Line(min_rps, max_rps,57 duration).get_rps_list()[check_point] == expected58 @pytest.mark.parametrize(59 "min_rps, max_rps, duration, expected_len, threshold, len_above_threshold",60 [61 (2, 12, 25000, 175, 5000, 160),62 (2, 12, 25000, 175, 10000, 135),63 (2, 12, 25000, 175, 15000, 100),64 (2, 12, 25000, 175, 20000, 55),65 (0, 10, 25000, 125, 15000, 80),66 (10, 12, 20000, 220, 10000, 115),67 (10, 10, 20000, 200, 10000, 100),68 (10, 0, 25000, 125, 10000, 45),...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful