Toad World® Forums

Merging Test Definitions in 1.8.2


#1

Hi,

Having helped introduce Quest Code Tester to the development team I’m currently working in a couple of months ago, we’ve been steadily writing tests for recent code changes. Two of the developers have been writing tests for the same program package, but on different schemas (how we operate in our coding environment). We’ve now merged the code and would like to do the same with the QCT tests that have been written.

Both developers have exported their tests and both tests, when imported individually, work fine. The problems comes when we attempt to merge the test definitions.

Having followed the QCT Help documents, I’ve added the qu_harness_xp command, from the “How Do I… Merge Test Definitions” page, to the exported .qut file (“on the second line below the REM statement”), but then QCT says the export file is invalid (or corrupt) and won’t let me do an import.

I’ve tried moving the comman to the bottom of all the REM statements (there are statements for the QCT version, program schema, test owner schema, etc), but then I get an import error along the lines of “symbol ‘/’ encountered when expecting one of the following:” (i.e. the file no longer contains valid SQL commands).

I thought this might be because the command from help was:

begin
qu_harness_xp…;
end;
/

so I removed the trailing “/”, but then I just get another error when the import attempts the run the CREATE OR REPLACE statement of the line below (creating the import harness package).

Any help you can give would be much appreciated (either I’m attempting to paste the command into the wrong part of the .qut file, the help document’s out of date for 1.8.2 or there’s a bug in the import mechanism)?


#2

Sigh. My apologies. I need to fix the doc. You should add the command as follows to the top of the export file (after the header, in bold):

REM QCTO EXPORT HEADER
REM VERSION = 1.8.2.374
REM HARNESS_GUID = {98392B8D-C359-4082-807C-471BEA8186F1}
REM HARNESS_OWNER = %
REM HARNESS_NAME = Q##DUMMY_PROC
REM HARNESS_TYPE = PACKAGE
REM PROGRAM_OWNER = %
REM PROGRAM_NAME = DUMMY_PROC
REM PROGRAM_TYPE = PROCEDURE
REM Export created on 2009-02-20 12:27:51

BEGIN
qu_harness_xp.set_merge_on_import (
perform_merge_in => TRUE
, skip_on_same_tc_name_in => FALSE);
END;
/
REM EXECUTE

CREATE OR REPLACE PROCEDURE qcto#import_HARNESS_1

The doc will be fixed in 1.8.3.


#3

Steve,

Thanks for the reply but I’m still having problems.

To give a better picture of my database layout:

SCHEMA_A is the my schema, with which I connect Quest Code Tester to the database

SCHEMA_B is the schema containing the program to be tested (say DUMMY_PACKAGE)

SCHEMA_C is the schema in which I’ve already got a test definition (it’s in here because SCHEMA_C has the permissions to run the tests correctly, whereas locating the test definition in A or B would give errors)

QUESTCODETESTER is the (central) QCT repository schema

I’ve written a set of Unit Tests in the Test Definition Q##DUMMY_PACKAGE, built into SCHEMA_C (with DEFINER auth). A second devleoper, on a different database, has also written Unit Tests for DUMMY_PACKAGE in a similar schema setup. The other developer has now given me an export of thei Test Definition and I’m attempting to import (merge) that into the pre-existing SCHEMA_C Test Definition.

  1. When I attempt to merge (having changed the .qut file received from the other developer to include the merge code you give above) to place the Test Definition in SCHEMA_C (with the program in SCHEMA_B), I get the following error:

"A test definition in SCHEMA_C already exists for the program SCHEMA_B.DUMMY_PACKAGE (Q##DUMMY_PACKAGE). Only one test definition per program is supported in a single schema.

To import a different test definition in this schema for the same program, any existing test definition must first be deleted."

I specify the Test Owner and Test Program packages using the GUI in QCT (using the drop down selection boxes on the import screen).

  1. If I only specify the Test Program schema (SCHEMA_B) and set the Test Owner to be either “the schema specified in the export [DEFAULT]” or “the schema which contains the import” options, I get the following error:

“Error when executing Q#DUMMY_PACKAGE.qut in section 5: ORA-01400: cannot insert NULL into (QUESTCODETESTER.qu_unit_test.harness_guid)
ORA-06512: at QUESTCODETESTER.qu_unit_test_cp, line 323
ORA-06512: at QUESTCODETESTER.qu_unit_test_xp, line 2519
ORA-06512: at SCHEMA_A.qcto#import_unittest_1, line 14
ORA-06512: at line 1”

Setting the Test Owner to either of these options seems, in the GUI screen at least, to set the Test Owner to the use by which QCT is currently connected to the database (SCHEMA_A in this instance).

Hope this (at least kind of) makes sense.


#4

Thanks for this detailed explanation. I will see if I can reproduce this, and hope to have it fixed in 1.8.3, which we freeze soon. If you would like to be notified of the fix, please log a bug at support.quest.com.

SF


#5

Chris,

I need some clarification: when you run Code Tester, you always connect to schema_a? And you store all of your test definitions in schema_c, but run them from schema_a?

Thanks,
SF

PS - please contact me directly via email (steven.feuerstein@quest.com) or provide me with your email address. The forum is not the best place for detailed back and forths.

Regards, SF