Saturday, August 20, 2011

Directory Structure For Software Automation Testing Project


Index:
  1. Common Directory Structure  - Automation Frame Work for the AutoIT Project
  2. Naming Convention
  3. Coding Convention
  4. Proper Comments
  5. Write proper precondition
Common Directory Structure  - Automation Frame Work for the AutoIT Project:




Note : Release Notes folder, where .doc file is included.

Naming Convention:
There is Naming Convention which are follows in the project.


Name of the variables
     For example:

Counter name (Write full description like “PASS instead of P / FAIL instead of F”)

Coding Convention:
Name of the Functions

     SC_NameOfTheRelatedScenario (Functions, which are placed in Scenariowise)
     TC_NameOfTheRelatedActivity (Functions, which are placed in TestCasewise)

In Conditional Statement, Variable Name is like, this
     <Name of Action_RowIncr / Name of Action_ColumnIncr>
       

      for(Cost_RowIncreament=0;Cost_RowIncreament<=5;Cost_RowIncreament++)
            {

            }
      instead of           

      for(i=0;i<=5;i++)
            {
            }

Comments:
     There are very importent to write proper comments at the time of making test script
     Comments are two types:
        Single line comments
        Multiple line comments (Block level)



Precondition: 
     Precondition is very important to reaches our goal with the help of reproduction steps





Some performance testing code for autoit tool to desktop based application testing:


1. CPU Utilization
2. Memory Usage
3. Time Taken



   $log = FileOpen(@WorkingDir & "\." & ".\result\Result_PSoC_CPU&MemoryUsage.log", 1)
   $logs = FileOpen(@WorkingDir & "\." & ".\result\Result_PSoC_TimeoutError.log", 1)
   
      #include <Excel.au3>
      #include <File.au3>
      #include <array.au3>
   
 for $i = 1 to 120 Step +1


  If $i == 1 Then
  
   Sleep(3000)
   Run($CmdLine[1])
   Sleep(3000)
   Run(@WorkingDir & "\." & ".\bin\SC_demoScripts\TC_drag&Drop.exe")


   Local $cpuincrement = 0
   Local $memincrement = 0
   Local $cpu = 0
   Local $cpu1 = 0
   Local $mem = 0
   Local $mem1 = 0
   Local $total = MemGetStats()
   Local $array = ProcessList("TC_drag&Drop.exe")
   Local $iPID = $array[1][1]
   Local $sProcess = $iPID
   
   for $j = 1 to 120 step +1
    
    if ProcessExists("TC_drag&Drop.exe") Then
     Local $load = Process($sProcess, 300 )
     Sleep(1000)
     
     if $load > 0 Then
      $cpu = $cpu + $load
      $cpuincrement = $cpuincrement + 1
     EndIf
     
     $mem1 = ProcessGetStats("TC_drag&Drop.exe",0)
     $mem = $mem + $mem1[1]
     $memincrement = $memincrement + 1
     
    EndIf
    
   Next
  
   if $memincrement >= 120 then
    Sleep(2000)
    ProcessClose("TC_drag&Drop.exe")
    Sleep(2000)
    ProcessClose("PSoC Creator 2.0.exe") 
    FileWriteLine($logs,"Timeout Error in TC_drag&Drop Script Execution.")
   EndIf
   
   if $cpu <> 0 Then
    $cpu = Round($cpu/$cpuincrement,2)
   EndIf

  $mem = Round((($mem/1048576)/$memincrement),2) 
  FileWriteLine($log, "                 ")
  FileWriteLine($log,"+++++ Cypress_PSoCreator +++++")
  FileWriteLine($log,"                  ")
  FileWriteLine($log,"***** Cypress_PSoCreator *****")
  FileWriteLine($log,"Process Name: "&$array[1][0])
  FileWriteLine($log,"Process PID: "&$array[1][1])
  
  Global $sFilePath1 = @WorkingDir & "\." & ".\result\Result_PSoC_Creator.xls"
  Global $oExcel1 = _ExcelBookAttach($sFilePath1)
  
   if $cpu <> 0 Then
    FileWriteLine($log,"Average CPU Usage In Percentage: "&$cpu&" %")
    _ExcelWriteCell($oExcel1, $cpu, 3, 4)
   EndIf
   if $cpu == 0 Then
    FileWriteLine($log,"Average CPU Usage In Percentage: "&$cpu1&" %")
    _ExcelWriteCell($oExcel1, $cpu1, 3, 4)
   EndIf
  
  FileWriteLine($log,"Total Physical RAM In MB: "&Round($total[1]/1024,2)&" MB")
  _ExcelWriteCell($oExcel1, Round($total[1]/1024,2), 3, 7)
  FileWriteLine($log,"Average Memory Usage In MB: "&$mem&" MB")
  _ExcelWriteCell($oExcel1, $mem, 3, 5)
  _ExcelBookClose($oExcel1, 1, 0) 
  
 EndIf

 Next
  
  FileClose($logs)
  FileClose($log)


 Func Process($strProcess = "Idle", $iSampleTime = 500, $sComputerName = @ComputerName)
  
  if $strProcess = "" then $strProcess = "Idle"
  if $iSampleTime = "" AND IsString($iSampleTime) then $iSampleTime = 500
  if $sComputerName = "" then $sComputerName = @ComputerName
    
   if not IsDeclared("iP1") AND $iSampleTime = 0 then
    $bFirstTimeInLoopMode = 1
   else
    $bFirstTimeInLoopMode = 0
   endif
    
   if not IsDeclared("iP1") then
    assign("iP1", 0, 2) 
    assign("iT1", 0, 2)
   endif
    
  $objWMIService = ObjGet("winmgmts:\\" & $sComputerName & "\root\CIMV2")
  if @error then return -2
  
   if number($strProcess) then 
    $strProcess = " WHERE IDProcess = '" & $strProcess & "'"
   else 
    $strProcess = " WHERE Name = '" & $strProcess & "'"
   endif


  if $iSampleTime OR $bFirstTimeInLoopMode = 1 then
        
        $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfProc_Process" & $strProcess)
        
 For $objItem In $colItems
            
            $iT1 = $objItem.TimeStamp_Sys100NS
            $iP1 = $objItem.PercentProcessorTime
 next


        if  $objItem = "" then return -1
        sleep($iSampleTime)
  endif
    
  $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfProc_Process" & $strProcess)


    For $objItem In $colItems
        $iP2 = $objItem.PercentProcessorTime
        $iT2 = $objItem.TimeStamp_Sys100NS  
    next


  if  $objItem = "" then return -1
   
  $iPP = ($iP2 - $iP1)
  $iTT = ($iT2 - $iT1)
  
  if $iTT = 0 Then return 100


  $iCPU = round( ($iPP/$iTT) * 100, 0)
  
  $iP1 = $iP2
  $iT1 = $iT2
  Return $iCPU
  
 EndFunc


Tuesday, February 22, 2011

Automation Testing With Selenium.

1. Download selenium RC.
2. Download Mozilla Firefox.
3. Add selenium IDE Add-ons in firefox
4. Start selenium server.jar file in command prompt.
5. Download updated eclipse.

Very good link to study Selenium ...
http://blog.softwaretestingclub.com/2011/09/an-introduction-to-selenium-ide-plugins-2/

Thursday, December 30, 2010

Key Points of Cucumber testing tool.

To install cucumber :

Goto root to install


[gem install rspec --version 2.0.0.beta.19]

Now type rspec --help, and you should see output that starts like this:

Usage: rspec [options] [files or directories]

[gem install cucumber --version 0.8.5]

Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+



To see the version of rspec and cucumber then type in terminal :

[cucumber --version]
[rspec --v]


To run the test cases :

Now save the file, open up a command shell, cd into the directory in
which it is saved, and type this command:

[rspec filename.rb]



Keywords of cucumber :

Features
Scenarios
Given
When
Then
And
But

Tuesday, December 14, 2010

Key Points For Creating Rails Application.


http://railstutorial.org/chapters/

1. rails new 'application name' -d mysql
2. cd 'application name'
3. bundle install
4. rake db:create
5. open another terminal to create database and tables
    Command to starting mysql on terminal
    mysql -u root -p      

<a> create database 'database name';
<b> use 'database name';
<c> create table 'table name' (UserName varchar(20),password varchar(20));

6. rails generate scaffold 'table name' UserName:string password:string
7. rake db:migrate
8. Go on browser and given this command in URL
     http://0.0.0.0:3000

Sunday, December 5, 2010

Severity and Priority in software testing.

Priority and Severity :
Hi friends,
* Severity is assigned by the tester, severity of a defects is set based on the seriousness of the issues. It can be stated as mentioned.
1. Show stopper
2. Major
3. Minor 
4. Cosmetic

* Priority means somethings is afforded or deserve prior attention. A precedence established by order of importance.

Any idea about that topic please send to: 1feb1986@gmail.com


Question: What is a test strategy?
Answer:     A test strategy must address the risks and present a process that can reduce those risks.
The two components of Test strategy are:
a) Test Factor: The risk of issue that needs to be addressed as a part of the test strategy. Factors that are to be addressed in testing a specific application system will form the test factor.
b) Test phase: The phase of the systems development life cycle in which testing will occur.

Q. When to stop testing?
Answer:a) When all the requirements are adequately executed successfully through test
cases
b) Bug reporting rate reaches a particular limit
c) The test environment no more exists for conducting testing
d) The scheduled time for testing is over
e) The budget allocation for testing is over
Q. Your company is about to roll out an E-Commerce application. It is not possible to test the application on all types of browsers on all platforms and operating systems. What steps would you take in the testing environment to reduce the business risks and commercial risks?
Answer:
Compatibility testing should be done on all browsers (IE, Netscape, Mozilla etc.)
across all the operating systems (win 98/2K/NT/XP/ME/Unix etc.)
Q. What’s the difference between priority and severity?
Answer:
“Priority” is associated with scheduling, and “severity” is associated with standards.
“Priority” means something is afforded or deserves prior attention; a precedence
established by order of importance (or urgency).
“Severity” is the state or quality of being severe; severe implies adherence to rigorous standards or high principles and often suggests harshness; severe is marked by or requires strict adherence to rigorous standards or high principles, e.g. a severe code of behavior.
The words priority and severity do come up in bug tracking. A variety of commercial, problemtracking/management software tools are available. These tools, with the detailed input of software test engineers, give the team complete information so developers can understand the bug, get an idea of its ‘severity’, reproduce it and fix it. The fixes are based on project ‘priorities’ and ‘severity’ of bugs. The ‘severity’ of a problem is defined in accordance to the customer’s risk assessment and recorded in their selected tracking tool. A buggy software can ‘severely’ affect schedules, which, in turn can lead to a reassessment and renegotiation of ‘priorities’.

The important question is:
Q- What is the difference between Test Strategy and Test Plan ?
Ans- Test plan : After completion of SRS learning and business
requirement gathering test management concentrate on test 
planning,this is done by Test lead, or Project lead.

Test Strategy : Depends on corresponding testing policy 
quality analyst finalizes test Responsibility Matrix.
this is done by QA.

but both r Documents.

TEST PLAN : 
We describe what to Test ? 
1.Scope.
2.Approach.
3.What are the modules to test.

TEST STATERGY : 
We describe How to Test ? 
We define the methodology ?