0

I have a class that required modifications, therefore the test class changed as well. Pretty simple stuff, new test passes in dev sandbox, changeset promoted from dev to a full copy staging org, test passes there as well. All is apparently good.

However. When I then changeset the class and test from staging to production, it fails. The failure appears to be caused by the old version of the test class being run on the new version of the class to be tested. Running the existing Production org version of the test, predictably, successfully completes.

This seems impossible but as best I can tell that's what's going on.

I tried moving just the test class in the vain hope that somehow it would just go in without complaint. But of course that fails because the test is expecting the new version of the underlying class. The old version only has a single constructor that takes no args, the new test expects the new version of the class that has one constructor that requires one argument.

How am I supposed to move this class if I can't get it to recognize the test it's packaged with as the one to run?

  • 1
    It's hard to help without seeing the error message for the test failure, at least. – Adrian Larson Mar 16 '17 at 16:29
  • The test failure basically boils down to not being able to find the right constructor in the tested class. Not much else to say about it. The "old" class only has a single constructor such as myobject(), the "new" class has only myobject(boolean isSomething). When the changeset is pushed it seems to run the "old" test on the "new" class. – torpy Mar 16 '17 at 16:48
  • You'd be amazed how much more helpful a verbatim error message can be. – Adrian Larson Mar 16 '17 at 16:57
0

Well I'm loathe to answer my own question but I have resolved the situation. Since the problem was down to the changeset not being able to use the right test with the right class I decided to find out how to delete the useless test class.

Thanks to the excellent information from @sfdcfox in the answer here: How to delete a Test Class WITHOUT using eclipse

I was able to delete the bad test class from the production org, then push the changeset with the new class and new test without any trouble.

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.