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
hmoh1920hmoh1920 

class test error

Hi,

 

 

I get an error "  testcode: Type is not visible: test    " when I deploys my sand box to the production.

 

 

"testcode" is the name of my  test class.

 

I renamed my class test with "test" but I got an error at this level "Test.startTest();" in thecode of my  test  class. this error is " Methode does not exist or incorrect signature: Test.startTest()".

 

please help me.

 

thanks.

 

 

 

moh.

Best Answer chosen by Admin (Salesforce Developers) 
AmitSahuAmitSahu

You can delete the test class in Production and then push a fresh copy with the name changed to the production org.

All Answers

AmitSahuAmitSahu

can you post the test code ??

hmoh1920hmoh1920

this is my test class:

 

/******************************************************/

 

@isTest
private class testcode {

        
/***************************************************************************************************************************/    
public static testmethod void t1()
{
//trigger comFraisCatalogue    
commission_et_frais_par_catalogue__c comFraisCat = new commission_et_frais_par_catalogue__c
(Code_catalogue__c='test');

         insert comFraisCat;    
    
}

/****************************************************************************************************************************/
//test unitaire du trigger calculTaxeProdOpp
public static testmethod void t2()
{
String OppoId;
String pricebookId;
OpportunityLineItem OppLineItem = [select OpportunityId, Quantity from OpportunityLineItem limit 1];
OppLineItem.Quantity = 4;

Opportunity opp = [select id  from Opportunity limit 1];
OppoId =opp.id;

PricebookEntry pricebook = [Select Id From PricebookEntry limit 1];
pricebookId=pricebook.id;
 

 try{
          update OppLineItem; // hit the trigger
          OpportunityLineItem oppItem = new OpportunityLineItem
          (UnitPrice=1, Taxe__c=1, Quantity=1,  OpportunityId=OppoId );
          
 }catch(DMLException e){
  system.assert(true,'Caught DML Exception Updating Opportunity:'+e.getDMLMessage(0));
 }

}

 

//test batch
public static testmethod void t62()
{
    
  Test.startTest();
  BalanceCalculBatch ch = new BalanceCalculBatch();
  ID batchprocessid = Database.executeBatch(ch);
  Test.stopTest();
           
}

 

 

}

 

 

/*****************************************************/

hmoh1920hmoh1920

another precision:

 

 

my class test is named  in my production "test" but  in my sandbox "testcode".

 

how to rename the test class in my production, because I can not name it in the sandbox because of test method.

 

 

Thanks.

AmitSahuAmitSahu

You can delete the test class in Production and then push a fresh copy with the name changed to the production org.

This was selected as the best answer