Toad World® Forums

Export Suite

It’s quite easy to export an entire suite via the Code Tester GUI but is this possible via the command line API / Script?

As far as I can tell, the API:

qu_export_import2

only allows you to export by Program Name or Test Name

I have a full regression suite (made up of hundreds of Tests) that I would like to export programatically.

Any help on this would be massively appreciated.

Cheers

Duncs

Hi Duncs,

please try following:

DECLARE
export_xml CLOB;
BEGIN
export_xml :=
QU_SUITE_YP.MAKE_SNAPSHOT (suite universal id);

DBMS_OUTPUT.PUT_LINE (SUBSTR (export_xml, 1, 255));
END;

Best regards,

Ferdinand

Hi Ferdinand

That’s awesome.

Now that I have a single XML file that contains my entire suite, the next question is:

  1. How can I import programatically and not via the GUI?

This is needed so that my CI build can export a suite from 1 database, import into another and run.

Cheers for any further help

Duncan

For CI tasks, please refer to this CI document:
http://www.toadworld.com/products/code-tester/b/weblog/archive/2011/02/13/continuous-integration-part-2.aspx

In this document, there’s an example how to use Oracle files for XML data exchange. You would not rely on a CLOB variable.

Specifically, the import part shows an example:
BEGIN
– Load the export, preparing for import.

qu_xmldom_import.init_xml ( :xml_import);

– Set options for the import.

qu_xmldom_import.set_options (
include_results_in => FALSE,
include_program_source_in => FALSE,
tdg_conflict_handling_in => qu_xmldom_import.tdg_skip,
td_merge_in => FALSE,
harness_guid_for_merge_in => NULL,
skip_new_test_cases_in => NULL);

– Set program and test code owner.

qu_xmldom_import.set_for_mapping (prog_owner_in => ‘SCOTT’,
harn_owner_in => USER);

– Perform the import.

qu_xmldom_import.import_as_xml;
END;
/

Good stuff.

I actually had that working for a single Unit Test and didn’t realise is was the same for the suite.

The final piece of the jigsaw is running the suite programatically (again not via the GUI). I can find some API’s to run an individual test i.e.

BEGIN

qu_test.run_test_for (owner_in => l_program_owner

, NAME_IN => l_program_name

, result_out => l_result

, test_definition_owner_in => l_harness_owner

, code_coverage_goal_in => 75

, test_name_in => l_test_name);

END;

/

But will this work for a suite?

Cheers

Duncan

Sure you can run the suite. There’s an example in the other CI document [:)]

http://www.toadworld.com/products/code-tester/b/weblog/archive/2010/01/13/continuous-integration.aspx

DECLARE
l_result VARCHAR2 (32767);
BEGIN
qu_test.run_suite_by_name (‘My_Test_Suite’, l_result);

DBMS_OUTPUT.put_line (‘l_result = ‘’’ || l_result || ‘’’’);
END;
/

Piece of cake. Or several cakes… You can use also QU_TEST.RUN_SUITE_BY_GUID.

[;)]

Excellent.

All sorted. Many thanks for your help.

Duncan

Glad to hear it helped.

Best regards,

Ferdinand