New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarking when session is required #12

Closed
tsironis opened this Issue Apr 2, 2013 · 19 comments

Comments

Projects
None yet
5 participants
@tsironis

tsironis commented Apr 2, 2013

This is not really a bug, just a question I have for quite some time now.

If I would want to benchmark my webapp which requires logging in, can I configure wbench to do this for me? Have anyone done this before?

Thanks in advance and awesome work on wbench!

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic Apr 2, 2013

Member

Great suggestion, I can see a way that I can add this, i'm just not sure what is the easiest way to allow you to set a session.

Would entering the session variables be too complex? For example entering your session token as a flag you pass in?

I'm not too sure of any other ways to do this, any ideas?

Member

mariovisic commented Apr 2, 2013

Great suggestion, I can see a way that I can add this, i'm just not sure what is the easiest way to allow you to set a session.

Would entering the session variables be too complex? For example entering your session token as a flag you pass in?

I'm not too sure of any other ways to do this, any ideas?

@tsironis

This comment has been minimized.

Show comment
Hide comment
@tsironis

tsironis Apr 2, 2013

Hmmm, I'm not a backend guy, so I don't know exactly how it can be implemented. Maybe entering the credentials, as arguments (?)

Again, I'm not even remotely expert in this, but it could be something like this:

wbench -u username -p 1234

tsironis commented Apr 2, 2013

Hmmm, I'm not a backend guy, so I don't know exactly how it can be implemented. Maybe entering the credentials, as arguments (?)

Again, I'm not even remotely expert in this, but it could be something like this:

wbench -u username -p 1234

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic Apr 2, 2013

Member

Unfortunately it's probably going to be much more complex than that, depending on how your authentication works. If you're using basic authentication on your app; for example if it looks like this:

basic auth

Then you can already login using http://username:password@www.website-url.com/

Member

mariovisic commented Apr 2, 2013

Unfortunately it's probably going to be much more complex than that, depending on how your authentication works. If you're using basic authentication on your app; for example if it looks like this:

basic auth

Then you can already login using http://username:password@www.website-url.com/

@tsironis

This comment has been minimized.

Show comment
Hide comment
@tsironis

tsironis Apr 3, 2013

This looks very easy and plausible, but I guess it should be cashed, in order to reuse the session for each reload wbench does. If I'm correct, wbench does quite a lot reloads and then takes an average from them. So imagine entering your creds, 10 times in a row. Madness!

Also, a lot of modern webapps these days use authentication systems with Facebook, Twitter, Github etc. How can we manage to do that? Again, I'm not an expert, just throwing ideas to you 😃

tsironis commented Apr 3, 2013

This looks very easy and plausible, but I guess it should be cashed, in order to reuse the session for each reload wbench does. If I'm correct, wbench does quite a lot reloads and then takes an average from them. So imagine entering your creds, 10 times in a row. Madness!

Also, a lot of modern webapps these days use authentication systems with Facebook, Twitter, Github etc. How can we manage to do that? Again, I'm not an expert, just throwing ideas to you 😃

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic Apr 3, 2013

Member

Oh, I wasn't suggesting that as a solution, I was saying that if you have basic authentication on your application (what you see in the screenshot with the browser popup) then you could test it using the URL string.

If your authentication is a username and password that you enter on the website then it'll be a bit harder to test, you would have to pass session/cookie values to the app which could be tricky for non technical folk.

Member

mariovisic commented Apr 3, 2013

Oh, I wasn't suggesting that as a solution, I was saying that if you have basic authentication on your application (what you see in the screenshot with the browser popup) then you could test it using the URL string.

If your authentication is a username and password that you enter on the website then it'll be a bit harder to test, you would have to pass session/cookie values to the app which could be tricky for non technical folk.

@tsironis

This comment has been minimized.

Show comment
Hide comment
@tsironis

tsironis Apr 3, 2013

Cool, I see. Thanks anyway, Mario. I will mess around with it and if I have something working I will send you a pull request.

tsironis commented Apr 3, 2013

Cool, I see. Thanks anyway, Mario. I will mess around with it and if I have something working I will send you a pull request.

@collinforrester

This comment has been minimized.

Show comment
Hide comment
@collinforrester

collinforrester May 6, 2013

Any update on this @mariovisic @tsironis ? I'd be fine adding the session to the command line when I run it. I'm trying to run this on some internal web apps at work and it seems I'm going to have to have the session included. I don't have much experience with ruby or I'd figure it out myself.

collinforrester commented May 6, 2013

Any update on this @mariovisic @tsironis ? I'd be fine adding the session to the command line when I run it. I'm trying to run this on some internal web apps at work and it seems I'm going to have to have the session included. I don't have much experience with ruby or I'd figure it out myself.

@tsironis

This comment has been minimized.

Show comment
Hide comment
@tsironis

tsironis May 6, 2013

No updates on this. I have no experience in Ruby myself unfortunately.

tsironis commented May 6, 2013

No updates on this. I have no experience in Ruby myself unfortunately.

@phtrivier

This comment has been minimized.

Show comment
Hide comment
@phtrivier

phtrivier May 6, 2013

I read that the tool uses webdriver under the hood, would it make sense to add a bit of webdriver code to actually "type" credentials in the benchmarked browser (as we often do when writing functionnal tests against a site ?)

phtrivier commented May 6, 2013

I read that the tool uses webdriver under the hood, would it make sense to add a bit of webdriver code to actually "type" credentials in the benchmarked browser (as we often do when writing functionnal tests against a site ?)

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic May 7, 2013

Member

Sure, that's a possibility, but login systems don't work exactly the same on every single site so it would be difficult to get a really generic solution that would work everywhere. Field names are always different, plus you would have to get to the login page to enter your credentials.

Member

mariovisic commented May 7, 2013

Sure, that's a possibility, but login systems don't work exactly the same on every single site so it would be difficult to get a really generic solution that would work everywhere. Field names are always different, plus you would have to get to the login page to enter your credentials.

@collinforrester

This comment has been minimized.

Show comment
Hide comment
@collinforrester

collinforrester May 8, 2013

Yeah I think it'd be easier/more realistic if we could just get our session cookie from another browser instance and add that command line when we launch. Of course this would only work for session/cookie based authentication.

collinforrester commented May 8, 2013

Yeah I think it'd be easier/more realistic if we could just get our session cookie from another browser instance and add that command line when we launch. Of course this would only work for session/cookie based authentication.

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic May 8, 2013

Member

Google chrome has a "copy as CURL" option when right clicking on requests in the navigation part of the developer tools. I think if we kept the same syntax as curl and added some instructions in the readme then it wouldn't be too hard to get non technical people to be able to use it correctly.

I'm a bit busy at the moment so I can't dedicate any time for another 1-2 weeks. I'd definitely accept a patch for this behaviour though.

Member

mariovisic commented May 8, 2013

Google chrome has a "copy as CURL" option when right clicking on requests in the navigation part of the developer tools. I think if we kept the same syntax as curl and added some instructions in the readme then it wouldn't be too hard to get non technical people to be able to use it correctly.

I'm a bit busy at the moment so I can't dedicate any time for another 1-2 weeks. I'd definitely accept a patch for this behaviour though.

@collinforrester

This comment has been minimized.

Show comment
Hide comment
@collinforrester

collinforrester May 9, 2013

Right on. I'll ask around to see if anyone will start on this. I'm not much of a Ruby dev or I'd love to help myself.

collinforrester commented May 9, 2013

Right on. I'll ask around to see if anyone will start on this. I'm not much of a Ruby dev or I'd love to help myself.

@inkel

This comment has been minimized.

Show comment
Hide comment
@inkel

inkel May 17, 2013

Perhaps doing this from the CLI is not as simple as expected, but given that wbench uses Selenium, couldn't be possible that, with the Ruby API you also expose Selenium's API to automate form completion, in a similar way as when it's used for acceptance tests?

inkel commented May 17, 2013

Perhaps doing this from the CLI is not as simple as expected, but given that wbench uses Selenium, couldn't be possible that, with the Ruby API you also expose Selenium's API to automate form completion, in a similar way as when it's used for acceptance tests?

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic May 18, 2013

Member

Yes, that's possible, although it would be tricky to have an implementation that would work for all websites as every one will be slightly different.

Member

mariovisic commented May 18, 2013

Yes, that's possible, although it would be tricky to have an implementation that would work for all websites as every one will be slightly different.

@inkel

This comment has been minimized.

Show comment
Hide comment
@inkel

inkel May 28, 2013

What I meant was exposing the API so one can program writing each field accordingly to the implementation of every website. Sort of:

opts = { :loops => 3, :browser => :chrome }
results = WBench::Benchmark.run('https://www.google.com/', opts) do |driver|
  e = driver.find_element(:name, "q")
  e.send_keys "do a roll"
  e.submit
end

inkel commented May 28, 2013

What I meant was exposing the API so one can program writing each field accordingly to the implementation of every website. Sort of:

opts = { :loops => 3, :browser => :chrome }
results = WBench::Benchmark.run('https://www.google.com/', opts) do |driver|
  e = driver.find_element(:name, "q")
  e.send_keys "do a roll"
  e.submit
end
@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic May 28, 2013

Member

Oh sorry, I misunderstood. Yes I think that might be a good thing to add. Maybe the interface could be slightly different though, maybe something like:

benchmark = WBench::Benchmark.new(url, options)

benchmark.before_each do |driver|
  e = driver.find_element(:name, "q")
  e.send_keys "do a roll"
  e.submitend
end

results = benchmark.run(10)

I'd would definitely a patch for this kind of behaviour.

Member

mariovisic commented May 28, 2013

Oh sorry, I misunderstood. Yes I think that might be a good thing to add. Maybe the interface could be slightly different though, maybe something like:

benchmark = WBench::Benchmark.new(url, options)

benchmark.before_each do |driver|
  e = driver.find_element(:name, "q")
  e.send_keys "do a roll"
  e.submitend
end

results = benchmark.run(10)

I'd would definitely a patch for this kind of behaviour.

@inkel

This comment has been minimized.

Show comment
Hide comment
@inkel

inkel May 28, 2013

Yes, I like that interface as well :)

inkel commented May 28, 2013

Yes, I like that interface as well :)

@mariovisic

This comment has been minimized.

Show comment
Hide comment
@mariovisic

mariovisic Jun 21, 2013

Member

Sorry for the wait, this is now possible through the ruby API in v0.3.7. Check out the readme here: https://github.com/desktoppr/wbench#benchmarking-authenticated-pages

Let me know if you have any questions or issues.

Cheers
Mario

Member

mariovisic commented Jun 21, 2013

Sorry for the wait, this is now possible through the ruby API in v0.3.7. Check out the readme here: https://github.com/desktoppr/wbench#benchmarking-authenticated-pages

Let me know if you have any questions or issues.

Cheers
Mario

@mariovisic mariovisic closed this Jun 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment