Toad World® Forums

Changing the package name ...moving the tests to a new package


#1

I have written a package pkg A containing multiple procedures/functions. I have written Code Tester tests for these procedures/functions.

I have now decided that some of these procedures actually should belong in a different package pkg B, so I am going to move them from the pkg A to pkg B.

How can I now move all my code tester tests for those procedures that used to exist in pkg A so that the tests now apply to the procedures that are now in pkg B??

Will the export/import function work for this??

Note: I do not just want to change the name of the package as far as code Tester is concerned since there will still be other procedures in pkg A that have unit test defined that will NOT be moving to the pkg B.


#2

Interesting question. You want to split up the existing test definition into two.

There is nothing built into the Code Tester UI to do this, but it should be pretty easy anyway.

I would do the following:

  1. Do an export and make a copy of that file. That is, make sure you have an unchanged export to serve as backup.

  2. Open one of the export files and search/replace all instances of the old package name, change to new one.

  3. Import that modified export file.

  4. You should now have two test definitions. Open Test Editor for each one and delete the unit tests that do not belong.

Then I think you will have what you need.

Regards, sF


#3

Thanks for the swift response.

I tried your suggestion. However when i tried to import the new qut file which contained all instances of my old package name… replaced with the new package name, i received the following error:

Error when executing Q##PKG_UTILS.qut in section 6: ORA-01400: cannot insert NULL into (“QUEST_CODE_TESTER”.“QU_UNIT_TEST”.“HARNESS_GUID”)
ORA-06512: at “QUEST_CODE_TESTER.QU_UNIT_TEST_CP”, line 177
ORA-06512: at “QUEST_CODE_TESTER.QU_UNIT_TEST_XP”, line 2519
ORA-06512: at “QCT_TESTER_DULU.QCTO#IMPORT_UNITTEST_1”, line 14
ORA-06512: at line 1

Any ideas?


#4

Dagnabit!

OK, if you could, please send to me (steven.feuerstein@quest.com) the original export file and your edited version, and describe the search/replace you did.

I realize now that there certainly will be an issue with repeated GUIDs (pkeys), but I am not even sure if that is the cause of your error.

Sorry it didn’t work out that easily, but we will get it figured out.

Also, what version are you using?

Regards, SF


#5

Duncan, I just saw the Quest Support ticket and as I suspected - you hit the unique key error.

First of all, here’s how you can remove the unwanted test definition (for everyone else’s info: the import was done with a wrongly-cased program name, so now there is a “ghost” test definition in the repository):

declare
l_rows pls_integer;
begin
qu_harness_xp.del (universal_id_in => ‘GUID’, rows_out => l_rows);
commit;
end;

where you put your primary key value (UNIVERSAL_ID column) in place of GUID.

Then send me those files and we will continue to work on this issue.

Regards, SF


#6

Hi, everybody…
Is there an anser to the question?
i get the same error message and i don´t want to recreate the tests…

is there help?

Andreas Luczak


#7

Andreas,

You get the same unique index error when you try to split up your package or are you trying to do something else?

The best thing to do is open a ticket with Quest Support and submit a support bundle so that we can make sure we addressing the correct issue.

Can you do that?

Regards, SF