Test Suites in salesforce? What is a test suite and how to create test suite in salesforce?

In this blog post, I will try my best to explain about Test suite and how you can create a test suite ? and also we will see how to deploy Test suite from one Salesforce org to other salesforce org.

What is test suites in salesforce?

Test suite is a collection of apex test classes which you can run together. For instance,  create a suite of tests that you run every time you prepare for a deployment or everytime Salesforce releases a new version. .You can set up a test suite in the Developer console where you can specify which set of test classes you want to execute regularly.

How to create test suites?

Step 1: Go to your developer console. Select “Test” tab ->click on New Suite from the dropdown.

.

 

Step 2: Provide the name for the test suite and click Ok .

Step 3: Now you can select the list of classes which you want to execute from available test classes and move to the selected test classes section as shown below:

You can use the arrow to move classes from one list to other.

How to run test suites?

To run test suite from the developer console, go to the Tab “test” and click on the New Test Suite run and select the test suite you want to execute and click “Run Suites ” button.

How to deploy Apex test Suite from one Salesforce org to another org?

Are you working on the same set of test classes and you are manually creating test suites individually in your dev, test and other environments? If yes, then you need to read this blog post carefully. If you have created a test suite in one of the salesforce org, you can migrate it to other environments using metadata migration tool. “ApexTestSuite” is the metadata name to migrate apex test suite.

Below is the sample package.xml script to migrate apex test suites.After you have retrieved apex test suites, metadata components will be stored with .testSuite suffix and files will be stored in the test suite folder.

[sourcecode language=”xml”]

<?xml version ="1.0" encoding= "UTF-8" ?>
<package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>TestSute Name </members>
<name> ApexTestSuite</name>

</types>
<version>38.0 </version>
</package>
[/sourcecode]

If you are deploying additional test classes along with the test suite, then you have to add new apex class to your package.xml.For example, as shown below:

[sourcecode language=”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>

[/sourcecode]

This Post Has 10 Comments

  1. Cara Seary

    Hiya, have you possibly pondered to publish concerning Nintendo DSi?

  2. Gemma Dena

    An impressive share, I recently given this onto a colleague who was simply carrying out a little analysis within this. Anf the husband actually bought me breakfast due to the fact I found it for him.. smile. So well then, i’ll reword that: Thnx for any treat! But yeah Thnkx for spending plenty of time to debate this, I’m strongly about it and really like reading much more about this topic. If possible, as you grow expertise, might you mind updating your blog site to comprehend details? It can be extremely great for me. Large thumb up just for this short article!

  3. Hoyt Mcclave

    What a rubbish. How can you refer to it a new web site. Customize the design, so it is going to be a bit better

  4. Keli Clawson

    Helpful info. Lucky me I found your website accidentally, and I am shocked why this accident didn’t came about in advance! I bookmarked it.

  5. Dannette Tuai

    well, monetizing websites and stuffs should be great. making money on the internet is a great way to earn money“

  6. Damion

    Today, I went to the beach with my children. I found a sea shell and gave
    it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and
    screamed. There was a hermit crab inside and it pinched her ear.

    She never wants to go back! LoL I know this is entirely off topic but
    I had to tell someone!

  7. Lupe Catino

    Cheers, I just stopped by to visit your site and thought I’d say , you have some good info here.

  8. Jospeh Bonow

    Merely wanna input on few general things, The website style is perfect, the written content is really wonderful : D.

  9. vreyrolinomit

    Thank you for sharing excellent informations. Your site is very cool. I’m impressed by the details that you?¦ve on this website. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for more articles. You, my pal, ROCK! I found simply the info I already searched all over the place and simply could not come across. What a great site.

  10. frolep rotrem

    naturally like your website however you need to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling issues and I to find it very bothersome to tell the reality however I will certainly come back again.

Leave a Reply