Issue while executing

19 views
Skip to first unread message

LearnTestWise

unread,
Feb 1, 2012, 3:00:31 PM2/1/12
to TestWise
Hello Group,

I script is generated in Watir with Cucumber syntax. I have the
following step in feature file:

Then the user deletes the user "UserName"

For the above step in feature file i have following script in step
definition:

Then /^ the user deletes the user "([^"]*)"$/ do |arg1|
puts "abcd"
found = false
table = @browser.table(:id, "user_list")
puts table.row_count
for i in 2..table.row_count
if table.row_values(i)[0] == "testwiseuser"
found = true
table[i][12].link(:href, /.*/).focus
@browser.send_keys("{ENTER}")
java_script_click ()
end
break
end
found.should == true
end

I am using the puts statement for debugging purpose. When i run the
script the first puts statement itself never gets printed. The script
execution remains in starting status as if it is trying to search for
something. Please let me know if I am doing anything wrong here. My
req is in a table i need to identify a user with user name and then
click on delete image which is in the 12th column of the table.
Any help on this highly appreciated.

Zhimin

unread,
Feb 1, 2012, 3:43:44 PM2/1/12
to TestWise
Hi there,

RWebSpec has built-in TestWise integration, to write output to
TestWise console:

debug("the table row count" + table.row_count)

As you are using pure Watir, that debug function is not available.
Please note by using RWebSpec, you still can access Watir methods.

Anyway, to show the print output from "puts", you can start TestWise
in console mode:

C:\>cd c:\Program Files\TestWise
C:\Program Files\TestWise>testwise-console.bat

Cheers,
Zhimin

LearnTestWise

unread,
Feb 1, 2012, 4:09:49 PM2/1/12
to TestWise
Thanks Zhimin for your response. I agree and understand that. However
my question was not about printing stmt in consoles. I guess I might
have to rephrase a little bit. The given block of code doesn't get
executed at all. So I am writing to check if I can get some help on
that.

Regards,
LearnTestWise

Zhimin

unread,
Feb 2, 2012, 3:06:42 PM2/2/12
to TestWise
Hi,

I created a similar test (based my understanding of your post) in
TestWise, which runs fine.

The demo page (with a table) => http://testwisely.com/demo/table

# The test step file
Then /^I can edit the flight$/ do
puts "[1] Enter Step"
found = false
table = @browser.table(:id, "flight_list")
puts "[2] Table row count => " + table.row_count.to_s

for i in 2..table.row_count
if table.row_values(i)[1] == "New York"
found = true
puts "[3] the hyper link URL for this row is => " + table[i]
[4].link(:href, /.*/).href
# then you can do whatever to the link
end
break
end
puts "[4] Found => #{found}"
found.should == true
end

The print out
[1] Enter Step
[2] Table row count => 3
[3] the hyper link URL for this row is => http://testwisely.com/flights/1237/edit
[4] Found => true

Cheers,
Zhimin
Reply all
Reply to author
Forward
0 new messages