Summary This Excel Report example demonstrates the use of Dashboard Excel Report Feature to create a lists of tests for a project. This example assumes you are a Project Administrator with programming skills, proficient in vbscript and Quality Center objects and methods. **NOTE** It is necessary to read and follow the Disclaimer section at the end of this document. Implementation STEP 1 SQL Query Tab 1) Navigate to Dashboard / Analysis View 2) Create a new Excel Report 3) Navigate to the Query tab. 4) Copy the following SQL to the Query area. SELECT TEST.TS_TEST_ID /*Test.Test ID*/,TEST.TS_PATH as "Subject" /*Test.Test Path*/,TEST.TS_NAME as "Test Name"/*Test.Test Name*/,TEST.TS_TYPE as "Test Type" /*Test.Type*/,DESSTEPS.DS_STEP_NAME as "Step"/*Test Step.Step Name*/,DESSTEPS.DS_DESCRIPTION as "Step Description" /*Test Step.Description*/,dESSTEPS.DS_EXPECTED as "Expected Result" /*Test Step.Expected*/ FROM TEST /*Test*/, DESSTEPS /*Step*/ WHERE TEST.TS_TEST_ID = DESSTEPS.DS_TEST_ID Page 1
STEP 2 Post Processing Tab 1) Click the Post-Processing tab 2) Click the Run post-processing checkbox. 3) Replace any existing code with the following. Modify the LoginToQC subroutine for your own environment. Dim tdc Dim server Dim domain Dim project Dim projusername Dim projpassword Sub LoginToQC 'Modify for your own Environment server = "http://qcserver:8081/qcbin/" domain = "Default" project = "QualityCenter_Demo" projusername = "qcadmin" projpassword = "qcadmin" tdc_login Sub QC_PostProcessing() Dim MainWorksheet As Worksheet ' Make sure your worksheet name matches! Set MainWorksheet = ActiveWorkbook.Worksheets("Query1") Dim DataRange As Range Set DataRange = MainWorksheet.UsedRange ' Now that you have the data in DataRange you can process it. LoginToQC totalrows = MainWorksheet.UsedRange.Rows.Count col = 1 'Test Id is in column 1 For x = 1 to totalrows-1 CelVal = Tests_Path(MainWorksheet.Cells(x+1, col).value) MainWorksheet.Cells(x+1,col+1).Value = CelVal Next x ResizeSheet LogoutOfQC Function tdc_login() Page 2
Set tdc = CreateObject("tdapiole80.tdconnection.1") MsgBox " 0 - Create: " & Err.Description tdc.initconnectionex Server MsgBox " 1 - InitConnectEx: " & Err.Description tdc.login projusername, projpassword MsgBox " 2 - Login: " & Err.Description tdc.connect CStr(domain), CStr(project) MsgBox " 2 - Login: " & Err.Description End Function Sub LogoutOfQC If tdc.connected Then tdc.disconnect If tdc.loggedin Then tdc.logout tdc.releaseconnection Set tdc = Nothing Excel Report - Test Plan Report Function Tests_Path(TESTID) Set com = tdc.command com.commandtext = "Select ts_subject from test where ts_test_id=" & CStr(TESTID) Set RecSet = com.execute subjectid = RecSet.FieldValue("TS_SUBJECT") Set mytmng = tdc.treemanager myspath = mytmng.nodepath(subjectid) Tests_Path = myspath End Function Sub ResizeSheet() 'Bold Titles in First Row Page 3
Rows("1:1").Select Selection.Font.Bold = True 'Stip to ensure Tests are added underneath "Subject" Columns("B:B").Select Selection.Replace What:="Subject\", Replacement:="" 'Size Columns Cells.Select Selection.Columns.AutoFit Range("A1").Select STEP 3 Generation Settings Tab 1) Click the Generation Settings tab 2) Change the Status to Ready STEP 4 Generate the Report Click the Generate Icon to create the report. Keywords Test Plan, QualityCenter, Excel Reports, Dashboard, Analysis, Path, Steps Disclaimer While this example may meet the needs of your organization, the sole responsibility for modification and maintenance of the logic is yours and NOT that of the Support Organization. The decision to use the information contained herein is done at your own risk. The support organization is NOT responsible for any issues encountered as a result of implementing all or any part of the information contained or inferred herein. The intent of the information provided here is for educational purposes only. As such, the topics in this document are only guidelines NOT a comprehensive solution, as your own environment will be different. This example DOES NOT state or in any way imply that the information conveyed herein provides the solution for your environment. The appropriate system technical resources for your enterprise should perform all customization activities. Page 4
Best Practice dictates NO direct changes to be made to any production environment. It is imperative to perform and thoroughly validate ALL modifications in a Test Environment. Use the results and knowledge garnered from the Test Environment experience to create a customized Production Deployment Plan for your own environment. Always ensure you have a current backup before implementing any solution. Page 5