Best Python code snippet using pyresttest_python
benchmark_framework_mini.py
Source:benchmark_framework_mini.py
...5 setup="from pycurl import Curl", number=1000000)6print('Curl create/destroy runtime for 1M runs (s)' + str(time))7# Test test interpret/build & configuration speeds for resttest8# Runtime is 36.29 sec, so 36 microseconds per run, or 0.036 ms9time = timeit.timeit("mytest=Test.parse_test('', input); mycurl=mytest.configure_curl(); mycurl.close()",10 setup='from resttest import Test; input = {"url": "/ping", "method": "DELETE", "NAME":"foo", "group":"bar", "body":"<xml>input</xml>","headers":{"Accept":"Application/json"}}',11 number=1000000)12print('Test interpret/configure test config for 1M runs (s)' + str(time))13# Just configuring the curl object from a pre-built test14# 10s/1M runs, or 0.01 ms per15time = timeit.timeit("mycurl=mytest.configure_curl(); mycurl.close()",16 setup='from resttest import Test; input = {"url": "/ping", "method": "DELETE", "NAME":"foo", "group":"bar", "body":"<xml>input</xml>","headers":{"Accept":"Application/json"}}; mytest=Test.parse_test("", input);',17 number=1000000)18print('Test configure curl for 1M runs (s)' + str(time))19# Time for full curl execution on Django testing rest app20# Time: 41.4s for 10k runs, or about 4.14 ms per21timeit.timeit("mycurl=mytest.configure_curl(); mycurl.setopt(pycurl.WRITEFUNCTION, lambda x: None); mycurl.perform(); mycurl.close()",22 setup='import pycurl; from resttest import Test; input = {"url": "/api/person/", "NAME":"foo", "group":"bar"}; mytest=Test.parse_test("http://localhost:8000", input);',23 number=10000)24# Github perf test, 27 s for 100 runs = 270 ms per25timeit.timeit("mycurl=mytest.configure_curl(); mycurl.setopt(pycurl.WRITEFUNCTION, lambda x: None); mycurl.perform(); mycurl.close()",26 setup='import pycurl; from resttest import Test; input = {"url": "/search/users?q=jewzaam", "NAME":"foo", "group":"bar"}; mytest=Test.parse_test("https://api.github.com", input);',...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!