function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jeffdonthemicjeffdonthemic 

How did my Apex deploy to Production WITHOUT unit tests??

On 2/10 I deployed a Visualforce page and Controller to Production using Eclipse. The deployment process validated the code and successfully deployed the page and class. I logged into Produciton and the page was working correctly.

 

I came back in on Monday and realized that I had not written any test cases but that the code had deployed succcessfully! I submitted a case but to this date L3 support cannot tell why this happened?

 

Can anyone explain how my code could be deployed to Production without any test cases (ie 0% coverage)?

 

Thanks

 

Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com

BrianWKBrianWK

Jeff - I've noticed this too. It's actually come in a bit useful on some projects which have been used tested on our sandboxes but haven't had a test class written yet but still needed to get deployed to production.

 

The only classes that I've had my deployment fail due to a lack of test classes are from triggers. I haven't had any of my Visualforce pages or Controllers throw an error on deploy.

mtbclimbermtbclimber

Code coverage is measured across all of your apex classes and triggers. Triggers are the only logical blocks that specifically require >0% coverage because we know they are in use. The same can not be said for classes so there is no class-level coverage requirement in place at this time.

 

When you deploy your code using eclipse the existing tests are run and if the coverage is sufficient your deployment will succeed. I presume you had code deployed already and that the additional (untested) controller code you deployed did not drop your overall coverage below the minimum level.  If you do a global run all tests you should still find yourself above the minimum. If that's not the case please update your case with that information.

 

Thanks,

jeffdonthemicjeffdonthemic

Andrew,

 

Interesting…. I just created a new Apex Class using the Force.com IDE and used the Test Class template. It created a new Class with the following comments, “All Apex classes are required to have at least 75% code coverage in order to be deployed to a production organization.”

 

Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com

mshelmanmshelman

I'm looking at a production instance (enterprise) which has 16 Apex classes and no test coverage at all. When I run all tests it shows 0% test coverage but that doesn't seem to interfere with the operation of any of this Apex code. From the eclipse ide I can modify these classes or create new Apex classes freely just by saving (not deploying).

 

Mike

Sai kalyanSai kalyan

I think total org code is above 75% your moveing code into sandbox to production total org code is above 75% no need of Every class above 75%.That's why code is move your sandbox to production

ddddavoddddavo

It looks like something has changed in this area over the last release or so.

 

I used to be able to do emergency patches of production classes or triggers without rerunning all of the production tests.  Now, it won't let me save to production in Eclipse...and if I deploy, there doesn't appear to be a way to just run MY tests, not all of them.

 

Reason this is a huge issue is that sometimes managed packages fail their tests, which means that you can't deploy ANYTHING into production, even though it's not your fault.

 

There are some Mac text editors that still allow you to do test-less patch deployments...but the Force IDE is now blocking this.

 

Anybody know something I don't?  This is a mucho problemmo

Shivani DesaiShivani Desai
Hi ddddavo,

I am facing the same problem. Did you find any resolution? I am trying to deploy an object to production and it is failing my deployment beacause of a class in a managed package.


Sopon SSopon S
My org, they keep deploying with very poor code coverage. How could this possible?

User-added image