8

I wanted to test my project with Locust on Windows 10.

The script seems to run properly (no errors in CMD), but i can't connect to the web interface http://127.0.0.1:8089 (ERR_CONNECTION_REFUSED).

I am guessing, that this has to do with browser/Windows config, but i can't find the problem. I have no proxy set up in LAN settings, i get my IP from DNS, and i have no changes in my hosts file.

locustfile.py:

python
from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):
    def on_start(self):
        """ on_start is called when a Locust start before any task is scheduled """
        self.login()

    def on_stop(self):
        """ on_stop is called when the TaskSet is stopping """
        self.logout()

    def login(self):
        self.client.post("/login", {"username":"tester", "password":"abcd1234"})

    def logout(self):
        self.client.post("/logout", {"username":"ellen_key", "password":"education"})

    @task(2)
    def index(self):
        self.client.get("/")

    @task(1)
    def profile(self):
        self.client.get("/profile")

class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 5000
    max_wait = 9000
    host="http://google.com"

CMD:

D:\workspace\WebTesting>locust

CMD result:

[2019-05-13 09:49:45,069] LB6-001-DTMH/INFO/locust.main: Starting web monitor at *:8089
[2019-05-13 09:49:45,070] LB6-001-DTMH/INFO/locust.main: Starting Locust 0.11.0

When i interrupt the script in the command line i get the KeyboardInterrupt message and some statistics without data.

python -m http.server 8089 seems to work.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
Bladerxdxi
  • 111
  • 1
  • 8

2 Answers2

12

Try going to http://localhost:8089/

I am not quite sure why, but I can't reach the Locust webinterface through http://127.0.0.1 either (other webservers run fine locally with this address), but going to localhost does work for me.

Johan
  • 477
  • 4
  • 8
4

I faced a similar issue. Instead of using IP address, try using localhost. http://localhost:portnumber -> http://localhost:8089. This solved the issue for me.

christopher.online
  • 2,614
  • 3
  • 28
  • 52