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
PSahuPSahu 

How to increse code coverage of test class my test class code coverage is only 5%

I am working on an application in salesforce for this i have write 3 classes and it's 3 test class but when i was go to make its package it's give me error of code coverage of 5% atleast 75 % required after that  i was checkmy test class but i am unable understand the issue. below is one of my class with its test class and it's code coverage is 0 Please check it


public class Woeid_JSON2Woeid_Apex {     
public class Place {         
public String woeid;     
}     
public class Query {        
 public Integer count;         
public String created;         
public String lang;         
public Results results;     
}     
public Query query;     
public class Results {         
public Place place;     
}          
public static Woeid_JSON2Woeid_Apex parse(String json) {         return (Woeid_JSON2Woeid_Apex) System.JSON.deserialize(json, Woeid_JSON2Woeid_Apex.class);    
 }    
}
and it's test class

@isTest
private class Woeid_JSON2Woeid_ApexTest {
public static Woeid_JSON2Woeid_Apex parse(String json) {
        return (Woeid_JSON2Woeid_Apex) System.JSON.deserialize(json, Woeid_JSON2Woeid_Apex.class);
    }
   static testMethod void testParse() {
        String json = '{\"query\":{\"count\":1,\"created\":\"2015-08-05T10:25:32Z\",\"lang\":\"en-US\",\"results\":{\"place\":{\"woeid\":\"2390809\"}}}}';
        Woeid_JSON2Woeid_Apex obj = parse(json);
        //System.assert(obj != null);
    }   

}

Please reply me.
Rahul SharmaRahul Sharma
Try adding some asserts in your test classes, they would fail and you can rectify the problem after looking at the messages.
PSahuPSahu
after using System.assert(obj != null); the problem is same code coverage is zero :(