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
AbAb 

test coverage 0% always

Hello,

I have a simple class and i have writen a test class for it.
Test coverage alwayw shows 0 %,
I dont understand where i am ggoing wrong
public with sharing class test{
    public String temp{get;set;}
   
     public test(){
             temp = ' ';
      }
}

@isTest(seeAllData=true)
public class testtest{
    static testMethod void tesTttest () {
        test t= new test ();
        t.temp = '';
    }
}

 
Best Answer chosen by Ab
Dinesh Suggala 8Dinesh Suggala 8
Rename your Class "test" with Something else like "Sample"
Class
public with sharing class Sample{
    public String temp{get;set;}
   
     public Sample(){
             temp = ' ';
      }
}

Test Class
@isTest(seeAllData=true)
public class testtest{
    static testMethod void tesTttest () {
        Sample t= new Sample();
        t.temp = '';
    }
}
Now run your test class it will cover 100%.
You Cannot name any Class with "Test" in salesforce because TestClass will not able to recognise .