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
MDXHikerMDXHiker 

Apex classes to Prod env

I have a few apex classes written in sandbox and now I need to promote them to Production.

How do I do this using the compileAndTest API call as hte help pages suggest ?

Thanks a lot for your help
Ron HessRon Hess
if you can use the Eclipse deploy method it would probably be easier than building the deploy using the api.

MDXHikerMDXHiker
Ron,

Where is teh deploy button in Eclipse? I wrote these classes directly into the Sandbox env

Also it complains that 75% test coverage is needed

Thanks


Message Edited by MDXHiker on 07-23-2008 04:45 PM
MDXHikerMDXHiker
And should the test classes be written in another project and not included in the src project ?
If I include them in the src project how do I run these?

Thanks
Ron HessRon Hess
i think you right click on the src folder to deploy
Ron HessRon Hess
for small projects i often put the test methods in the same file , you run these by right click, then Force.com menu , Run Tests.
there is good detail on testing and deploy in the online docs.
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
MDXHikerMDXHiker
As I have written the appex classes in sandbox directly into the UI, I am now getting issues when I try to do the same thing in Eclipse for prod push

The first is that the one of the method signatures is erroring on compile with method signature incorrect error.
Though this is working fine in Sandbox

The signature of the method implemented is create(String, String, Date, String, Decimal, String) but the IDe complains that there is no method like create(String, String,Date,ID, Decimal, String). The field changed is a custom object lookup field to Opportunity

Could you please let me know how to resolve this

Thanks
MDXHikerMDXHiker
I was able to resolve this in Sandbox and push this to the Salesforce Sandbox. The test coverage was 80% and this runs fine

But now I create the custom object in Prod and created the classes and triggers in Eclipse Prod project. Here right in the IDE it tells me that code coverage is zero -whereas in Sandbox it ran successfully with coverage 80%. Why do I get different behaviors for these instances.

Any help would be great . Thanks
Ron HessRon Hess
you cannot create classes and triggers in prod, so your code is probably not saving to prod, check the problems screen.

you must create in sandbox and run the deploy process to get the classes and triggers into prod.
MDXHikerMDXHiker

I did create test classes in Sandbox Eclipse project and saved to the server ( not deploy). Then in Sandbox UI I ran the unit tests and that gave 80% coverage

However in Eclipse for the Sandbox I get zero code coverage. Why would this occur? Thanks



Message Edited by MDXHiker on 07-24-2008 10:07 AM
MDXHikerMDXHiker
I was finally able to write all the test cases and did push out the code to the server. Now the trigger is in inactive state. How do I make it active? The code coverage is 88%.  Thanks
MDXHikerMDXHiker

The trigger metadata was set to false by default. When I changed it to true, the code coverage now is 64%.

Which brings back to my other question posted - how do I write test cases for a trigger?