How to write a feature that calls for a prompt?

I am writing a feature that will test an LDAP protected site. I need to
login as my self with my real password.

I’m thinking of writing a feature that looks something like this

Feature: Login
As a LDAP user
I want to login
And see the welcome banner
So that I can know that I can login to the system

Scenario: LDAP login
Given a LDAP user
When I go to the site “https://toolsite.domain.com
And I enter the login name “enter_login_name”
And I enter the password “enter_password”
Then I should see the welcome banner “Tool Site at
Domain.com

I imagine that I can have a step that would look something like this?

require ‘highline/import’
require ‘my-user-def’
require ‘my-site-runner’

Given /^a LDAP user$/ do
@user.new
end

When /^I go to the site “([^"]*)”$/ do |arg1|
@site.goto(arg1)
end

When /^I enter the login name “([^"]*)”$/ do |arg1|
if arg1 == “enter_login_name”
@user.login_name = ask(“Enter login name”) {|q| q.echo = true}
end
end

When /^I enter the password “([^"]*)”$/ do |arg1|
if arg1 == “enter_password”
@user.password = ask(“Enter password”) {|q| q.echo = false}
end
end

Then /^I should see the welcome banner “([^"]*)”$/ do |arg1|
@site.text.include? arg1 == true
end

Colfer, Brian wrote:

I am writing a feature that will test an LDAP protected site. I need to
login as my self with my real password.

When unit testing, thou shalt not hit the wire. Mock anything that goes
further
than your database.

Put another way, you are not going to refactor LDAP itself, or add
features to
it, so mocks should set the boundaries to what you do expect to
refactor.

Phlip,

Ah, but I am not unit testing … I am writing an acceptance test. I am
QA, not the developer and using cucumber to automate the functional and
acceptance tests.

Brian

You can use IO.popen to run and interact with a command line program.

Pat

On Wed, Apr 15, 2009 at 8:46 AM, Colfer, Brian [email protected]
wrote:

Phlip,

Ah, but I am not unit testing … I am writing an acceptance test. I am
QA, not the developer and using cucumber to automate the functional and
acceptance tests.

By LDAP protected site - do you mean a web application that has a login
form
and a server component that authenticates the user against an LDAP
server?
Is this a Rails app? Or a web app in some other language? Not a web app
at
all?

Users usually don’t access LDAP directly, but via some user interface,
so
interacting directly with LDAP from Cucumber sounds wrong to me.

Can you describe the architecture of your application a little more?
What
language, framework and components is it built on, and how are they
connected?

Aslak