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
Compass 1Compass 1 

Apex Class Testing

I am not able to run the test for my created Apex Classes.
The class name is not apearing on Apex Class Excution screen.

Code Coverage: 0%Your overall code coverage is currently 0%. To deploy code to production, you must have at least 75%.

Due to this I am not able to deploy my class on production. Please advise
 
KaranrajKaranraj
The test must contain unite test data to cover the your apex class logic, else your code won't get convered. Take look into the apex test class module in Triailhead, which helps you to understand how test class works in salesforce and how to write a proper test class. https://developer.salesforce.com/trailhead/force_com_programmatic_beginner/apex_testing/apex_testing_intro
Compass 1Compass 1
Please advise how to run the test for below class. For reference find below the code I have written,

public class topprospectsqry{

    public Opportunity[] getOpportunityList() {
    Opportunity[] opps = [SELECT
    name,
    account.name,
    Facility__c,
    Scope_Of_Work__c,
    Pricing_Type__c,
    Revenue__c,
    Contract_Award_Date__c,
    FROM
    Opportunity
    where
    Top_Prospect__c='Yes'
    order by Revenue__c desc
    LIMIT 20
    ];
    return opps;
    }
     
    public pageReference generateReport() {
    return Page.Thirdpage;
    }
    
}