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.