Index:
- Common Directory Structure - Automation Frame Work for the AutoIT Project
- Naming Convention
- Coding Convention
- Proper Comments
- Write proper precondition
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
Hi,
ReplyDeleteThanks for sharing the very informative article.
http://kosmiktechnologies.com/selenium/
Augurs Technologies is a Top-class software development company in Germany. Providing solutions that meet customer requirements and business expectations. We combine proven techniques, industry knowledge and our technology know-how from experienced software developers to deliver high-quality software solutions. In our work, we particularly value integrity and customer service. We are one of the best software development companies in Germany.
ReplyDeleteWe plan smart, practical, cost-effective and instinctive software development, business process automation, e-commerce solutions for businesses that help streamline business processes and create revenue for startups and established businesses. The experience and know-how we have gained in the industry over the years enable us to provide solid and honest advice to our clients and produce highly effective results.
Software development company in Germany