4

When you deploy an inbound change set with apex classes and their respective test classes in the change set, does the validation run tests that are in the change set or those already in the org?

So let’s say for example I am deploying from sandbox v1 to production. Production already has an apex class "class-v1" which has a method say cover() and it's associated test class "test-v2". In sandbox v1, I have an apex class "class-v2" and its associated test class "test-v2". I add "class-v2" and "test-v2" to a change set and upload the change set to production. In production I click validate on the uploaded change set. When the validation runs, does the org look in the change set for "test-v2" or does it run the test that against "test-v1" or a merged version?

1
  • The test class that you are deploying will be run on validation, otherwise we can never increase test coverage without creating new test class.
    – javanoob
    Apr 14 at 21:34
4

It will run the tests on whatever you are trying to deploy/validate. So in your case, it will validate class-v2 and run tests for your test-v2 class.

3
  • I don’t think this fully answers what is asked in the question..
    – javanoob
    Apr 14 at 21:30
  • Can you elaborate on what I missed? Happy to expand on my answer. Apr 15 at 21:36
  • OP was asking if there is a test class in the org and we are deploying the same test class with changes, which one runs on the deploy? The one already existing in the org or the one we are deploying. Atleast thats what I understood from reading of the question.
    – javanoob
    Apr 15 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.