Monday, May 19, 2014

Query to fetch column names

Query to fetch column names
SQL server 2008

Select column_name,*from information_schema.columns where table_name='tblnm' order by ordinal_position

Oracle 11g
Select column_name from all_tab_columns where table_name=upper('tblnm')

Query to fetch table name which use particular column
Select tbname from sysibm.syscolumns where name like '%column_name'

Friday, November 8, 2013

Defect Detection and Prevention Technique


Hey folks,
PFA one nice article on Defect Detection and Prevention.
Defect Prevention  & Defect Detection

       Defect Prevention techniques address how to prevent “error” before it is injected:

      Root Cause Analysis of problem

      Education and training

      Software process maturity and improvement (e.g. CMMI)

       Defect Detection techniques address how to find the faults:

      Testing (with various techniques covered in this class)

      Reviews and inspection

      Formal verification (next lesson)

Cause-and-Effect  Diagram ( for error prevention )

Tuesday, July 16, 2013

Various Utility Statements

Guys,

Here some useful utility statement m going to cover.

Sr No
Utility Statement
Description
Example
1
DescribeResult Statement
DescribeResult returns a text description of the specified error code.
Browser("mybrowser").Page("mypage").Image("myimage").Click 23, 47
errX = GetLastError
print (DescribeResult(errX))
2
ExecuteFile Statement
ExecuteFile Statement is used to execute the VBScript statements in the specified file. It is an alternative of associating a file to your test. Once the file runs, the definitions (functions, subroutines, classes, etc.) in the file are available from the global scope of the action's script
Please note that if are using ExecuteFile instead of associating it with test, you cannot debug a file/using breakpoints.
ExecuteFile "C:\abc\MyFunctionLib.vbs"
3
ExitAction Statement
ExitAction simply exits from the current running action.
If you use ExitAction statement in One_Action, it will immediately exit from this action and your next action will start executing
Print "Before Exit"
ExitAction 'without any spaces
Print "After Exit"
4
ExitActionIteration Statement
Suppose you are set to run two iteration of each action in the test, by providing two rows of data in datatable. Now you want to exit current iteration if
data in the table is not matching or something like that. We can do it using ExitActionIteration.
Its similar to ExitAction, only difference is that it exits the current iteration only, not action
empName = DataTable("Name", dtLocalSheet)
If empName = "Abhikansh" Then ExitActionIteration("exit iteration")
5
ExitComponent Statement
ExitComponent statement is used in Business Process Testing (BPT) using Quality Center(QC). It exits the current component run.
- If the component is not part of a component group, then any remaining component iterations are skipped and the run proceeds to the next component in the test.
- If the component is part of a component group, then the entire component group is skipped and the run proceeds to the next component after the component group.
- The pass or fail status of the component remains as it was in the step prior to the ExitComponent statement
 
6
ExitComponentIteration Statement
ExitComponentIteration is similar to ExitComponent, only difference is that it exits the current iteration only, not component.
 
7
ExitTest Statement
ExitTest exits from current test without proceeding to the next actions. The execution will be stopped from the point you use ExitTest statement.
 
8
ExitTestIteration Statement
ExitTestIteration Statement exits the current iteration of the QuickTest test or Quality Center business process test and proceeds to the next iteration, or exits the test run if there are no additional run-time parameter iterations. The pass or fail status of the test iteration remains as it was in the step prior to the ExitTestIteration statement
 
9
GetLastError Statement
GetLastError returns the error code of the last/most recent error. It is used with the DescribeResult Statement
Browser("mybrowser").Page("mypage").Image("myimage").Click 23, 47
errX = GetLastError
print (DescribeResult(errX))
10
InvokeApplication Statement
InvokeApplication is used to invoke an executable application i.e. '.exe' files
InvokeApplication "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
11
ManualStep Statement
 
 
12
Print Statement
Print is very useful and simple to use statement, generally used in place of 'msgbox'. It displays information in the QuickTest Print Log window during the

run session. The log window remains open until you close it manually
Print "This is an example"
Print Browser("MyBro").GetROProperty("title")
13
RegisterUserFunc Statement
Using RegisterUserFunc, you can add a new method or can override the existing method of any test object class.
For example, 'Set' is a method of WebEdit class, which sets value in the edit box.
Using RegisterUserFunc, you can change the behaviour of this method or you can add new method to WebEdit class
1.Registered method applies only to the test or library file in which you register it.
2. It is applicable to current run session only.
3. QuickTest clears all function registrations at the beginning of each run session.
Function NewSet (obj, val)
 Dim MyWord
 MyWord = UCase(val)   ' Returns val in upper case
 MySet=obj.Set(val)
End Function


RegisterUserFunc "WebEdit", "Set", "NewSet"
Browser("MyBro").Page("MyPage").WebEdit("name").Set "abhikansh"
UnRegisterUserFunc "WebEdit", "Set"
14
RunAction Statement
The RunAction statement runs the specified action (if associated with your test).
If you want to run external action, which is not associated with your test, then you have to use (Insert > Call to Action) or (Insert > Copy of Action) options from QTP menu.
RunAction "Action2", oneIteration
15
SetLastError Statement
Inserts a VBScript error into the test script
SetLastError(7)
16
UnregisterUserFunc Statement
instructs QuickTests to stop using the current registration of the method
 
17
Wait Statement
Wait is one of the most commonly used utility statement. Used for a pause of specified seconds, during a run session
Wait(10)
 

Thursday, June 20, 2013

Test Objects and Test Operations for Web



Test object is an object that qtp creates in the test to represent the actual object in the application.
Below are some of the web application Test Objects, based on the below syntax the test objects are been placed.

Syntax:

In which browser.In which page.In which object.what operation

As per above syntax the below script will be generate,
Browser("BrowserName").Page("PageName").Object("ObjectName").Operation

For Example:
Browser("Google").Page("Google").webedit("q").set "QTP 11.0"
Browser('Google").Page("Google").webbutton("Googlesearch").Click

Properties of an Object Names:
Browser Name: Google
Page Name: Google
Edit box: q
Button Name: Googlesearch

Test Objects:
Sr No
Description
Test Object
1
Edit box
WebEdit
2
Button
WebButton
3
Checkbox
WebCheckbox
4
Radio
WebRadioGroup
5
Image
Image
6
Link
Link
7
Text
WebElement
8
WebList
WebList
9
Table
WebTable
10
Frame
Frame

Test Operations:

There will be no change in Test Operations, For and Windows the test operations will be same 

Sr No
Description
Operation
1
Enter value into edit box
Set “Text”
2
Enter the password
SetSecure “EncryptedText”
3
Click on push button
Click
4
Select the item in combo box
Select “Item Name” or Select “Item Number”
5
Check the checkbox
Set “On/Off”
6
Choose the radio button
Set “Select”
7
Enter value in object
Type “Text”
8
Activate window
Activate
9
Minimize the window
Minimize
10
Maximize the window
Maximize
11
Close the window
Close