Wednesday, May 6, 2015

Adding custom methods to an object

During an automation project, generally you work on same web application. And during this project you see that making a procedure is same on all of the test cases (like ensuring the synchronization of a web page). You can make use of shared function library to develop faster/easier/maintainable test scripts (Also you can check Extensibility plugin).

Thursday, February 26, 2015

Making external webservice call in C# rule

In a C# rule, you can also make external web service call. Before doing this first we have to make some configuration settings (like security and adding reference). If the security configuration is left as default you probably are going to get "System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission'" error.

Wednesday, February 25, 2015

Adding .Net Reference

You can write complicated C# codes in SV Designer. By default only System and System.Code references can be used while wirting your C# methods. Since you are mostly working with XML objects you are going to have to use System.Xml.XmlDocument reference.

When you add using System.Xml; line at the top of your code you are going to get "Xml does not exist in the namespace 'System'" error.

Enabling scripted rules

Because of heavy business schedule I wasn't able to submit new posts. Meanwhile I was mostly working on UFT and HP's Service Virtualization (SV). After the business hours it would be better for me to write some posts before forgetting what I learned. I am going to describe how to enable scripted rules in SV.

Sunday, September 7, 2014

Upgrading QC 11 to ALM 12.01

According to some QC admins upgrading and migrating to ALM may be very complicated. I am going to describe how we made this process in less than 3 hours for a project that is bigger than 40GB without any problem. No DBA needed for this operation :) Following the described procedures on this page is at your own risk! Do not blame me if something goes wrong :)

Monday, June 16, 2014

Changing proxy configuration automatically

For our automation scripts we are testing various type of applications. Some of these applications needs proxy configuration to access the application page while for some of them proxy mustn't be configured.
To solve this we use a function named "initAutomation" that takes application name as a parameter. This function is being called at the beginning of the test script and checks the application name and then decides to configure proxy settings before the execution.

Following piece of code accomplishes this functionality.

Disabling Smart Identification


Sometimes the "Smart Identification" functionality may become a pain for the automation scripts especially if you have dozens of test scripts. I prefer not to use this functionality because of slow identification and sometimes QTP mis-identifies the objects. For me it is better to get an "Object not found" error instead of waiting for the smart identification to find correctly desired object.

Thursday, June 20, 2013

Exporting QC Projects bigger than 4GB

Exporting projects those are bigger than 4GB from siteadmin is a known limitation of QC 11.00. Fixing this limitation is being traced under enhancement request: QCCR1J17611. Until HP publishes a fix for this limitation you can use following steps for exporting big QC projects. I've described here how to restore these backups.

Tuesday, June 4, 2013

Getting defect time report for status change actions

In the analysis module of the QC there are bunch of report types that you can measure what is going on about the defects for your project. But some reports are missing. I'll describe one of the most important one.
If you want to see how much time spent for fixing a defect you have to check it's history section from the GUI. There is no way - at least i couldn't find - for taking this information from the predefined reports for all (or a group of) defects. Here is the SQL for how many hours passed for changing a defect's status (Closed and Rejected&Closed statuses are assumed to be final statuses for a defect). You can use these SQLs in the Analysis section by creating Excel Report or you may want to use them directly as a SQL statement via TOAD or you can embed them in an excel sheet.

Wednesday, January 30, 2013

QTP Integration with Oracle DB

You can connect to Oracle database and execute SQL statements by following steps:

  • Oracle client has to be installed on QTP (or UFT) host.
  • Assuming the tnsnames.ora file contains the desired database information.
Using following two functions can help you to execute SQL queries.


Function executeQuery(p_db, p_sql)
 Reporter.ReportEvent micPass, "executeQuery", "The SQL query: '" &p_sql & "' is going to be executed on: '" & p_db & "'."
 If getVal(p_db)="N/A" Then
  Reporter.ReportEvent micFail,"executeQuery","DB connection information is not available."
  executeQuery = -1
  ExitAction
 End If
 
 Set localConn = CreateObject("ADODB.Connection")
 Set localRs = CreateObject("ADODB.Recordset")
 Set localErr = CreateObject("ADODB.Error")

 On Error Resume Next
 localConn.open getVal(p_db)
 
 Global_DBErr = ""
 For Each localErr In localConn.Errors
  if Err.Number<>0 then
   Global_DBErr = Global_DBErr & Err.Number & vbCr &  " " & Err.Description
   Reporter.ReportEvent micFail,"Step 1","DB connection failed: " & Global_DBErr
   ExitAction
  end if
 Next
 
 On Error Resume Next
 localRs.open p_sql, localConn
 
 For Each Local_Err In localConn.Errors
  if Err.Number<>0 then
   Global_DBErr = Global_DBErr & Err.Number & vbCr &  " " & Err.Description
   Reporter.ReportEvent micFail,"Step 1","SQL Execution Failed: " & Global_DBErr
   ExitAction
  End if
 Next
 
 if localRs.eof then
  v_retVal = -1
 else  
  v_retVal = localRs(0).value
 end if

 set localConn = Nothing
 set localRs = Nothing
 set localErr = Nothing

 Reporter.ReportEvent micPass, "executeQuery", "Query result: [" & v_retVal & "]"
 executeQuery = v_retVal
End Function


Function getVal(p_key)
 v_retVal = "N/A"
 Select Case p_key
  Case "DB1" v_retVal = "Provider=MSDAORA.1;Password=DB_PASWORD1;User ID=LOGIN_USER1;Data Source=DB1;Persist Security Info=True"
  Case "DB2" v_retVal = "Provider=MSDAORA.1;Password=DB_PASWORD2;User ID=LOGIN_USER2;Data Source=DB2;Persist Security Info=True"
 End Select
 getVal = v_retVal
End Function

How you make use of these functions is as following:

 v_sysdateFromDB = executeQuery(Parameter("p_db"), "select sysdate from dual")

Wednesday, January 23, 2013

How to restore a QC project that is bigger than 4GB

HP officially does not support importing qcp files for the projects whose size is bigger than 4GB and at the same time size of the qcp file must be smaller than 2GB. You probably going to get "Server disconnected while performing ImportProject action" error message while importing the project from siteadmin panel.
Detailed information can be found in this document (KM1025768).

Tuesday, January 22, 2013

How to make scheduled backup of a QC project

The Quality Center's site admin supports backing up and restoring the projects as following the below screenshot procedure.

Tuesday, November 13, 2012

A Workaround Solution For QC Reporting According To User Groups

Sometimes QC's group functionality for the users may not sufficient for reporting. For example you may want to report some user actions accoriding to their team/department/divison.

Monday, November 12, 2012

How to get testcase path from QC DB

Sometimes you may need to report testcases those are in a specific folder with some custom format. This can be done from the analysis view of the dashboard easily. But sometimes getting the testcases from the DB with some SQLs may be the way you might prefer.

Friday, September 21, 2012

Is Ajax TruClient a lifesaver?

Most of the time I prefer HTTP/HTML scripting protocol. Because it offers you to know all the details about requests and responses during replay and the actual load test.

Monday, July 23, 2012

VUGEN - QC Connectivity

As you know manual test cases are stored in the Quality Center (QC) application. There is no restriction about the Loadrunner script files.

Sunday, July 22, 2012

Introduction to Loadrunner (for beginners)

Loadrunner (mostly known as LR) is a kind of software that helps you test your applications from the perspective of performance, stress and load.