Archive

Archive for February, 2009

Multi select comment in Ruby

February 26, 2009 Leave a comment

Here are some ways to do multi-select comments in your Ruby code:

1. =begin/ =end block

begin_end

Note:

All codes between the =begin/=end block is treated as comments

=begin/=end block should NOT be indented

2. ctrl + shift + c

comment

To do this, highlight the block that you want to comment out, then click ctrl + shift + c

Categories: ruby Tags: , ,

Top 25 Most Dangerous Programming Errors for Software Testing

February 25, 2009 Leave a comment

Last January, experts from more than 30 US and international cyber security organizations jointly released the consensus list of the 25 most dangerous programming errors that lead to security bugs and that enable cyber espionage and cyber crime.

Some of  the expert people and organizations that provided substantive input to this project are Symantec and Microsoft, to DHS’s National Cyber Security Division and NSA’s Information Assurance Division, to OWASP and the Japanese IPA, to the University of California at Davis and Purdue University.

This list can serve as a guide for software testing tool vendors in evaluation and improvement of the testing tools.

Top 25 Most Dangerous Programming Errors

Using .irbrc file to configure your IRB

February 20, 2009 1 comment

In my latest post “IRB Recipes” where we’ve discussed how to configure IRB to enable auto-complete, auto-indent and to clear screen, notice that when you exit your IRB the configurations return to its default value. And it not so DRY (Don’t Repeat Yourself) to type the recipes every time you fire up your IRB.

This prob leads us to using an .irbrc file to permanently configure your IRB every time you use it. Here’s how I set up my initial .irbrc file:

1. Create .irbrc or _irbrc file in wherever directory/location you want (In my case I saved it in C:\Documents and Settings\user)

Note: Creating a file in notepad/wordpad having “.” before the filename will not allow you to do so, I suggest you use Notepad++ source code editor

2. Edit your .irbrc file

.irbrc file

.irbrc file

Let’s dissect the .irbrc file configuration:

Line 1:  Enables auto-completion

Line 2:  Enables pretty print

Line 3:  Enables auto-indention

Line 4:  Enables the use of readline

Line 6-8:  Enables clear screen inside IRB

Line 9:  Validates if that .irbrc file was loaded successfully

3. Check if the your .irbrc file is successfully loaded

  • Run console
  • Go to the directory where you saved your .irbrc file
  • Fire up IRB
  • Manually check auto-indention, auto-completion and clear screen method (in my case I validated it with a “Yes! Configuration is loaded!” message)

4. To effect the .irbrc configuration in other directory other than its current location

  • Create a HOME environment variable name
  • Set variable value to the current location of the .irbrc file
  • Reboot to effect changes in the environment variable

5. Verify .irbrc file by going through step # 3 but this time go to other directory and not on the location of your .irbrc file

Categories: ruby Tags: , ,

IRB Recipes

February 19, 2009 1 comment

Yesterday we had an interesting Selenium Ruby session with Exist QA group. We were divided into 2 groups and my team was tasked to create IRB recipes for the following scenarios:

  • enable auto-indenting
  • enable auto-complete
  • add a clear screen method (clear or cls)

Auto indenting

- enables user to write clean and properly indented codes.

IRB auto-indent configuration

IRB auto-indent configuration

1. From your console fire up your IRB

2. Notice that if you type ‘conf’ and check for the default value of

conf.auto_indent_mode = false

3. To override this, type

conf.auto_indent_mode = true (see line 2)

Auto complete

- enables user to check the available methods within an object by clicking DOUBLE TAB

IRB auto-complete configuration

IRB auto-complete configuration

1. From your console fire up your IRB

2. Type below command inside your IRB

require ‘irb/completion’

Clear Screen

- enables user clear the screen inside the IRB

IRB clear screen method

IRB clear screen method

1. From your console fire up your IRB

2. Define a method to clear the system (see line 2-4)

3. Now you can call the method ‘cls’ inside IRB that will clear your screen

Categories: ruby Tags: ,

Creating Firefox profile for your Selenium RC tests

February 5, 2009 112 comments

Why create a new firefox profile for Selenium?

We create firefox profile for Selenium RC tests, so we can set light configurations to it, which later on we’ll be using to run our Selenium scripts FASTER.

How to create Firefox profile for your Selenium?

  1. Make sure all your firefox instance are closed
  2. Click Start>Run
  3. Type “firefox.exe -ProfileManager -no-remote”
  4. Select “Create Profile” (i.e. selenium)
  5. Click “Next”
  6. Enter new profile name
  7. Select a directory folder to store your new profile
  8. Click “Finish”
  9. Select “Don’t ask at startup”
  10. Click “Start Firefox” and configure settings based on suggestion below***
  11. Set Profile back to “default” (enable you to use your previous settings on your browser)
  12. Add -firefoxProfileTemplate command line option as you start the Selenium Server

java -jar selenium-server.jar -firefoxProfileTemplate “<Selenium Profile Directory>”

*** Suggested settings for your Selenium Profile

  1. From “View\Toolbars” tab, uncheck “Bookmarks Toolbar”
  2. Right click from toolbar and click “Customize”
  3. Remove “Google search” by dragging it to the “Customize Toolbar” window
  4. From the “Customize Toolbar” window, click “Use Small Icons” check box then hit “Done”
  5. Click “Tools\Options” then set the following:
    a. “Main” tab
    - set Home Page to “about:blank”
    - uncheck “Show the Downloads..” option
    b. “Tabs” tab
    - Select “a new window” for new pages
    - Uncheck all warning options
    c. “Content” tab
    - uncheck “Block pop-up” windows option
    d. “Privacy” tab
    - uncheck all “History” options
    e. “Security” tab
    - uncheck all “Security” options
    - click “Settings” and uncheck all warning options
    f. “Advanced” tab
    - Uncheck “autoscrolling” option from “General” tab
    - uncheck “warn me …” and “Ssearch Engines”option from “Update” tab
  6. From “Tools\Add-ons” install the following:
    - Firebug: allows you to edit, debug, and monitor CSS, HTML, and JavaScript on your application under test
    - Selenium IDE: allows you to record, edit, and debug Selenium tests
    - ScreenGrab: saves entire webpages as images.
  7. From the address bar type “about:config” and add the following by right-click anywhere on the page and selecting “new”
    - extensions.update.notifyUser (type=boolean; value=false)
    - extensions.newAddons (type=boolean; value=false)
Follow

Get every new post delivered to your Inbox.