03.24.06
Posted in Watir at 1:57 pm by Željko Filipin
My Watir scripts became too big for one file, so I split them in several files. But then number of files became too big so I moved them to folders. Something like this
- conf (folder: yaml configuration files)
— builder.yml
— stager.yml
…
- file (folder: files for upload)
— file.txt
— attachment.txt
…
- lib (folder: files that contain my modules, classes, methods…)
— File.rb
— User.rb
…
- test (folder: files that contain tests)
— all_tests.rb
— core_tests.rb
— file_tests.rb
— user_tests.rb
…
And it works just fine. Just add this code at the top of files that need it (all_tests.rb, core_tests.rb…):
Permalink
Posted in Ruby at 1:53 pm by Željko Filipin
Brian Marick wrote interesting article about variables and objects.
The key to avoiding misunderstanding is remembering that variables and objects are *different kinds of things*. The name of a thing is not the thing itself. This is best illustrated by pictures. I just drew some pictures that explain what was happening in your example. (I simplified to make it just one each, since the nested eaches don’t have anything to do with the problem you had.) They are here: http://www.testing.com/review-copies/variables.pdf I’m rather pleased with them, plus I stayed up way too late to make them, so you all have to look at them.
Permalink
03.20.06
Posted in Watir at 1:49 pm by Željko Filipin
I found the reason why FireWatir was not working at my machine.
Installation guide for FireWatir in step 2.e. says:
Close Firefox. Restart it again using command “[Firefox installation directory]/firefox.exe –jssh” from command prompt.
I opened Command Prompt at Firefox installation directory and copy/pasted “firefox.exe –jssh” (of course, without quotes) there. Pressed enter.
The next step (2.f.) is:
To check if JSSh is listening on port 9997 run command “telnet localhost 9997” from command prompt.
I copy/pasted “telnet localhost 9997″ (also without quotes) to command prompt, pressed enter and got error message.
It took some time and a pretty long conversation at wtr-general mailing list to find the solution to my problem. At the end, I found it myself.
It seems that Word Replaces hypen (shorter -) with dash (longer –).
You can find that setting here:
Word (2003, service pack 2) > Tools > AutoCorrect Options… > AutoFormat > Replace > Hypens (–) with dash (–).
When I replaced dash (longer –) with hypen (shorter -) in “firefox.exe –jssh”, everything worked just fine.
What have I learned? Never write documentation in Word. Do it in Notepad.
The whole conversation is here.
Permalink
03.15.06
Posted in Ruby at 1:48 pm by Željko Filipin
I use Watir to test web applications.
At application under test, after user is created I need to get her or his database id. I use it later to check if script is at the right page. For example, view user page url is
http://{application_under_test}/ViewUser.aspx?m={user_database_id}
I have to know user database id to check url.
My developer made xml page with all users. Only username and database id are displayed.
Script goes there and grabs database id.
And it works just fine.
Then, we imported data from production database. And my script returns this error:
C:\ruby\lib\ruby\1.8/rexml/parsers/treeparser.rb:85:in `parse’: #
…
Last 80 unconsumed characters:
…
There is user with username Aragón, and my script has a problem with it.
The solution? Install Ruby 1.8.3. or 1.8.4. and put this at the begging of your script:
Permalink
03.14.06
Posted in Watir at 1:46 pm by Željko Filipin
You can find it here and Installation Guide is here.
More info is here.
I could not make it work. I hope I will make it work these days.
Permalink