Economics of test automation

How to calculate the cost of test automation:
Cost of test automation = Cost of tool(s) + Labor costs of script creation + Labor costs of script maintenance
 
If a test script will be run every week for the next two years, automate the test if the cost of automation is less than the cost of manually executing the test 104 times.
Automate if:
Cost of automation  <  Cost of manually executing the test as many times as the automated test will
be executed 

 

Monitoring Windows server using Nagios

Monitoring windows server require installation on NSClient ++ on windows host.

How it works?

For example disk space usage needs to be monitored on windows host.
1. Nagios will execute check_nt command on nagios-server and request it to monitor disk usage on windows machine.
2. Check_nt on nagios-server will contact the NSClient++ service on remote windows host  and request it to execute USEDISKSPACE on remote host. The result will be retured back to check_nt on nagios-server  by NSClient++ daemon.

How to Install and configure NSClient++?

1. Download and install NSClient ++ from http://nsclient.org/download/
2. Modify the NSClient++ service
Type services.msc in run and  then double click on NSClient++ service in the list.  Select the check-box that says “Allow service to interact with desktop”

3. Modify the Nsclient.ini file
Edit the C:\Program Files\NSClient++\NSC.ini file
– Uncomment everything under [modules] except RemoteConfiguration.dll and CheckWMI.dll
– Uncomment allowed_host under settings and add the ipaddress of the nagios-server.
– Uncomment the port# under [NSClient] section

If you have firewall running, open the port used by NSClient ++. Default ports used are 12489, 5666 and 5667.

Configuration on Nagios Monitorng Server.

1. Verify check_nt command and windows-server template
–  Verify that the check_nt is enabled under /usr/local/nagios/etc/objects/commands.cfg
# ‘check_nt’ command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

– Verify that the windows-server template is enabled under
/usr/local/nagios/etc/objects/templates.cfg
# Windows host definition template – This is NOT a real host, just a template!
define host{
name windows-server ; The name of this host template
use generic-host ; Inherit default values from the generic-host template
check_period 24×7 ; By default, Windows servers are monitored round the clock
check_interval 5 ; Actively check the server every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if servers are “alive”
notification_period 24×7 ; Send notification out at any time – day or night
notification_interval 30 ; Resend notifications every 30 minutes
notification_options d,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
hostgroups windows-servers ; Host groups that Windows servers should be a member of
register 0 ; DONT REGISTER THIS – ITS JUST A TEMPLATE
}

2. Uncomment windows.cfg in /usr/local/nagios/etc/nagios.cfg
# Definitions for monitoring a Windows machine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg

3. Modify /usr/local/nagios/etc/objects/windows.cfg
By default a sample host definition for a windows server is given under windows.cfg, modify this to reflect
the appropriate windows server that needs to be monitored through nagios.
# Define a host for the Windows machine we’ll be monitoring
# Change the host_name, alias, and address to fit your situation
define host{
use windows-server ; Inherit default values from a template
host_name remote-windows-host ; The name we’re giving to this host
alias Remote Windows Host ; A longer name associated with the host
address 192.168.1.4 ; IP address of the remote windows host
}

4. Define windows services that should be monitored.
Following are the default windows services that are already enabled in the sample windows.cfg. Make sure
to update the host_name on these services to reflect the host_name defined in the above step.
define service{
use generic-service
host_name remote-windows-host
service_description NSClient++ Version
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
define service{
use generic-service
host_name remote-windows-host
service_description Uptime
check_command check_nt!UPTIME
}
define service{
use generic-service
host_name remote-windows-host
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
define service{
use generic-service
host_name remote-windows-host
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
define service{
use generic-service
host_name remote-windows-host
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
define service{
use generic-service
host_name remote-windows-host
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
define service{
use generic-service
host_name remote-windows-host
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}

5. Enable Password Protection
If you specified a password in the NSC.ini file of the NSClient++ configuration file on the windows
machine, you’ll need to modify the check_nt command definition to include the pssword.

Modify the /usr/local/nagios/etc/commands.cfg file and add password as shown below.
define command{
command_name check_nt
command_line $USER1$/check_ntHOSTADDRESS$ -p 12489 -s My2Secure$Password -v $ARG1$ $ARG2$
}

6. Verify Configuration and Restart Nagios.

Verify the nagios configuration files as shown below.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

7. Restart nagios

In the next article I will cover How to install Nagios server?

Jmeter limitations with Monitoring server on load and how to overcome?

JMeter has option to add monitor test plan to monitor application servers. But it only works with Tomcat 5 status servlet. But any servlet container that supports JMX (Java Management Extension) can port the status servlet to provide the same information.

Also if user want want to use the monitor with other servlet or EJB containers, Tomcat’s status servlet will work with other containers for the memory statistics without any modifications. To get thread information, MBeanServer will require change in lookup to retrieve the correct MBeans.

But still it is not possible of Windows server IIS.

One of the way to overcome this situation is using Nagios. This can also be used in conjuction with JMeter. That is load is generated using JMeter and Nagios is used to monitor application server performance on load.

Now, the question is what is nagios? How it works ….

Nagios is System and network monitoring tool. It watches hosts and services that is specified and alerts when things go bad crosses threshold value ( this threshold value can be configured) and when they get better.

It works on Linux and linux like system.. BUT it can also MONITOR WINDOWS SERVER. This is the most important aspect of it.

The only requirement of running Nagios is Linux machine or its variant and c compiler.

On the next article I will explain the details of how it can be used to configure and monitor windows machine.

Load testing MS SQL2005 and MS SQL 2000 using JMeter

Load testing Microsoft SQL 2000 and SQL 2005 database server with JMeter. This will also work on SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005 and SQL Azure.

1. Download the “Microsoft JDBC Driver 4.0 for SQL Server” from Microsoft download center.

2. Extract the sqljdbc.jar

3. Update the CLASSPATH with the jar file path or copy paste the jar file under jmter\lib folder.

4. Create a Jmeter test plan having JDBC Connection connection configuration and JDB Request

5. Update Database URL as

jdbc:sqlserver://:1433;databasename=TestDB;

Server Name or IP is the database server name
1433 is the default port. It can be different in your case.

E.g: jdbc:sqlserver://localhost:1433;databasename=TestDB;

6. Update JDBC Driver Class as

com.microsoft.sqlserver.jdbc.SQLServerDriver

7. Write the SQL query that needs to be tested in JDBC Request Sampler.

How to configure and use Selenium with C#

Step 1: Download Selenium Core, Selenium IDE and Selenium RC from the website http://seleniumhq.org/download/

Step 2: Installing the IDE. It consists of an XPI file that needs to be added in Firefox.

Step 3: Unzip the Selenium RC folder.

Step 4: To record Scripts, Open the IDE. To run the Selenium IDE, open Firefox and Select it from Firefox tools menu. Refer the screenshot below.

http://digitalab.org/wp-content/uploads/2014/08/IMG-20140706-00002.jpg

To start recording, click on the Red icon ( )

Step 5:

After recording the script, select C# format to convert the scrip in C# format.

ide

Step 6: Configure the .Net client driver.
.Net Client driver can be used with Microsoft Visual Studio. Launch Visual Studio and select new project of type Class Library.
Copy the converted code in the Class1.cs(default name) file and rename the file as required.
Add reference to the following dlls.
nunit.framework.dll
ThoughtWorks. Selenium.Core.dll
ThoughtWorks.Selenium.IntegrationTests.dll
ThoughtWorks.Selenium.UnitTests.dll

Step 7: Build the application.

Functional Testing using Selenium – Introduction

Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language. Selenium provides a rich set of testing functions for testing web applications. These operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior.

It also supports multiple browsers. Selenium is highly flexible. There are multiple ways by which one can customize and add functionality to selenium’s framework. This is one of the strongest characteristics when compared with other proprietary test automation tools and open source tools. In selenium different programming language and scripting language can be used. It supports Java, C#, Perl, PHP, Ruby etc.

Selenium has three major tools: viz. Selenium IDE, Selenium RC ( Remote control) and Selenium Core

Selenium-IDE

Selenium-IDE is the Integrated Development Environment for building Selenium test cases. It operates as a Firefox add-on. Through this you can record user actions and store them in scripts. It has context menu integrated with Firefox browser allowing user to pick from list of assertions.

Selenium-RC (Remote Control)

Selenium-RC allows the test automation developer to use a programming language for maximum flexibility and extensibility in developing test script. Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This helps in writing high quality automated test scripts which can also be integrated with project’s automated build environment.

For more details visit the official website http://seleniumhq.org/docs/

Vista Themes in Windows xp

Are you getting bored with windows xp themes and tools and cannot afford to upgrade to Vista.
There are some tools which help in transforming your xp themes to vista themes. Most popular is Vista Transformation Pack 7.0.exe by Windows X. I personally tried and is a very good tool.

There are few other tools for windows XP provided by Microsoft – Microsoft Power toys
http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

some of them are Power Caculator, Image resizer, Virtual Desktop manager ( like we have in Linux) etc.