我在 HP ALM(以前的 Quality Center)中运行了两个查询:
查询一:
SELECT
TEST.TS_NAME
FROM CYCLE
JOIN TESTCYCL ON (TESTCYCL.TC_CYCLE_ID = CYCLE.CY_CYCLE_ID)
JOIN TEST ON TEST.TS_TEST_ID = TESTCYCL.TC_TEST_ID)
WHERE CYCLE.CY_CYCLE_ID = 44451
这将返回 38 行,其中包含我要报告的所有测试名称。
查询 2:
SELECT
STEP.ST_RUN_ID as "RunId" /*Test Step.Run No*/ ,
TEST.TS_NAME as "Test Name",
STEP.ST_STATUS as "Run Status",
STEP.ST_STEP_NAME as "Step Name",
CYCLE.CY_CYCLE as "TestSet",
CYCL_FOLD.CF_ITEM_NAME as "Test Lab Folder Name"
FROM RUN, CYCL_FOLD, CYCLE, STEP, TEST
WHERE RUN.RN_CYCLE_ID = CYCLE.CY_CYCLE_ID
AND CYCLE.CY_FOLDER_ID = CYCL_FOLD.CF_ITEM_ID
AND CYCLE.CY_CYCLE_ID = 44451
AND STEP.ST_RUN_ID = RUN.RN_RUN_ID
AND RUN.RN_TEST_ID = TEST.TS_TEST_ID
AND RUN.RN_RUN_ID in (select MAX(RUN.RN_RUN_ID) FROM RUN
GROUP BY RN_TESTCYCLE_ID)
此查询返回所有测试以及各个步骤及其状态。MAX 语句返回该测试的最新运行。
运行测试时,会在 STEP 表中分配一个 RUN_ID。问题是如果一个测试没有运行,它不会有 RUN_ID,因此不会包含在结果中。
所以我创建了以下查询 3:
SELECT
STEP.ST_RUN_ID as "RunId" /*Test Step.Run No*/,
TEST.TS_NAME as "Test Name",
STEP.ST_STATUS as "Run Status",
STEP.ST_STEP_NAME as "Step Name",
CYCLE.CY_CYCLE as "TestSet",
CYCL_FOLD.CF_ITEM_NAME as "Test Lab Folder Name"
FROM RUN, CYCL_FOLD, CYCLE, STEP, TEST
RIGHT JOIN (
SELECT
TEST.TS_NAME
FROM CYCLE
JOIN TESTCYCL ON (TESTCYCL.TC_CYCLE_ID = CYCLE.CY_CYCLE_ID)
JOIN TEST ON TEST.TS_TEST_ID = TESTCYCL.TC_TEST_ID)
WHERE CYCLE.CY_CYCLE_ID = 44451) alltest
ON alltest.TS_NAME = TEST.TS_NAME
WHERE RUN.RN_CYCLE_ID = CYCLE.CY_CYCLE_ID
AND CYCLE.CY_FOLDER_ID = CYCL_FOLD.CF_ITEM_ID
AND STEP.ST_RUN_ID = RUN.RN_RUN_ID
AND RUN.RN_TEST_ID = TEST.TS_TEST_ID
AND RUN.RN_RUN_ID in (select MAX(RUN.RN_RUN_ID) FROM RUN GROUP BY rn_testcycl_id)
我想对所有测试进行 RIGHT JOIN 并填充记录了运行但它仍然没有返回 NULL 行的行。运行查询 2 或 3 之间没有区别。