How To Transfer An ApexTestSuite From One Organization To Another?

Deploying ApexTestSuite: If you’re utilizing the same set of test classes, creating test suites manually across your development, testing, and multiple environments can be time-consuming. By creating a test suite, you can now migrate it to multiple environments using the metadata migration tool. “ApexTestSuite” is the metadata name for migrating Apex test suites.

<?xml version="1.0" encoding="UTF-8"?>

<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>       

        <members>TestSuite Name</members>

        <name>ApexTestSuite</name>

    </types>

    <version>38.0</version>

</Package>

The script above serves as a sample package.xml script for migrating Apex test suites. Once you retrieve Apex test suites, the metadata components will be stored with a .testSuite suffix, and these files will be located in the testsuite folder.

If you intend to deploy new test classes along with the test suite, you need to add the new Apex classes to your package.xml.

<?xml version="1.0" encoding="UTF-8"?>

<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>       

        <members>TestSuite Name</members>

        <name>ApexTestSuite</name>

    </types>

                <types>       

        <members>ApexClass Name</members>

        <name>ApexClass</name>

    </types>

    <version>38.0</version>

</Package>