Last active
August 9, 2019 05:49
-
-
Save peterjpxie/c16286d8164bb9e6555deb4581e07686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import queue | |
import sys | |
import time | |
queue_results = queue.Queue() | |
# def test_mock_service(): - omitted | |
def loop_test(loop_wait=0, loop_times=sys.maxsize): | |
looped_times = 0 | |
while looped_times < loop_times: | |
# run an API test | |
test_result, elapsed_time = test_mock_service() | |
# put results into a queue for statistics | |
queue_results.put(['test_mock_service', test_result, elapsed_time]) | |
# You can add more API tests in a loop here. | |
looped_times += 1 | |
time.sleep(loop_wait) | |
if __name__ == '__main__': | |
loop_test(loop_times=3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment