2

I went to make a change to a trigger today but when I went to deploy it the tests failed and said we had 0% coverage when I know the last time we deployed we had something like 80% coverage.

I refreshed all of the code from the server into Eclipse again (rolled back my changes) and tried running the tests again.

They all failed.

I went to the Salesforce.com and logged in... went to setup > apex classes and ran all tests from there and it says we have 89% code coverage.

Why won't Eclipse run the tests correctly? And more importantly how do I get it to work?

  • Usually it's the web version that blatantly lies (especially about which lines are covered and which aren't). Clear test history & code coverage stats in web and rerun all tests? If Eclipse fails maybe your save to server failed? Does your package.xml contain all classes & triggers (<members>*</members>)? Was it a deployment to production or still everything within same sandbox? – eyescream May 29 '13 at 21:05
  • This is a production deployment. The thing is it's the exact same code that was deployed maybe a month ago -- no changes have been made -- and I know the code coverage certainly wasn't 0% - I mean there are all kinds of tests. It's something with either the IDE or a change SF has made on the server side. Just trying to find out what. – codethrift May 29 '13 at 21:40
  • What's the error you get when they fail? – PepeFloyd May 29 '13 at 21:44
  • Error "Method Name Not Available" – codethrift May 29 '13 at 22:42
  • 1
    That means your code does not compile, it fails on initial validation even before the tests are run. One invalid class can block whole deployment. Did you remove (delete, rename change visibility from public to private etc) any methods? Or maybe your trigger is now referencing a new method and you have to deploy the trigger AND new (version) of some class? Anyway -looks like a dependencies problem, not a testing engine fail. – eyescream May 30 '13 at 6:27
2

I've had issues with Eclipse seeming to lose connection with SF. I've made a small change to a couple of classes and gone to deploy to production and it tells me I have 400 new deployment candidates. Refreshing from server doesn't change or fix the problem. What does seem to fix it is going to add/remove metadata components in the force.com context menu, reselecting the components and then refreshing from the server. Perhaps if you run tests again after that they may work.

0

Turns out some data in our org changed -- which some of the tests depended on. This made the tests fail.

Unfortunately the warnings in the test runner gave no idea that was the case.

The number of failures in the test runner was nearly 30 while the number of changes I had to make were 3. Once those 3 minor changes were made I was able to continue working.

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.