Thursday, 3 May 2018

SAP CBTA - Component Based Test Automation - technologies supports

SAP CBTA( Component Based Test Automation) is SAP tool which supports specifically SAP stack mentioned in below

Supports Recording and execution for:

  • SAP GUI
  • SAP CRM based on HTMLB (Webcuif) :  7.0 SP12+, 7.0 EHP1 SP8+, 7.0 EHP2 SP2+, 7.0 EHP3
  • SAP Web Dynpro  : 7.02 SP5+, 7.30 SP1+, 7.31 SP10+, 7.40 SP5+ 
  • SAP Java Web Dynpro:  7.02 SP13+ ,7.30 SP1+, 7.31 SP10+, 7.40 SP5+
  • SAP UI5 / FIORI
  • SAP Portal (execution supported, the recording need some manual adjustment when the ids are not stable)  : only version 730 SP9 supported. Other versions may work, without guaranty nor support

Saturday, 17 March 2018

Broken Links and any Error links check from the web page with VB Script / UFT / QTP

Some times our customers may requests us to check for links which are broken from the web pages. This might be from the production sites or from the any of the web home page in pre-production sites.

Following code snippet can be used as quick solution to fulfill our requirement.

''#########################################################################
'' Use this code to verify all links are working fine in a already opened web page
''#########################################################################
On Error Resume Next
Set objBrowser = Description.Create
objBrowser("name").Value = "XXXXXXX"
objBrowser("CreationTime").Value = 0
Set objPage = Description.Create
objPage("title").Value = "XXXXX"

Set objLink = Description.Create
objLink("micclass").value = "Link"
objLink("html tag").value =  "A"

Set objBP = Browser(objBrowser).Page(objPage)

Set colLinkObjects = objBP.ChildObjects(objLink)

'Display count of all links

'Msgbox colLinkObjects.Count

inputFilesPath = "D:\Sample\WebLinksCheck.xlsx"
strSheetName = "Sheet1"

For i=2 to colLinkObjects.Count

    strLinkURL =  colLinkObjects(i).GetROProperty("url")
    strLinkName = colLinkObjects(i).GetROProperty("Name")
    ExportData2ExcelFile inputFilesPath,strSheetName,i,1,strLinkName
    ExportData2ExcelFile inputFilesPath,strSheetName,i,2,strLinkURL

    strVerifyMsg = VerifyLinksBroken(strLinkURL)
    ExportData2ExcelFile inputFilesPath,strSheetName,i,3,strVerifyMsg

Next

On Error GoTo 0

'=======================================================================
'Function: ExportData2ExcelFile()
' Description: Exporting runtime value to excel file
'Input: 
' =======================================================================

Public Function ExportData2ExcelFile(inputFilesPath,strSheetName,ColName,intRowNum,strValue)

  On Error Resume Next
'    inputFilesPath = Environment.Value("DataPath")

Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.Visible = False
Set objWorkbook = ExcelObj.Workbooks.Open(inputFilesPath)
Set worksheet = objWorkbook.WorkSheets(strSheetName)

worksheet.cells(ColName,intRowNum).value  = strValue

objWorkbook.Save
objWorkbook.Close
ExcelObj.Application.Quit
Set objWorkbook = Nothing
Set ExcelObj = Nothing

On Error GoTo 0
End Function



Public Function VerifyLinksBroken(strURL)
On Error Resume Next

  'Create a WinHTTP Request using the link's URL
  Set objWinHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
  objWinHTTP.Open "GET", strURL, False
  objWinHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"

  'Send the Request to the Server and capture the response
  objWinHTTP.Send
  iReturnVal = objWinHTTP.Status
  strErrorMsg = objWinHTTP.StatusText

  'Find out if the Link exists or is broken
  If iReturnVal = 200 Then
    strMsg = "Link - " & strURL & " Exists"
  ElseIf iReturnVal = 404 Then
    strMsg =  "Link - " & strURL & " is Broken with 404 error"
  Else
    strMsg =  "Error Code - " & iReturnVal & ":"&strErrorMsg&": Problem with this page"
  End If

  Set objWinHTTP = Nothing

On Error GoTo 0
VerifyLinksBroken = strMsg
End Function


Thursday, 8 March 2018

Micro Focus UFT certification exam details

After HPE is merged in Micro Focus, it is been stopped UFT certification for a few days and now Micro Focus has opened the gates again for UFT certification.

Following are the details to appear for exam
Link to register: https://microfocus.viewcentral.com/events/cust/catalog.aspx?cid=microfocus&pid=1&lid=7&bu_id=12&cat1_id=150,151,149,124
Certification Name: Unified Functional Testing v12.5 (ASP)
Exam ID: UFT120-125-ASP-Exam
Price: 200 USD
Duration: 150 Mins
Who can appear : Software Testers, DevOps Team Members, Quality Assurance Leads
UFT software version: UFT 12.5
Number of questions: 50
Passing score: 70%

Useful information:
Each question has a time duration of 3 minutes to be attempted by the student, failure to mark a response within the stipulated time will move the student to the next question on the block.
This is an online exam, For Security reasons questions once skipped or submitted cannot be reattempted.
Test results consist of a percentage score for each question and an overall percentage score for the test. Upon passing the exam learners will be emailed a soft copy of the Certificate. Micro Focus do not provide a detailed itemized performance report to the learners.

Recommended Syllabus:

Section
Objectives
Section 1. Articulate base UFT Concepts

• Identify functionalities and benefits provided by UFT
• Identify supported environments and supported technologies

Section 2.Identify and describe new features in UFT 12.5

• Describe the changes in the installation process for V12.5
• Identify functional testing principles and the benefits of automated testing

Section 3. API testing with UFT

• Identify standard activities in UFT that test common application processes
• Describe how to build a simple test using standard API activities

Section 4. Testing Web Services

• Describe how to build a Web Service Test
• Describe how to integrate data in a Web Service test

Section 5. Using Parameters

• Identify and use different parameters types
• Evaluate test results for iterative tests

Section 6. Running Tests

• Identify enhancements to the Run Sessions pane
• Describe how to use the command-line syntax for running API tests
• Identify actions in GUI Testing
• Identify action types
• Identify calls to existing actions and copies of action

Saturday, 3 March 2018

ALM project - field values update - easiest option

When you are working with ALM as administrator or project user,  you might have come across some challenges to upgrade any of the field values in bulk mode.

Example: updating test cases module/stream from one project

If we have few values then it would be easier to update manually by identifying the specific cases, but when you have massive cases then updating all values would be really tedious and time consuming.

If you have ALM DB access then simple way to update values is, connect to DB directly and fire SQL queries and commit the changes.

following is the one of the case how we can run update data by firing sql query

Prerequisite: we have to first connect to Project schema from DB client.


UPDATE ALM_DB.TEST
SET TS_USER_16 = 'MANUAL'
WHERE TS_TEST_ID = 54176 And TS_USER_16 = 'No'



UPDATE ALM_DB.TEST
SET TS_USER_16 = 'AUTOMATED'
WHERE TS_TEST_ID = 54176 And TS_USER_16 = 'Yes'

I had really saved couple of hours of effort after following this approach.

VBScript or UFT code to connect database and extract/update data

Following code can be used to connect to database to perform select/update queries.

Prerequisites:
  1. Install DB client in the machine from where we are executing this piece of code
  2. Establish DSN(Data Source Name)

Logic how VBScript code connects to DB:
DB client and WSH engine creates the interfaces/platforms separately but to make the bridge between both, we should have DSN which works as communication channel to perform the transactions.

strServerName= “abcd.com”
strDBName= “database”
strDBUserName="DBUserName"
strDBPWD= “DBPWD"
strSQL=  "Select * from employee "
If rc = micPass Then rc = DB_Execute_Query(strSQL,strServerName,strDBName,strDBUserName,strDBPWD)


'*******************************************************************************
'Function Name    : DB_Connection
'Description      : Function to establish the connection to database
'Input Parameters : strDataBaseUser,strDBPassword,strDataBaseName
'Output Parameters: None
'Createb By: Govardhan
'********************************************************************************


Public Function DB_Connection(strServerName,strDBName,strDBUserName,strDBPWD)
On Error Resume Next

Set Conn = CreateObject ("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
''' 'Create the string which is the command for connection
'''' strCon="Driver={PostgreSQL ANSI};Server=abc.com;Port=5432;Database=database;UID=server;PWD=server;"

strCon="Driver={PostgreSQL ANSI};Server="&strServerName&";Port=5432;Database="&strDBName&";UID="&strDBUserName&";PWD="&strDBPWD
Conn.ConnectionString = strCon
Conn.Open()
If Err.Number <> 0 then
rc = micFail
Reporter.ReportEvent rc,"Connect to database","Unable to connect to database due to following error," &_
vbcrlf & "Error Code: " & Err.Number &_
vbcrlf & "Error Description: " & Err.Description
Err.Clear
Else
rc = micPass
Reporter.ReportEvent rc,"Connect to database - "&strDBName &" - was successful","Connection successful"

Environment("DB_Connection_"&strDBName)= Conn
Environment("DB_Recordset_"&strDBName)= rs
End If
On Error GoTo 0
DB_Connection = rc
End Function

'*******************************************************************************
'Function Name    : DB_Execute_Query
'Description      : Function to execute a query and check if successfully executed or not
'Input Parameters : strSql,strDataBaseUser,strDBPassword,strDataBaseName
'Output Parameters: 0- Error,1 - Successful
'********************************************************************************

Public Function DB_Execute_Query(strSql, strServerName,strDBName,strDBUserName,strDBPWD)

On Error Resume Next

DB_Connection strServerName,strDBName,strDBUserName,strDBPWD
Set Conn = Environment("DB_Connection_"&strDBName)
Set rs = Environment("DB_Recordset_"&strDBName)  
   
Set rs = Conn.Execute (strSql)

If Err.Number <> 0 then

Reporter.ReportEvent micFail,"Query the database","Following error while querying the database," &_
vbcrlf & "Sql Statement: " & strSql &_
vbcrlf & "Error Code: " & Err.Number &_
vbcrlf & "Error Description: " & Err.Description
Err.Clear
rc  = micFail
DB_Execute_Query = rc
Else
rc = micPass
Reporter.ReportEvent micPass,  "Execute Sql Query","User should able to execute the sql query and the query is" & strSql ," Query Executed succefully"
DB_Execute_Query = rc
End If

'Close Connection and Recordset objects
DB_Close Conn,rs
On Error GoTo 0
DB_Execute_Query = rc
End Function

'*******************************************************************************
'Function Name    : DB_Close
'Description      : Function to disconnect the DB connection
'Input Parameters : strDataBaseName,RecordSet 
'Output Parameters: None
'********************************************************************************

Public Function DB_Close(strConnection,StrRecordSet)
On Error Resume Next

Set StrRecordSet= nothing
strConnection.close
    Set strConnection = nothing

On Error GoTo 0

End Function

Sunday, 18 February 2018

Shared Object Object Repository corrupted in UFT/QTP - INFORMATION CANNOT BE RETRIEVED FOR THE SELECTED TEST OBJECT

Sometimes you will get a message as "Information cannot be retrieved for the selected test object." when you are trying to edit/add shared object repository from Object Repository Manager in UFT/QTP.

It is quite annoying if you have lot of objects added in your shared OR and when you get such message. Once you receive this message in OR you can't add/modify any objects. It throws an error while saving OR.

Remember one thing, there is no direct solution to fix this. Following are few work around options. But some times these work around options too doesn't work. It happened for me too and Micro Focus team didn't provide any fix for this other than providing work around options.

1st Option:
Open the OR in the object repository manager.
Click on file->Export to XML. Save this xml file on the computer.
Close the object repository manager and open it again.
Click on File->Import from xml and import the XML you have just created.
Click on File->Save as to save this imported data as .tsr file.
Open the object repository comparison tool (Tools-> Object repository Comparison tool) and compare the new and the old repository. They should be same.
This newly create OR should resolve the issues.

2nd Option:
Create new empty OR and save it
Open corrupted repository in another window in OR Manager
copy objects whichever you need from corrupted OR to new OR

3rd Option:
Though this is not the option. you can choose this option if you have failed in above 2 options
Create Object Repository again from beginning :)

4th Option:
Keep maintaining back ups while you are creating OR. whenever you

Micro Focus team is aware about this defect in their product.




Tuesday, 13 February 2018

Create group reservations for concurrent licenses

To reserve a limited amount of licenses for use by different groups of users.

Instructions:

1. Create a plan which machines/users are restricted to using (or from using) particular amount of licenses and/or its features

2. Create the Reservation file (lsreserv) based on step 1 using the Wlsgrmgr.exe (see more on below section)

(Recommended) Save created file on the same directory where the process used by the License Server service.

3. If file is not saved on above location, then create a Windows System Environment Variable called “LSRESERV”, pointing to where lsreserv file is located (step 3)

Note: If the variable is not set, the local directory is searched for the “lsreserv” file. If none of the above suggestions are set, reservation feature is not used.

4. Restart the License Server service

5. If above doesn’t reflect the use of file, then restart/reboot machine
Note: To disable/turn-off the reservation file, just rename LSRESERV file mentioned on steps 2,3, and restart License Server.

General Guidelines:

1. The name of the file containing the group reservations should be lsreserv, and it should be located in the installation directory for the license server.

2. Adding, modifying, or deleting the lsreserv file must be followed by restarting the SentinelLM service for the changes to take effect.

3. User names in the lsreserv file are case-sensitive.

4. User names can appear in more than one group. The license manager searches downwards through the lsreserv file, using the first group it finds with that user in it.

5. Adding, modifying, or deleting the LSRESERV system environmental variable requires a server reboot for the changes to take effect. The value of this system environmental variable should be the full path (including the file name) to the lsreserv file, and it allows the reservations file to be placed somewhere other than the installation directory.

Setting Group Reservations
Group reservations give you the ability to exercise local administrative controls by associating a series of groups with each feature and reserving for each group a pool containing a certain number of licenses. Any licenses not specifically reserved fall into the general pool.

Including/Excluding Users
Selected users can be allowed to run certain applications or can be prevented from accessing applications. This can be used as an additional security measure.

Including/Excluding Computers
Certain computers can also be allowed to run or prevented from running applications. This can help to balance application usage when you want to prevent users from running applications on heavily loaded computers or file servers.

Configuring the Reservation File A group specification consists of:

1. The name of the feature for which the reservation applies.

Important: If you use FT-Unified and FTAddIns license features, please ensure, that you use first FT-Unified and then FTAddins. Otherwise the reservation for the FT-Unified feature will seemingly be ignored. This seems to be either a defect or an internal interpretation error.

2. The name of the group

3. The number of licenses reserved for that group

4. The login names of users or host IDs of computers that belong to that group

The groups must be mutually exclusive. Different groups for the same feature should not have common users or computers. The number of licenses reserved for a feature cannot exceed the number of concurrent copies specified in the license code for that feature.

Background functionality

1. When the License Server receives a request, it checks whether the user making the request belongs to a group. If so, and licenses are available for that group, the License Server will issue the license(s) and remove them from that group’s pool. Otherwise, requests will be serviced with licenses from the general pool until no licenses are available.

2. At start up, the License Server consults the environment variable, LSRESERV, for the path and file name of the reservation file. If the variable is not set, the local directory is searched for the file, lsreserv. If no file is found, the License Server assumes that no reservations exist. Reservation File (lsreserv) Format
Group reservations should be entered according to the following format, with one group per line:

feature_name,ver:group_name:num_of_licenses:{ user_name | computer }

One or more of user_name and/or computer may be specified, but at least one value must be specified in the last field. Version number is optional. If no version number is specified, only the feature name is used.

The characters $ and ! have special meaning: $ indicates the computer name, and ! indicates a logical NOT.

For example, two users, one computer in group 1:

stars:group1:2:tom bryant $athena

One user, one computer in group 2:

stars:group2:1:doug $0x4f3c5801

One computer to be excluded from dots, two licenses to be reserved for jill:

dots:group1:2:!$0x592ae8b0 jill

In these examples, the two groups denoted as group1 are distinct because they specify different feature names.

The following apply to groups:

* A maximum of 256 groups with 256 members (user names or computer IDs) each are supported. Versions of the license server greater than, or equal to, 8.0.5 support 1024 members in a group.

* Groups must be mutually exclusive.

* Different groups for the same feature should not have common users of computers.

* Group names and member names cannot exceed 64 characters each.

* The number of licenses reserved for a feature cannot exceed the number of concurrent copies specified in the license code for that feature.

* If you want to exclude all members of a group from using license tokens for a feature, you can specify 0 tokens.

* If the number of license tokens reserved is greater than the number of concurrent copies specified for the feature in the license code, the number of tokens specified in the license code will be used.

* The group reservation assumes the priority as per the information available in the group reservation file.

* The License Server user guide(index.html) can be found in \LicenseServer\server\SysAdminHelp. In this guide “Setting Group Reservations” directory has detailed information on how to setup reservation to users or groups.