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
manjirimanjiri 

error uploading apex classin a package

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11">Hi,

when I am trying to upload the package, it is giving me following error.

Component Type    Name                    Problem
Apex Class             WebserviceCall    No testMethods found in the selected Apex code for the package

after writing some dummy test method it is giving error as only 0% test coverage, at least 75% test coverage require.
So is it compulsory to write test methods in apex classes?


Thanks..

 

aalbertaalbert
Yes, it is required to have proper test methods and code coverage when deploying Apex Code. In short, you can develop apex code in non-production orgs, but when you deploy apex code, the test methods are required to pass successfully and have proper code coverage (at least 75%).

More information here: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_testing.htm
Also, http://developer.force.com/df_session?id=a0J300000009wdyEAA



manjirimanjiri
Hi Aalbert,

thanks for the reply
hector.asp2hector.asp2

hi guys

i am trying to test Document object but it seem not working can any one help me out ?

 

 

public class DQIFileUpload{
        
    String FileName= '';       
     Document d;
    public DQIFileUpload(ApexPages.StandardController controller)
    {
        d = (Document)controller.getRecord();
        d.folderid = UserInfo.getUserId();
       
    }
     public PageReference save()
     {
       insert d;
       FileName =d.Body.toString();
       delete d;
       return null;
    }
    

    public String  getFileName()
    {
        return FileName;
    }

    
    
    static testMethod void ContactNullTest()
     {
        test.starttest();
        
       
        Document d=new Document();
        String FileName= '';
        ApexPages.StandardController sc = new ApexPages.StandardController(d);
        d= (Document )sc.getRecord();
        d.Name='Upload Doc';
        d.folderid = UserInfo.getUserId();
        insert d;
        FileName=testCase.Body.toString();
        System.debug(FileName);
        delete testCase;
        test.stoptest();
      
       
    }
   }

Arun thakur

hector.asp2@gmail.com

Message Edited by hector.asp2 on 05-29-2009 05:19 AM