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
vanessa veronvanessa veron 

Problem upload package

I have a problem to upload  a package:

Upload Failed
No test methods found in the Apex code included in the package. At least 75% test coverage is required.

Help me please
Have you included test classes for the classes in your package? Also, please ensure that the test classes are annotated as @istest and that after running all test classes, you receive a code coverage of atleast 75 percent.
vanessa veronvanessa veron
Not included test class.
How do I do this?
My code has just normal classes.
You should write test classes to cover your normal class code, else you will not be able to deploy the code outside your development environment. Please see this:
vanessa veronvanessa veron
give me an exemple - MY CLASS:

global class AAAA implements System.Schedulable {
global String str{get;set;}
global String mail{get;set;}
global String nomJob{get;set;}
global String inputText{get;set;}
global String heure{get;set;}
global String minute{get;set;}
global String jourMois{get;set;}
global String mois{get;set;}
global String jourSemaine{get;set;}

global void execute(SchedulableContext sc) {

global AAAA () {


global AAAA (String mail, String inputText, String heure, String minute, String jourMois, String mois, String jourSemaine) {
this.mail= mail;
this.inputText = inputText;
this.heure= heure;
this.minute= minute;
this.jourMois= jourMois;
this.mois= mois;
this.jourSemaine= jourSemaine;

public void setMail(String mail) {
    this.mail= mail;

public String getMail() {
    return mail;

public void setRequete(String inputText) {
    this.inputText= inputText;

public String getRequete() {
    return inputText;

public void setHeure(String heure) {
    this.heure= heure;

public String getHeure() {
    return heure;

public void setMinute(String minute) {
    this.minute= minute;

public String getMinute() {
    return minute;

public void setJourMois(String jourMois) {
    this.jourMois= jourMois;

public String getJourMois() {
    return jourMois;

public void setMois(String mois) {
    this.mois= mois;

public String getMois() {
    return mois;

public void setJourSemaine(String jourSemaine) {
    this.jourSemaine= jourSemaine;

public String getJourSemaine() {
    return jourSemaine;

public void schedulejob(){
        String aaa = getMail();
        String req = getRequete();
        String heu = getHeure();
        String min = getMinute();
        String jMois = getJourMois();
        String leMois = getMois();
        String jSemaine = getJourSemaine();
        String NomJobSchedulable = nomJob;
        AAAA p = new AAAA (aaa, req, heu, min, jMois, leMois,jSemaine);
        String sch = '0'+' '+min+' '+heu+' '+jMois+' '+leMois+' '+jSemaine;
        system.schedule(NomJobSchedulable , sch, p);   

public void newPublier(){

    String query=inputText;
    String premier=query.substringAfter('select ');   
    premier=  premier.substringBefore('from');
    string titre= premier+'\n';
    string contenuCSV = titre;

    string queryResultatString = '';

    list<sObject> queryResultat = (List<sObject>)database.query(inputText);
    for(sObject a: queryResultat)

        queryResultatString = queryResultatString + string.valueof(a);
    System.debug('Query result string:'+queryResultatString);

    list<string> queryLignes = queryResultatString.split('}');

    for(string s:queryLignes){
        list<string> queryColonnes = s.split(',');
        for(string st:queryColonnes){
            contenuCSV = contenuCSV + st.substringAfter('=') + ',';

        contenuCSV = contenuCSV.substringBeforeLast(',').substringBeforeLast(',') + '\n';

    String lignes = contenuCSV;
    List<String> parts = lignes.split('\n');
    integer lineNumber = queryResultat.size();

    integer nbLignesPJ = 1000;
    integer compterParties=0;

    for(integer i=0;i<lineNumber;i++){

      string fichierParties = parts[0] + '\n';

      if(math.mod(i,nbLignesPJ)<>0) continue;

        for(integer j=1;j<=(lineNumber-i);j++){
            fichierParties = fichierParties + parts[i+j] + '\n';
         for(integer j=1;j<=nbLignesPJ;j++){
            fichierParties = fichierParties + parts[i+j] + '\n';
      //Envoyer le Mail
      Messaging.EmailFileAttachment csvPJ = new Messaging.EmailFileAttachment();
      blob csvBlob = Blob.valueOf(fichierParties);
      string csvNom = 'cases_fermes_''.csv';
      Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
      String[] adressMail = new list<string> {mail};
      String subject;
          subject = 'CSV - ';
      email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvPJ});
      Messaging.SendEmailResult [] envoyer = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});