QC OTA Presentation

32
Extending QC with Open Test Architecture (OTA) API Prepared by: Igor Gershovich [email protected] www.connectedtesting.com

Transcript of QC OTA Presentation

Page 1: QC OTA Presentation

Extending QC with Open Test Architecture (OTA) API

Prepared by: Igor Gershovichigershovich@connectedtesting.comwww.connectedtesting.com

Page 2: QC OTA Presentation

What is Quality Center Open Test Architecture (OTA) API?

The Open Test Architecture API is a COM library that enables you to:

integrate external applications with Quality Center

interact with the Quality Center application without having to use the GUI front-end

interact with the QC databases bypassing DBA

Page 3: QC OTA Presentation

QC Architecture

3-tier architecture (Web server, App server, DB server)

Page 4: QC OTA Presentation

OTA API location

The library, OTAClient.dll, is automatically downloaded to your workstation the first time you run Quality Center to the following folder:<installation drive>\Program Files\Common Files\Mercury Interactive\Quality Center

Alternatively, click the Add-ins page link, select Mercury Quality Center Client Side Setup, and click Download Add-in.

Page 5: QC OTA Presentation

How to use OTA API?

There are several ways to use OTA API: Add OTA code within QC Workflow scripts to

extend Workflow capabilities Enhance Quality Center VAPI-XP tests Using the QCUtil object in QuickTest Pro Write a custom test execution program Read information from a QC for use by an

external tool or report generator Integrate any third-party tool with QC

Page 6: QC OTA Presentation

OTA Object model

Page 7: QC OTA Presentation

API functions

The API functions are accessible through COM-compatible programming languages, such as Visual Basic, VBScript, C++, C#, etc.

The API has one entry point - TDConnection object

Page 8: QC OTA Presentation

Implementation examples

Page 9: QC OTA Presentation

1. External program to schedule QC tests execution – RunTestSet.exe

Page 10: QC OTA Presentation

Custom Test Execution program – RunTestSet.exe Quality Center does not have a built-in testset

scheduler to run tests periodically OTA API enables users to run external tool

that can execute any testset on any host As example RunTestSet application (with

VC++ source code) coupled with Microsoft Scheduler can be used to schedule tests

Page 11: QC OTA Presentation

RunTestSet.exe command line syntaxRunTestSet /s:Server /n:Domain /d:Project /u:User /p:Password

/f:TestSetFolder [/t:TestSet] [/h:Host] | [/g:HostGroup]Where:/s: QC server name/n: QC Domain/d: QC Project/u: User name/p: User password/f: TestSet Folder Path /t: [optional] TestSet name/h: [optional] Host name/g: [optional] HostGroup name/m:[optional] QC User name who will receive execution event notification mail/l [optional] run TestSet locallyExample : RunTestSet.exe /s:http://qcserver/qcbin /n:default /d:access /u:admin /f:Root\hello

/t:WRScript /l

Page 12: QC OTA Presentation

Schedule RunTestSet.exe execution

Page 13: QC OTA Presentation

Execution Event Notification Email

Page 14: QC OTA Presentation

2. Custom Reporting tool

Page 15: QC OTA Presentation

Custom Reporting tool

This tool uses HTML and VBScript As an example, we are going to run custom

queries against a Quality Center project The steps:

This tool connects to the project using OTA API Execute custom DB queries Displays results

Page 16: QC OTA Presentation

Project Reporting tool

Page 17: QC OTA Presentation

Reporting tool - Code snippet

Page 18: QC OTA Presentation

OTA API TdConnection.Command object used to run Project DB queries Sub CheckIntegrity Set cmd = TdConnection.Command TestIntegrity "SELECT * FROM BUG WHERE BG_SUBJECT NOT IN (SELECT AL_ITEM_ID FROM ALL_LISTS)", _ "defect(s) without subject (none expected)", 0 TestIntegrity "SELECT * FROM DESSTEPS WHERE DS_TEST_ID NOT IN (SELECT TS_TEST_ID FROM TEST)", _ "design step(s) without test (none expected)", 0 TestIntegrity "SELECT * FROM TESTCYCL WHERE TC_TEST_ID NOT IN (SELECT TS_TEST_ID FROM TEST)", _ "test(s) in test set without test in test plan (none expected)", 0 TestIntegrity "SELECT * FROM TESTCYCL WHERE TC_CYCLE_ID NOT IN (SELECT CY_CYCLE_ID FROM

CYCLE)", _ "test(s) in test set without test set (none expected)", 0 TestIntegrity "SELECT * FROM STEP WHERE ST_RUN_ID NOT IN (SELECT RN_RUN_ID FROM RUN)", _ "step(s) without run (none expected)", 0 TestIntegrity "SELECT * FROM RUN WHERE RN_TEST_ID NOT IN (SELECT TS_TEST_ID FROM TEST)", _ "run(s) without test (none expected)", 0 TestIntegrity "SELECT * FROM RUN WHERE RN_CYCLE_ID NOT IN (SELECT CY_CYCLE_ID FROM CYCLE)", _ "run(s) without test set (none expected)", 0 TestIntegrity "SELECT * FROM REQ_COVER WHERE RC_REQ_ID NOT IN (SELECT RQ_REQ_ID FROM REQ)", _ "requirement coverage without requirement (none expected)", 0 TestIntegrity "SELECT * FROM REQ_COVER WHERE RC_TEST_ID NOT IN (SELECT TS_TEST_ID FROM TEST)",

_ "requirement coverage without test (none expected)", 0 TestIntegrity "SELECT * FROM CYCLE WHERE CY_FOLDER_ID NOT IN (SELECT CF_ITEM_ID FROM

CYCL_FOLD)", _ "test set(s) without test set folder (1 expected)", 1 Set cmd = Nothing End Sub

Page 19: QC OTA Presentation

3. Enhancing QC Project Workflow

Page 20: QC OTA Presentation

Workflow Script Editor

Page 21: QC OTA Presentation

Modified Project_CanLogin function to block users without password

Page 22: QC OTA Presentation

Login error for user without password

Page 23: QC OTA Presentation

4. Using QTP QCUtil object to write to QC User-Defined fields

Page 24: QC OTA Presentation

QTP script uses QCUtil object to write Flight Confirmation Number to QC RN_USER_01 and TC_USER_01 fields

Page 25: QC OTA Presentation

Writing to QC Fields via QTP QCUtil object

TC_USER_01

RN_USER_01

Page 26: QC OTA Presentation

5. VAPI –XP Script with OTA API

Page 27: QC OTA Presentation

Create a new VAPI-XP test

Page 28: QC OTA Presentation

Scripting languages for VAPI-XP script

Page 29: QC OTA Presentation

VAPI-XP script storing Bug data to Excel spreadsheet

Page 30: QC OTA Presentation

Bug data stored in Excel

Page 31: QC OTA Presentation

Resources

HP Mercury Tools Specific weblog by Valery Raulet from Exposit Limited – http://blogs.exposit.co.uk/

QA Forums – www.sqaforums.com HP/Mercury Quality Center Open Test

Architecture API Reference

Page 32: QC OTA Presentation

Igor Gershovich

E-Mail: [email protected] Phone: 720-933-9395 Website: www.connectedtesting.com