User Tools

Site Tools


monitor_real_time_website_with_test_case

Monitor Website / WebApp

There is many tool available in market to monitor websites.
Many of them fail on hard to use or does not serve purpose.
This script is simply used to generate test case.
Easy to configure / install for system admin.

Requirement

Installation

  • Install JRuby from System Repository or From source
    • simply extract and place it in your PATH
  • To install Celerity “gem install celerity”
  • Seriously - if ruby not installed chance distro YO !! JK

Script

This is sample script worked for my purpose you might need to modify accordingly.
See Documentation for further Detail - Celerity

| moniter.rb
require "rubygems"
require "celerity"
 
browser = Celerity::Browser.new
browser.goto('http://www.k2pate.in')
browser.text_field(:name, 'Username').value = 'test-user'
browser.text_field(:name, 'Password').value = 'test-password'
browser.button(:name, 'SubmitButton').click
puts "yay" if browser.text.include? 'SUMMER IS HERE . . .'
 
browser.goto('http://www.k2patel.in/DCM/criteria.aspx?ID=1363&persist=1&selectedname=User,%20Test&selectedid=9897')
browser.text_field(:name, 'KickReason').value = 'test'
browser.button(:name, 'PreviewButton').click
puts "yak" if browser.text.include? 'To Say Thank You For:'
 
browser.goto('http://www.k2patel.in/dcm/AboutCatalog.aspx?d')
browser.select_list(:name, 'CategoryDropDown').select('All Categories')
# browser.select_list(:name, 'PerPageDropDown').select_value = '50'
# paglink.click_and_attach
browser.select_list(:name, 'PerPageDropDown').select('50 per page')
puts "yam" if browser.button(:name, 'NextButton2').exists

You can execute script with time to get execution time.

monitor_real_time_website_with_test_case.txt · Last modified: 2011/09/23 12:46 by k2patel