0

I have a small set of lightning components and related apex classes that I'm trying to deploy using ant. The first deployment was fine. I had to make a change and updated the apex class that has all the test methods, including creating setup data, and now the any deployment fails each time. It looks like it is executing old test classes. I tried an undeploy, but the tests are all run first and so that fails also. I thought the migration tool would recognize the 100% coverage from my demo / trial org when deploying, but I guess not? Not sure how to get updated apex deployed now or even just delete the problem classes.

Thanks.

3
  • What do you mean by "migration tool"? What is an error message (Verbatim)? Why does it look like it is executing old test classes? What is "undeploy"? Is that a feature of migration tool that you are using? Answers to given questions could help to understand your issue in detail
    – kurunve
    Commented Feb 27, 2019 at 20:53
  • I'm using the Ant migration tool and undeploy is an option - it's actually a destructive deploy, which would be great except that it fails because the local tests fail. It looks like it's executing old test classes because I can see the Systemassert failures and the expected values are not the correct values.
    – Shawn A
    Commented Feb 27, 2019 at 21:05
  • Shawn, can you give us more details? are you deploying against a sandbox? or prod? What does your package.xml and files look like (a snippet, please)? Commented Feb 28, 2019 at 0:17

2 Answers 2

0

Your question is sort of unclear.

Deployment is a two-step process:

  • Deploying the components(replace the existing components with the new changes)
  • Running the unit tests to make sure that the changes do not break any functionality. Tests are executed after the deployment which means that the tests run against the new changes and not on the existing source.

So, if your deployment is failing, it could be either cause of a failure in deploying the components or failures in tests.

If a deployment fails for any of the above reasons, all the new changes are reverted and the source is set back to its old state.

From whatever info that you have provided, my guess is that your deployment could be failing at the first step itself.

Check the Deployment Status (Set up -> Deployment -> Deployment Status) page on your Salesforce org to monitor the deployment and find out the failure reason.

Please share more info if you are still unable to find out the cause.

1
  • I guess I'm not understanding how the test classes work. I have a separate test class - CommonTestSetup.apxc - that contains a test method for each APEX class I'm trying to deploy. When I run in my source org, code coverage is 100%. Here is one of the failures. This is not even the correct assertion in my CommonTestSetup class: System.AssertException: Assertion Failed: Expected: 4, Actual: 0 Stack Trace: Class.CommonTestSetup.testAcctInvoicesList: line 71, column 1 At this point, I've tried the change set approach with a new dev org and same failures.
    – Shawn A
    Commented Feb 28, 2019 at 14:42
0

I was able to resolve this by migrating the updated APEX test class into the target org first, and then I was able to validate and deploy the change set.

For some reason, when I retrieved the package using the ant migration tool, it would not include the updated test class. I ended up creating a new sandbox of the target org, migrating into that new sandbox, creating a change set with the test class, uploading to the target org and then I could validate and deploy everything else.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .