Tuesday, March 9, 2010

Descriptive Programming in QTP

Introduction:
This document demonstrates the usage of Descriptive programming in QTP 8.20. It also discusses situations where Descriptive programming can be used. Using Descriptive Programming automation scripts can be created even if the application has not been developed.
Descriptive Programming:
Whenever QTP records any action on any object of an application, it adds some description on how to recognize that object to a repository of objects called object repository. QTP cannot take action on an object until unless its object description is in the Object Repository. But descriptive programming provides a way to perform action on objects which are not in Object repository

Object Identification:

To identify an object during the play back of the scripts QTP stores some properties which helps QTP to uniquely identify the object on a page. Below screen shots shows an example Object repository:
When and Why to use Descriptive programming?

Below are some of the situations when Descriptive Programming can be considered useful:
1. The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <>”.
2. When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object.
3. When you don’t want to use object repository at all. Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository

Scenario 1: Suppose we have a web application that has not been developed yet. Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing

Scenario 2: Suppose an application has 3 navigation buttons on each and every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow this would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository we can just write 3 descriptions for the object and use it on any page.

4. Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well.
5. When you want to take action on similar type of object i.e. suppose we have 20 textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a good programming approach.

Code Optimisation Techeniques

VBScript – Code optimization Techniques


1. Use select case instead of If else if

2. StrComp vs 'String1=String2' [5/2/2001]


StrComp() is 100+% faster than using Ucase, for capital unsensitive strings. I actually never knew that strComp() existed. But I think I'm going to try to implent it now where possible. This test was based on the standard method: 500.000 iterations, 5 times.

Used Code:
Public Sub TestOne()
Dim strTest1 As String, strTest2 As String
strTest1 = UCase$("all j00r b453 r b3l0nG 70 U5")
strTest2 = UCase$("ALL J00r base R Bel0NG 70 U5")
If strTest1 = strTest2 Then
End If
End Sub

Public Sub TestTwo()>BR? Dim strTest1 As String, strTest2 As String
strTest1 = "all j00r b453 r b3l0nG 70 U5"
strTest2 = "ALL J00r base R Bel0NG 70 U5"
If StrComp(strTest1$, strTest2$, vbTextCompare) = 0 Then
End If
End Sub

3.
So much effect for so little change of code. These are only the statistics of the "Left" function, but I've also done some tests using "Ucase", "Lcase" and "Trim". All these functions are much faster using the "$" sign after the function. This happens for a simple reason: The functions return a variant without the $ sign. And variants are very slow, you should never use them.
Code Used:
Public Sub TestOne()
Dim strReturn As String
strReturn = Left("This is a test", 4)
End Sub
Public Sub TestTwo()
Dim strReturn As String
strReturn = Left$("This is a test", 4)
End Sub
4

Math

Use "X \ 1" instead of "Cint(x)" [5/2/2001]
"X \ 1" is a lot faster, and the end result is the same. The speed increase is actually more than I would have expected. But as with many other optimizations, this test has been done with 500.000 iterations. So for small loops you might not notice it.
Code used:
Public Sub TestOne()
Dim lngReturn As Long
lngReturn = CInt(100.543253)
End Sub
Public Sub TestTwo()
Dim lngReturn As Long
lngReturn = 100.543253 \ 1
End Sub


5

Always use "\" instead of "/" [5/1/2001]
Major performance gain here! For integer calculations you should always use "\" instead of "/" Using "\" is faster because f you divide by "/" the values will first be converted to singles. So for Sin/Cos/Tan operation you should still use "/" if you want to have precision. code used:
Public Sub TestOne()
Dim intResult As Integer
intResult = 100 / 50
End Sub
Public Sub TestTwo()
Dim intResult As Integer
intResult = 100 \ 50
End Sub
6

Use "x * x" instead of "x ^ 2" [4/30/2001]
You can use "x * x" instead of "x ^ 2". The end result will be the same. Well, I think the statistics prove themself, it's definetly worth to change your code to the optimized method! But As you can see the time for the calculations is very low anyways. Not even a second for 500.000 iterations Maybe with very large iterations you might notice it. Still I recommend to change the code since we want to have our programs running at the maximal speed possible, don't we? I'm not sure but maybe for larger quadratic calculations the routine might become faster. For example "x ^ 5" can also be done using "x * x * x * x * x"
Public Sub TestOne()
Dim dblResult As Double
dblResult = 4 ^ 2
End Sub
Public Sub TestTwo()
Dim dblResult As Double
dblResult = 4 * 4
End Sub
7
Arrays: Temporary variables [5/2/2001]
Well no doubt about it. Temporary variables are going to speed up your program. I have to say that I had to wait longer than expect to complete this routine. Anyway, if you're often pointing to an array, you've definetly got to use temporary values. Check the source code for an example. Note that I've done the test 5 times, but there was only 1 main iteration, cause the For...Next loops where long enough. Also note that in the first test without the temporary variable, I didn't declare the "lngTemp" variable. We didn't use it there, so no extra variable declaration.
Used code: Public Sub TestOne()
Dim I As Long, J As Long
Dim myArray(1 To 50000) As Long
For I = 1 To 50000
For J = I + 1 To 50000
If myArray(I) = myArray(J) Then
End If
Next
Next
Erase myArray
End Sub
Public Sub TestTwo()
Dim I As Long, J As Long
Dim myArray(1 To 50000) As Long
Dim lngTmp As Long
For I = 1 To 50000
lngTmp = myArray(I)
For J = I + 1 To 50000
If lngTmp = myArray(J) Then
End If
Next
Next
Erase myArray
End Sub
8
For…Each vs. For...Next [5/2/2001]
Using For...Next in arrays is a lot faster than For...Each. I'm not sure why this is caused, but probably also because you've got to use a variant as loop index for the "For...Each". And any serious programmer doesn't use a variant in his/her applications. I've used Lbound() and Ubound() in the For...Next loop, cause we do not have to worry about those two values, like in For...Each. No 500.000 iterations this time. I've done 1 iteration, the array was large enough to be precise enough. The test has been done 5 times though.
Used Code:
Public Sub TestOne()
Dim MyArray(1 To 100000)
Dim I As Variant
For Each I In MyArray
Next
End Sub
Public Sub TestTwo()
Dim MyArray(1 To 100000)
Dim I As Long
For I = LBound(MyArray) To UBound(MyArray)
Next
End Sub
9
For…Next: Always use longs [5/2/2001]
Never use anything else than longs in loops. Longs are the fastest variable type in Visual Basic. It's easy to explain why: They are 32bit, your processor is 32 bit, and every other type that isn't 32 bit needs to be converted to 32 bit (which takes time). Okay, now I could have used integers for this test. Integers are slower than longs, but just running an test between a long and integer, without anything between For...Next, will not really matter. But in larger loops, you'll always see that the Long variable type will win in performance.
So that's why I decided to use a single. And you can see the difference between it, definetly. I might add that I haven't used the normal test system for this test: 1 iteration, done 5 times. But the long and single test both contained 100000 iterations, so it should be all right.
Code used:
Public Sub TestOne()
Dim I As Single
For I = 0 To 100000
Next I
End Sub
Public Sub TestTwo()
Dim I As Long
For I = 0 To 100000
Next I
End Sub
11
'With' vs.' No With' [5/2/2001]
The results of this test are very irregular. Sometimes "With" wins and some "No with" wins. I've done this test 10 times, but everytime the same results... I'm not sure why this happens. I always thought that "With" would be (much) faster anyway. It could be the form I've used for this test, but it's highly unlikely. For this test I've done 5000 iterations, and done the test 5 times. Changing properties take so much time in VB. I have limitted the form calls to properties that are not graphical depending on something.
Used code:
Public Sub TestOne()
frmTest.Caption = "test"
frmTest.Enabled = True
frmTest.CurrentX = 10
frmTest.ScaleMode = vbPixels
frmTest.Tag = "test"
frmTest.Tag = "test1"
frmTest.Tag = "test2"
frmTest.Tag = "test3"
frmTest.Tag = "test4"
End Sub
Public Sub TestTwo()
With frmTest
.Caption = "test"
.Enabled = True
.CurrentX = 10
.ScaleMode = vbPixels
.Tag = "test"
.Tag = "test1"
.Tag = "test2"
.Tag = "test3"
.Tag = "test4"
End With
End Sub
12
Memory

Static vs. Public variables [5/3/2001]
Sometimes I use Static variables, but I think I'm going for public now. Not that it really matters that much, but any performance increase is welcome for me. I've used the standard method for this test: 500.000 iterations, 5 times.
Used Code:
Declaration section: Private Var1 As Long
Public Sub TestOne()
Static Var2 As Long
Var2 = Var2 + 1
End Sub
Public Sub TestTwo()
Var1 = Var1 + 1
End Sub
13
Methods

Use Byref or Byval? [5/2/2001]
ByRef arguments are 1/3 faster than Byval. If you do not explcitly declare arguments as Byval or Byref, VB will use ByRef as default. So if you never specify ByVal, there won't be any speed gain for you here. Except that you can specify ByRef explicit (see other VB Fibre article)
Code used:
Public Sub TestOne(ByVal lngValue1 As Long, ByVal strString1 As String, ByVal bByte1 As Byte)
'empty
End Sub
Public Sub TestTwo(ByRef ngValue1 As Long, ByRef strString1 As String, ByRef bByte1 As Byte)
'empty
End Sub
14
Specify ByRef explictly [5/2/2001]
A very little speed increase. I expected a larger increase... Anyway, it's always better to declare arguments byval or byref explicitly. You can then see how values are passed, and see if it returns anything directly. I'm not sure if it's worthy to change all your subs and functions to Byref, because the speed increase ain't that much.
Code used:
Public Sub TestOne(lngValue1 As Long, strString1 As String, bByte1 As Byte)
'empty
End Sub
Public Sub TestTwo(ByRef ngValue1 As Long, ByRef strString1 As String, ByRef bByte1 As Byte)
'empty
End Sub
15
To call or not to call? [5/1/2001]
The difference between call or no call is very small. The funny thing is that there's a difference if you call a sub or a function. That's why I'm probably going to add another test to check if "no call" is faster for subs. The results of this test are based on a function, the function returns a string.
Public Function TestOne() As String
TestOne = "empty"
End Function
This was function was called 500.000 times using "Call Testone" and "Testone", and done 5 times

Browser Compatibility of QTP 9.2

QuickTest supports recording tests only on Microsoft Internet Explorer. It supports running tests on the following Web browsers:
➤ Microsoft Internet Explorer
➤ Netscape Browser
➤ Mozilla Firefox
➤ Applications with embedded Microsoft Internet Explorer Web browser controls

Keep the following in mind when using Microsoft Internet Explorer as your Web browser:
➤ QuickTest Professional Web support behaves as a browser extension in Microsoft Internet Explorer. Therefore, you cannot use the Web Add-in on Microsoft Internet Explorer without enabling the Enable third-party browser extensions option. To set the option, in Microsoft Internet Explorer choose Tools > Internet Options > Advanced and select the Enable thirdparty
browser extensions option.
➤ QuickTest Professional does not support tabbed browsing. Therefore, before using the Web Add-in, you must disable tabbed browsing on Internet Explorer. To disable the option, in Microsoft Internet Explorer choose Tools > Internet Options > Advanced and clear the Enable Tabbed Browsing option. After clearing this option, you must restart your browser before using the QuickTest Professional Web Add-in.

Keep the following in mind when using Netscape Browser or Mozilla Firefox:
➤ You must be logged-in with Administrator privileges (or have write permissions to the browser’s installation folder) on the QuickTest computer when launching Mozilla Firefox with QuickTest for the first time, since adding QuickTest support for Mozilla Firefox requires a file to be created in the browser's installation folder.
➤ You can record tests on Microsoft Internet Explorer and run them on Netscape Browser or Mozilla Firefox. You cannot record tests on Netscape Browser or Mozilla Firefox. There are two ways to create tests to run on Netscape Browser or Mozilla Firefox:
1) Record the test on Microsoft Internet Explorer.
2) Use the keyword-driven methodology: create an object repository for your application using the Object Repository window (local object repository) or Object Repository Manager (shared object repository), and then add steps using the Keyword View or Step Generator. When you use the keyword-driven methodology, you can add objects using Mozilla Firefox or Netscape if you want; you do not have to use Microsoft Internet Explorer.

Wednesday, March 3, 2010

REVIEW CHECKLIST for Automation Script

REVIEW CHECKLIST
Script Name:

Planning/Action Step Review Compliance
Maintainability "Do You understand the Script You are reviewing
(Are the names used meaningful and logical)"
Does the Script implements the desired functionality as per the Scenario of Test Case document?
Are the Error/Confirmation messages or input values hard coded?
Are there proper comments for wait () statements, mentioning the reason why sleep has been included?
Are there proper comments include for the modifications done?
Is it using the credit card information from central repository?
If it is a booking script, is it logging the ORL to the central excel sheet?
is the email id used is from central data table?
Is it a GR path? If yes, how is email id generation handled?
Delete cookie is included at the top of the script?
Is proper credit card used as per the module?

Reusability Are the functions that are used defined in the Utility files ?
Is there any repeated code present in the script file?
Is the implementation optimized?
Is this a repeated script/code/functionality?

Coding Standard Are the naming conventions followed for scripts, functions and variables?
Are there necessary Comments that reflect the Scenario or Test Case document?
Are there variables that are declared but never used in the Script?
Is the email id used is proper?
Has the documentation done in the script.
If there are static functions defined, are the properly commented(Remember that a static function should always start with _orb)
"Do the following lines appear at the top of script?
report_msg(""Running against platform: "" & platform);
report_msg(""Using user: "" & test_props[""email""]);"
"Do the following lines appear at the bottom of script?
report_msg(""END OF TEST"");
"
Are the data table statements used properly?
Do all the values such as Script ownership, status..etc are set for the script in QC?


Indentation Are the used variables declared at the top of the Script File and are they properly commented?
Has sufficient care taken on indentation of the script statements, logical loops, messages, etc,?

Execution Has the Test Case executed devoid of any errors and exceptions
Does the script pass through QC?

The Product Quality Measures - Metrics used in the Testing

The following are the Metrics used in the Testing …

1. Customer satisfaction index

This index is surveyed before product delivery and after product delivery (and on-going on a periodic basis, using standard questionnaires).The following are analyzed:

· Number of system enhancement requests per year

· Number of maintenance fix requests per year

· User friendliness: call volume to customer service hotline

· User friendliness: training time per new user

· Number of product recalls or fix releases (software vendors)

· Number of production re-runs (in-house information systems groups)

2. Delivered defect quantities

They are normalized per function point (or per LOC) at product delivery (first 3 months or first year of operation) or Ongoing (per year of operation) by level of severity, by category or cause, e.g.: requirements defect, design defect, code defect, documentation/on-line help defect, defect introduced by fixes, etc.

3. Responsiveness (turnaround time) to users

· Turnaround time for defect fixes, by level of severity

· Time for minor vs. major enhancements; actual vs. planned elapsed time

4. Product volatility

· Ratio of maintenance fixes (to repair the system & bring it into compliance with specifications), vs. enhancement requests (requests by users to enhance or change functionality)

5. Defect ratios

· Defects found after product delivery per function point.

· Defects found after product delivery per LOC

· Pre-delivery defects: annual post-delivery defects

· Defects per function point of the system modifications

6. Defect removal efficiency

· Number of post-release defects (found by clients in field operation), categorized by level of severity

· Ratio of defects found internally prior to release (via inspections and testing), as a percentage of all defects

· All defects include defects found internally plus externally (by customers) in the first year after product delivery

7. Complexity of delivered product

· McCabe's cyclomatic complexity counts across the system

· Halstead’s measure

· Card's design complexity measures

· Predicted defects and maintenance costs, based on complexity measures

8. Test coverage

· Breadth of functional coverage

· Percentage of paths, branches or conditions that were actually tested

· Percentage by criticality level: perceived level of risk of paths

· The ratio of the number of detected faults to the number of predicted faults.

9. Cost of defects

· Business losses per defect that occurs during operation

· Business interruption costs; costs of work-around

· Lost sales and lost goodwill

· Litigation costs resulting from defects

· Annual maintenance cost (per function point)

· Annual operating cost (per function point)

· Measurable damage to your boss's career

10. Costs of quality activities

· Costs of reviews, inspections and preventive measures

· Costs of test planning and preparation

· Costs of test execution, defect tracking, version and change control

· Costs of diagnostics, debugging and fixing

· Costs of tools and tool support

· Costs of test case library maintenance

· Costs of testing & QA education associated with the product

· Costs of monitoring and oversight by the QA organization (if separate from the development and test organizations)

11. Re-work

· Re-work effort (hours, as a percentage of the original coding hours)

· Re-worked LOC (source lines of code, as a percentage of the total delivered LOC)

· Re-worked software components (as a percentage of the total delivered components)

12. Reliability

· Availability (percentage of time a system is available, versus the time the system is needed to be available)

· Mean time between failure (MTBF).

· Man time to repair (MTTR)

· Reliability ratio (MTBF / MTTR)

· Number of product recalls or fix releases

· Number of production re-runs as a ratio of production runs


Metrics for Evaluating Application System Testing:

Metric = Formula

Test Coverage = Number of units (KLOC/FP) tested / total size of the system. (LOC represents Lines of Code)

Number of tests per unit size = Number of test cases per KLOC/FP (LOC represents Lines of Code).

Acceptance criteria tested = Acceptance criteria tested / total acceptance criteria

Defects per size = Defects detected / system size

Test cost (in %) = Cost of testing / total cost *100

Cost to locate defect = Cost of testing / the number of defects located

Achieving Budget = Actual cost of testing / Budgeted cost of testing

Defects detected in testing = Defects detected in testing / total system defects

Defects detected in production = Defects detected in production/system size

Quality of Testing = No of defects found during Testing/ (No of defects found during testing + No of acceptance defects found after delivery) *100

Effectiveness of testing to business = Loss due to problems / total resources processed by the system.

System complaints = Number of third party complaints / number of transactions processed

Scale of Ten = Assessment of testing by giving rating in scale of 1 to 10

Source Code Analysis = Number of source code statements changed / total number of tests.

Effort Productivity = Test Planning Productivity = No of Test cases designed / Actual Effort for Design and Documentation

Test Execution Productivity = No of Test cycles executed / Actual Effort for testing

Excel Function

' FUNCTION NAME: fnCreateExcel()
' PURPOSE:This function will return a new Excel Object with a default new Workbook
' INPUTS: None
' OUTPUTS: Newly created excel sheet

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
public Function fnCreateExcel()
On error resume next

Dim excelSheet 'Excel.worksheet

Set objExcelApp = CreateObject("Excel.Application") 'Create a new excel Object
objExcelApp.Workbooks.Add
objExcelApp.Visible = True
Set CreateExcel = objExcelApp

If err.number<>0 Then
strFuncProcName=" fnCreateExcel"
Call prErrorHandler(environment.Value("TestName"),strFuncProcName,err.number,err.description,err.Source,environment.Value("LocalHostName"))
err.clear
End If
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' FUNCTION NAME: prCloseExcel(objExcelApp)
' PURPOSE:This procedure will close the given Excel Object
' INPUTS: 1' Instance of Excel application.
' OUTPUTS: None

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

public Sub prCloseExcel(ExcelApp)
On error resume next

Set excelSheet = ExcelApp.ActiveSheet
Set excelBook = ExcelApp.ActiveWorkbook
Set objExcel= CreateObject("Scripting.FileSystemObject")

objExcel.CreateFolder strDataFilePath&"Temp"
objExcel.DeleteFile strDataFilePath&"ExcelExamples.xls"
excelBook.SaveAs strDataFilePath&"ExcelExamples.xls"
ExcelApp.Quit
Set ExcelApp = Nothing
Set objExcel = Nothing

If err.number<>0 Then
strFuncProcName="prCloseExcel"
Call prErrorHandler(environment.Value("TestName"),strFuncProcName,err.number,err.description,err.Source,environment.Value("LocalHostName"))
err.clear
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' FUNCTION NAME: fnSaveWorkbook(ExcelApp, workbookIdentifier, path)
' PURPOSE:The function will save a workbook according to the workbookIdentifier
' The function will overwrite the previously saved file under the given path
' Return "OK" on success and "Bad Workbook Identifier" on failure
' workbookIdentifier - The name or number of the requested workbook
' INPUTS:3'
' ExcelApp The excel object
' workbookIdentifier: the workbook/sheet name or Id
' path: The path to whihc the file has to be saved.
' OUTPUTS: The function will overwrite the previously saved file under the given path
' Return Ttrue after saving

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fnSaveWorkbook(ExcelApp, strworkbookIdentifier, path) 'As String
On error resume next

Dim strWorkBook 'Excel.workbook
Set strWorkBook = ExcelApp.strWorkBook(strworkbookIdentifier)

If Not strWorkBook Is Nothing Then
If path = "" Or path =strWorkBook.FullName Or path = strWorkBook.Name Then
strWorkBook.Save
Else
Set objExcel = CreateObject("Scripting.FileSystemObject")

'if the path has no file extension then add the 'xls' extension
If InStr(path, ".") = 0 Then
path = path & ".xls"
End If

objExcel.DeleteFile path
Set objExcel = Nothing

strWorkBook.SaveAs path
End If
SaveWorkbook = True
Else
SaveWorkbook = False
End If
If err.number<>0 Then
strFuncProcName=" fnSaveWorkbook"
Call prErrorHandler(environment.Value("TestName"),strFuncProcName,err.number,err.description,err.Source,environment.Value("LocalHostName"))
err.clear
End If
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' FUNCTION NAME: prSetCellValue(ExcelSheet, intRow, intColumn, strValue)

' PURPOSE:The procedure sets the given 'value' in the cell which is identified by
' its row column and parent Excel sheet
' excelSheet - the excel sheet that is the parent of the requested cell
' row - the cell's row in the excelSheet
' column - the cell's column in the excelSheet
' value - the value to be set in the cell
' INPUTS:4
' ExcelSheet,: The excel sheet to whihc the value needs to be set.
' intRow: The row to whihc the value has to be set
' intColumn : The column to whihc the value has to be set
' strValue: The value that needs to be set.
' OUTPUTS: None

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
public Sub prSetCellValue(ExcelSheet, intRow, intColumn, strValue)
On Error Resume Next

ExcelSheet.Cells(intRow, intColumn) = strValue

If err.number<>0 Then
strFuncProcName=" prSetCellValue"
Call prErrorHandler(environment.Value("TestName"),strFuncProcName,err.number,err.description,err.Source,environment.Value("LocalHostName"))
err.clear
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' FUNCTION NAME: fnGetCellValue(ExcelSheet, intRow, intColumn)
' PURPOSE:The function returns the cell's value according to its row column and sheet
' excelSheet - the Excel Sheet in which the cell exists
' row - the cell's row
' column - the cell's column
'' INPUTS:3' ExcelSheet,: The excel sheet / intRow : the row to whihc the value has to be set / intColumn: the column to which the value has to be set.
' OUTPUTS: return 0 if the cell could not be found and the value in the cell , if it can be found.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fnGetCellValue(ExcelSheet, intRow, intColumn)


value = 0
Err = 0

inttempValue = ExcelSheet.Cells( intRow, intColumn)
If Err = 0 Then
value = inttempValue
Err = 0
End If
fnGetCellValue = value



End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' FUNCTION NAME: fnGetSheet(ExcelApp, sheetIdentifier)
' PURPOSE:The GetSheet method returns an Excel Sheet according to the sheetIdentifier
' INPUTS:2'
' ExcelApp - the Excel application which is the parent of the requested sheet
' sheetIdentifier - the name or the number of the requested Excel sheet
' OUTPUTS: It will return name or the number of the requested Excel sheet or ' return Nothing on failure

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fnGetSheet(ExcelApp, sheetIdentifier) 'As Excel.worksheet


Set strGetSheet = ExcelApp.Worksheets.Item(sheetIdentifier)


End Function

Tuesday, March 2, 2010

Material Master FAQS

Material Master FAQS QUESTIONS


Q: How can I extend all material to a new plant?


Q: How can we delete materials permanently from Material master?


Q: SAP only provides moving average value for current, previous period, and previous year.
SAP does not provide transactions/reports that will provide moving average value for a given date.
How can I report moving average price for material number 10000000 at plant 0001 on July 4, 1998 .



Q: We have defined all the variables for the materials. However, when I attempt to use Material Matchcode object MAT1, I get the response "No possible entries found". Why?


Q: The matchcode object selection is defaulted to matctcode ID "B". Iwould like to change to M "Material by Description" What is the solution?




Q: We can make field mandatory. We want to make a default value to a Particular field in the Material
Master. Say, We want that the period indicator in the MRP2 view as "P". What is the best way?


Q: What is the use of configurable material.?









Material Master FAQS ANSWERS


Q: How can I extend all material to a new plant?
A: The SAP program - RMDATIND is
used to create /update material master record.


Q: How can we delete materials permanently from Material master?
A: Use transaction MM70 - Material Master->Other->Reorganization->Material->Choose.
Build variant with selection range of material master records to be selected for deletion and maintain
run parameters.
Execute.
Use transaction MM71 - Material Master-> other-> Reorganizationn-->Material->Reorganization
Build a second variant
Maintain run parameters and execute.
It is also important to remove the records manually from info record, POs, PRs, reservation etc
for successful deletion of the material.
Q: SAP only provides moving average value for current, previous period, and previous year. SAP
does not provide transactions/reports that will provide moving average value for a given date.
How can I report moving average price for material number 10000000 at plant 0001 on July 4,
1998 .
A: Try any of these solutions:
1. Change the updating level of the structure (S031) to "daily". In LIS the total value and the total
stock are available. Divide value by the stock. It is possible to calculate this dynamically when
the analysis is run and to display the result.
2. Create your own structure in LIS and populate it by copying the Moving Average Price from the
material master every time there is a transaction. You will have data on those days when there
was a transaction.
Q: We have defined all the variables for the materials. However, when I attempt to use Material
Matchcode object MAT1, I get the response "No possible entries found". Why?
A: Matchcode i.d. "B", "Material by bill of material" has a selection condition for field STLNR NE ' '.
STLNR is the BOM number associated with a material in table MAST. Hence the message - "no
possible entries..." pops up if there are no bills of materials associated with your material numbers.
You get the matchcodes as long as the material referred by you has BOM number associated with
it.
Q: The matchcode object selection is defaulted to matctcode ID "B". Iwould like to change to M "
Material by Description" What is the solution?
A: Press the pull down arrow on the material number field and matchcode "B" is displayed, press
F5 double-click matchcode i.d. "M", then press F6 . This will set matchcode "M" as the default.
Q: We can make field mandatory. We want to make a default value to a Particular field in the Material
Master. Say, We want that the period indicator in the MRP2 view as "P". What is the best way?
A: Use transaction variant. Transaction SHD0 and then Transaction SE93.


Q: What is the use of configurable material.?
A: Configurable material is useful if you have a large number of combination of parts that go into a
product. It means different permutations and combinations of the parts for same material. If you
maintain a unique material code for each combination , you require a large number of material
numbers. KMAT may be used in such a case where you maintain just one generic product code.
A super BOM is maintained for such a material consisting of all possible alternatives. A routing is
also maintained consisting of all possible operations that could be used. Typically configurable
material is used in Made To Order (MTO) environment. However frequently ordered
configurations may be planned with a material variant which needs to have a material master record.
Thus Material variants may have stock and value. Depending upon characteristic values chosen at
sales order entry Sales Order BOM is created. Routing operations are also chosen depending upon
which BOM components are assigned to them.

QuickTest Professional License

Seat license
A permanent license that is specific to the computer on which it is installed. When you first install QuickTest, this license includes a 14-day demo period during which you must contact Mercury to obtain a permanent seat license key. After you receive the seat license key, you can activate it to work with QuickTest Professional permanently.

Concurrent license
A concurrent license regulates the number of QuickTest Professional concurrent users. You can work with a concurrent license only if a concurrent license server is installed on your local network, and that license server has at least one available license that is not currently in use.

Monday, March 1, 2010

When to stop testing?

When to stop testing?



Testing is potentially endless. We can not test till all the defects are unearthed and removed -- it is simply impossible.

At some point, we have to stop testing and ship the software. The question is when.



"When to stop testing" is one of the most difficult questions to a test engineer.



Common factors in deciding when to stop are:



· Deadlines ( release deadlines,testing deadlines.)

· Test cases completed with certain percentages passed

· Test budget depleted

· Coverage of code/functionality/requirements reaches a specified point

· The rate at which Bugs can be found is too small

· Beta or Alpha Testing period ends

· The risk in the project is under acceptable limit.





Practically, we feel that the decision of stopping testing is based on the level of the risk acceptable to the management. As testing is a never ending process we can never assume that 100 % testing has been done, we can only minimize the risk of shipping the product to client with the testing done.



The risk can be measured by Risk analysis but for small duration / low budget / low resources project, risk can be deduced by simply: -

· Measuring Test Coverage.

· Number of test cycles.

· Number of high priority bugs.



Realistically, testing is a trade-off between budget, time and quality.

It is driven by profit models.

The pessimistic, and unfortunately most often used approach is to stop testing whenever some, or any of the allocated resources -- time, budget, or test cases -- are exhausted.



The optimistic stopping rule is to stop testing when either reliability meets the requirement, or the benefit from continuing testing cannot justify the testing cost. This will usually require the use of reliability models to evaluate and predict reliability of the software under test. Each evaluation requires repeated running of the following cycle: failure data gathering -- modeling -- prediction. This method does not fit well for ultra-dependable systems, however, because the real field failure data will take too long to accumulate.



Statistical Testing

This can be made as a release criteria and can be used to arrive at the conditions to stop software testing.



The concept of statistical testing was invented by the late Harlan Mills (IBMFellow who invented Clean Room software engineering). The central idea is to usesoftware testing as a means to assess the reliability of software as opposed to a debugging mechanism. Statistical testing needs to exercise the software along an operational profile and then measure interfailure times that are then used to estimate its reliability. A good development process should yield an increasing mean time between failure every time a bug is fixed.

QA and QC

QA & QC





Quality Assurance


Quality Control

A planned and systematic set of activities necessary to provide adequate confidence that requirements are properly established and products or services conform to specified requirements.


The process by which product quality is compared with applicable standards; and the action taken when nonconformance is detected.

An activity that establishes and evaluates the processes to produce the products.


An activity which verifies if the product meets pre-defined standards.

Helps establish processes.


Implements the process.

Sets up measurements programs to evaluate processes.


Verifies if specific attribute(s) are in a specific product or service

Identifies weaknesses in processes and improves them.


Identifies defects for the primary purpose of correcting defects.

QA is the responsibility of the entire team.


QC is the responsibility of the tester.

Prevents the introduction of issues or defects


Detects, reports and corrects defects

QA evaluates whether or not quality control is working for the primary purpose of determining whether or not there is a weakness in the process.


QC evaluates if the application is working for the primary purpose of determining if there is a flaw / defect in the functionalities.

QA improves the process that is applied to multiple products that will ever be produced by a process.


QC improves the development of a specific product or service.

QA personnel should not perform quality control unless doing it to validate quality control is working.


QC personnel may perform quality assurance tasks if and when required.

Web site Testing

Web site Testing





Compatibility Testing

Ø Compatibility testing tests your web site across a wide variety browser/operating system combinations. This testing typically exposes problems with plug-ins. ActiveX controls, Java applets, JavaScript, forms and frames. Currently there are over 100 possible combinations of different windows operating systems and various versions of NE and IE browsers. It is important to test across a large number of these to ensure that users with diverse config don’t experience problems when using the web site or application.



Content Testing

– Content Testing verifies a web site’s content such as images, clip art and factual text.



Database Testing

– Most web sites of any complexity store and retrieve information from some type of database. Clients often want us to test the connection between their web site and database in order to verify data and display integrity.



Functionality Testing

– Functionality testing ensures that the web site performs as expected. The details of this testing will vary depending on the nature of your web site. Typical examples of this type of testing include link checking, form testing, transaction verification for e-commerce and databases, testing java applets, file upload testing and SSL verification. For testing, which is repetitive in nature, an automated test tool such as Rational’s Visual Test can be used to decrease the overall duration of a test project.



Performance Testing

– Performance Testing measures the web site performance during various conditions. When the conditions include different numbers of concurrent users, we can run performance tests at the same time as stress and load tests.



Eight Second Rule

– Every page within a web site must load in eight seconds or less, even for users on slow modem connections, or they risk losing their user to a competitor site that serves pages more quickly.



Server Side Testing

– Server side testing tests the server side of the site, rather than the client side. Examples of server side testing include testing the interaction between a web and an application server, checking database integrity on the database server itself, verifying that ASP scripts are being executed correctly on the server and determining how well a web site functions when run on different kinds of web servers.



Stress and Load Testing

– Load Testing, a subset of stress testing, verifies that a web site can handle a particular number of concurrent users while maintaining acceptable response times. To perform this type of testing use sophisticated automated testing tools, such as Segue’s SilkPerformer, to generate accurate metrics based on overall system load and server configuration.

How to Write Effective Bug Reports

How to Write Effective Bug Reports

How often do we see the developers requiring more information on the bug reports filed by us? How often do we need to spend more time investigating on the issue after the bug report has been filed? How often do we get to hear from the developers that the bug is not reproducible on their end and we need to improvise on the Steps To Reproduce? In a broad sense, we end up spending more time on these issues rather than investing more time testing the system. The problem lies in the quality of bug reports. Here are some areas which can be improved upon to achieve that perfect bug report.

The Purpose Of A Bug Report

When we uncover a defect, we need to inform the developers about it. Bug report is a medium of such communication. The primary aim of a bug report is to let the developers see the failure with their own eyes. If you can't be with them to make it fail in front of them, give them detailed instructions so that they can make it fail for themselves. The bug report is a document that explains the gap between the expected result and the actual result and detailing on how to reproduce the scenario.

After Finding The Defect

  • Draft the bug report just when you are sure that you have found a bug, not after the end of test or end of day. It might be possible that you might miss out on some point. Worse, you might miss the bug itself.
  • Invest some time to diagnose the defect you are reporting. Think of the possible causes. You might land up uncovering some more defects. Mention your discoveries in your bug report. The programmers will only be happy seeing that you have made their job easier.
  • Take some time off before reading your bug report. You might feel like re-writing it.

Defect Summary

The summary of the bug report is the reader.s first interaction with your bug report. The fate of your bug heavily depends on the attraction grabbed by the summary of your bug report. The rule is that every bug should have a one-liner summary. It might sound like writing a good attention-grabbing advertisement campaign. But then, there are no exceptions. A good summary will not be more than 50-60 characters. Also, a good summary should not carry any subjective representations of the defect.

The Language

  • Do not exaggerate the defect through the bug report. Similarly, do not undertone it.
  • However nasty the bug might be, do not forget that it.s the bug that.s nasty, not the programmer. Never offend the efforts of the programmer. Use euphemisms. 'Dirty UI' can be made milder as 'Improper UI'. This will take care that the programmer's efforts are respected.
  • Keep It Simple & Straight. You are not writing an essay or an article, so use simple language.
  • Keep your target audience in mind while writing the bug report. They might be the developers, fellow testers, managers, or in some cases, even the customers. The bug reports should be understandable by all of them.

Steps To Reproduce

  • The flow of the Steps To Reproduce should be logical.
  • Clearly list down the pre-requisites.
  • Write generic steps. For example, if a step requires the user to create file and name it, do not ask the user to name it like "Mihir's file". It can be better named as "Test File".
  • The Steps To Reproduce should be detailed. For example, if you want the user to save a document from Microsoft Word, you can ask the user to go to File Menu and click on the Save menu entry. You can also just say "save the document". But remember, not everyone will not know how to save a document from Microsoft Word. So it is better to stick to the first method.
  • Test your Steps To Reproduce on a fresh system. You might find some steps that are missing, or are extraneous.

Test Data

Strive to write generic bug reports. The developers might not have access to your test data. If the bug is specific to a certain test data, attach it with your bug report.

Screenshots

Screenshots are a quite essential part of the bug report. A picture makes up for a thousand words. But do not make it a habit to unnecessarily attach screen shots with every bug report. Ideally, your bug reports should be effective enough to enable the developers to reproduce the problem. Screen shots should be a medium just for verification.

  • If you attach screen shots to your bug reports, ensure that they are not too heavy in terms of size. Use a format like jpg or gif, but definitely not bmp.
  • Use annotations on screen shots to pin-point at the problems. This will help the developers to locate the problem at a single glance.

Severity / Priority

  • The impact of the defect should be thoroughly analyzed before setting the severity of the bug report. If you think that your bug should be fixed with a high priority, justify it in the bug report. This justification should go in the Description section of the bug report.
  • If the bug is the result of regression from the previous builds/versions, raise the alarm. The severity of such a bug may be low but the priority should be typically high.

Logs

Make it a point to attach logs or excerpts from the logs. This will help the developers to analyze and debug the system easily. Most of the time, if logs are not attached and the issue is not reproducible on the developer's end, they will revert to you asking for logs.

If the logs are not too large, say about 20-25 lines, you can paste it in bug report. But if it is large enough, add it to your bug report as an attachment, else your bug report will look like a log.

Other Considerations

  • If your bug is randomly reproducible, just mention it in your bug report. But don.t forget to file it. You can always add the exact steps to reproduce anytime later you (or anyone else) discover them. This will also come to your rescue when someone else reports this issue, especially if it.s a serious one.
  • Mention the error messages in the bug report, especially if they are numbered. For example, error messages from the database.
  • Mention the version numbers and build numbers in the bug reports.
  • Mention the platforms on which the issue is reproducible. Precisely mention the platforms on which the issue is not reproducible. Also understand that there is difference between the issue being not reproducible on a particular platform and it not being tested on that platform. This might lead to confusion.
  • If you come across several problems having the same cause, write a single bug report. The fix of the problem will be only one. Similarly, if you come across similar problems at different locations requiring the same kind of fix but at different places, write separate bug reports for each of the problems. One bug report for only one fix.
  • If the test environment on which the bug is reproducible is accessible to the developers, mention the details of accessing this setup. This will help them save time to setting up the environment to reproduce your bug.
  • Under no circumstances should you hold on to any information regarding the bug. Unnecessary iterations of the bug report between the developer and the tester before being fixed is just waste of time due to ineffective bug reporting.