L
Leonid Khachaturov
Hi,
I want to use webunit to drive the UI tests. I'm stuck with doing a
redirect. The code looks like that:
def test_login
url = 'http://localhost:8080/'
response = WebUnit::Response::get(url)
login_form = response.forms[0]
assert_equals('login-username', login_form.parameters[1].name)
assert_equals('login-password', login_form.parameters[2].name)
login_form.parameters[1].value = "mylogin"
login_form.parameters[2].value = "mypassword"
response = login_form.submit
redirect_url = response.url
response = tryRedirect(response, redirect_url)
...
end
def tryRedirect(response, url)
if response.code == '302'
response = Response:ost(url)
response = response.redirect
end
end
I'm getting the following error:
EOFError: End of file reached
c:/ruby/lib/ruby/1.8/net/protocol.rb:199:in `sysread'
c:/ruby/lib/ruby/1.8/net/protocol.rb:199:in `rbuf_fill'
c:/ruby/lib/ruby/1.8/net/protocol.rb:160:in `readuntil'
c:/ruby/lib/ruby/1.8/net/protocol.rb:171:in `readline'
c:/ruby/lib/ruby/1.8/net/http.rb:1561:in `read_status_line'
c:/ruby/lib/ruby/1.8/net/http.rb:1545:in `read_new'
c:/ruby/lib/ruby/1.8/net/http.rb:833:in `request'
c:/ruby/lib/ruby/1.8/net/http.rb:823:in `request'
c:/ruby/lib/ruby/1.8/net/http.rb:821:in `start'
c:/ruby/lib/ruby/1.8/net/http.rb:824:in `request'
c:/ruby/lib/ruby/1.8/net/http.rb:779:in `post2'
c:/ruby/lib/ruby/site_ruby/1.8/webunit/response.rb:120:in `init_http'
c:/ruby/lib/ruby/site_ruby/1.8/webunit/response.rb:42:in `post'
./test/SimpleTests.rb:40:in `tryRedirect'
./test/SimpleTests.rb:26:in `test_login'
Any ideas?
I want to use webunit to drive the UI tests. I'm stuck with doing a
redirect. The code looks like that:
def test_login
url = 'http://localhost:8080/'
response = WebUnit::Response::get(url)
login_form = response.forms[0]
assert_equals('login-username', login_form.parameters[1].name)
assert_equals('login-password', login_form.parameters[2].name)
login_form.parameters[1].value = "mylogin"
login_form.parameters[2].value = "mypassword"
response = login_form.submit
redirect_url = response.url
response = tryRedirect(response, redirect_url)
...
end
def tryRedirect(response, url)
if response.code == '302'
response = Response:ost(url)
response = response.redirect
end
end
I'm getting the following error:
EOFError: End of file reached
c:/ruby/lib/ruby/1.8/net/protocol.rb:199:in `sysread'
c:/ruby/lib/ruby/1.8/net/protocol.rb:199:in `rbuf_fill'
c:/ruby/lib/ruby/1.8/net/protocol.rb:160:in `readuntil'
c:/ruby/lib/ruby/1.8/net/protocol.rb:171:in `readline'
c:/ruby/lib/ruby/1.8/net/http.rb:1561:in `read_status_line'
c:/ruby/lib/ruby/1.8/net/http.rb:1545:in `read_new'
c:/ruby/lib/ruby/1.8/net/http.rb:833:in `request'
c:/ruby/lib/ruby/1.8/net/http.rb:823:in `request'
c:/ruby/lib/ruby/1.8/net/http.rb:821:in `start'
c:/ruby/lib/ruby/1.8/net/http.rb:824:in `request'
c:/ruby/lib/ruby/1.8/net/http.rb:779:in `post2'
c:/ruby/lib/ruby/site_ruby/1.8/webunit/response.rb:120:in `init_http'
c:/ruby/lib/ruby/site_ruby/1.8/webunit/response.rb:42:in `post'
./test/SimpleTests.rb:40:in `tryRedirect'
./test/SimpleTests.rb:26:in `test_login'
Any ideas?