ruby

Ruby Performance Testing with Watir

A reader of mine asked me how they should go about performance testing some front end performance.  This is a good question, because tools such as JMeter are pretty good at getting performance metrics for load – but you must keep in mind that JMeter isn’t a browser and doesn’t always find front end performance issues. For example, if a user had a AJAX call on a web page, and they... »

Ruby: Querying a MySQL database

This is a short and easy little post regarding Ruby and using it to query a MySQL database… This came up for one of my students.  I wanted him to get used to finding solutions to problems. I gave him a problem of validating some activity by automating a SQL call to a database.  Any language could be used, but since we were working with Web Automation I picked Ruby. there’s a variety of... »

Web Automation with CSV Imports

I had a real life request at work the other day.  My boss had a goal of migrating some phone numbers to different POPs.  In fact he had a large list – 4,000+ numbers.  The carrier in question only had a web interface for this task (no API) and the web interface would only take one number at a time.  The carrier’s website was slow, taking about 10 seconds for time to find a number in th... »

Automating SEO, Link and Page Validation

Note #1: make sure you have the right to test or crawl the site you are obtaining links from or testing the title and meta data of.  To fire off a test like this against a random site could result in your IP being banned by the admin.  It could also be deemed an attack by some. Note #2: If you have permission and the site you are testing is hosted by GoDaddy, you will have to work with Tier 2 supp... »

Installing Nokogiri on OSX

This is such a pain to install on OSX.  Due to Xcode or some other nonsense, OSX has a real hard time getting the required lib’s to get Nokogiri installed… you can try and follow the directions on the Nokogiri main site but it won’t work. The solution I found in a comment on Stack Overflow and I’m listing it here for further reference: gem install nokogiri — –wi... »

Ruby Image Scraper

A guy I know was looking for a script that could pull down images off his site. I had a previously made Ruby script that would scrape URL’s and load each link in a browser to check for patterns, errors, etc. Using that same script, I added some Nokogiri scripting I found here: http://stackoverflow.com/questions/7926675/save-all-image-files-from-a-website My result was this little script̷... »

Ruby Basics: Hashes

Creating an Empty Hash A hash (or dictionary) is a set of key/value pairs.  In Ruby you can create an empty hash, using the notation: my_hash = {} or my_hash = Hash.new With the later format you can specify default values of the hash, using the syntax: Hash.new{0} where 0 is the default value, if no value is supplied. Creating a Hash with Values Traditionally you could do this with a format like: ... »

Language Choices

Scripting: Groovy, Python or Ruby I work with these three languages all the time, along with their Web Frameworks (Grails and Rails – I haven’t yet picked up Django.) Quite often I start a project and wonder, “which language should I use?” For me each language has it’s perks and set backs…. Groovy/Grails Groovy is actually very fast… and static typing in G... »

404 Checker

After getting a ping from a friend of mine, I updated my web scrapper and modified it a bit to fit his needs.  He wanted to catch 404’s… so I sent him my old web scrapper.  The problem was though, his test machine had limited memory.  Due to that it was crashing out and not completing the test.  My old code would leverage Anemone to crawl, and then put each URL into an array.  Then ite... »

Automate Search Result Validation

A friend of mine was testing something related to search results.  He passes in a dynamic argument to search on and then validates that this same argument is returned in the result. I ended up doing this and it solved his problem: a = @browser.div(:class => "gs-title").a(:class => "gs-title").text puts a ## Did that to verify we were getting some text back... »

Page 1 of 3123