Skip to content

Commit

Permalink
Use Unix timestamp instead of randint to insure unique values
Browse files Browse the repository at this point in the history
  • Loading branch information
notuxius committed Jul 28, 2019
1 parent 5dc7311 commit e334667
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion locustfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# from json.decoder import JSONDecodeError
import time
from random import randint

from locust import HttpLocust, TaskSet, task, runners
Expand All @@ -14,7 +15,7 @@ def post_user_action(self):

if 0 <= user_action <= 6:
payload = {"user_action": str(user_action),
"feedback": "Load testing Locust {}".format(randint(0, 999999999999999999))}
"feedback": "Load testing Locust {}".format(time.time())}
else:
payload = {"user_action": str(user_action),
"feedback": ""}
Expand Down
4 changes: 2 additions & 2 deletions test_popup_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def _click_button_input_feedback_click_send_wait(driver, popup_button):
popup_button.click()
feedback_area = driver.find_element_by_class_name("NPS__feedback-textarea")
feedback_area.click()
# Random number possibly will be used for future database auto tests for finding the right fields
feedback_area.send_keys("Testing WebDriver {}".format(randint(0, 999999999999999999)))
# Unix timestamp possibly will be used for future database auto tests for finding the right fields
feedback_area.send_keys("Testing WebDriver {}".format(time.time()))
send_button = driver.find_element_by_class_name("NPS__feedback-send")
send_button.click()
_sleep_time()
Expand Down

0 comments on commit e334667

Please sign in to comment.