You need to sign in to do that
Don't have an account?

Test class
Hi Friends,
If iam trying to write a test code for Apex class it will not save because of the class name already exists..
Example:
public class myclass
{
account a;
public account getAcc()
{
a=[select id,name from account where id=:apexpages.currentpage().getparameters().get('id')];
return a;
}
public PageReference del()
{
delete a;
return null;
}
public PageReference save()
{
return null;
}
How can i write a test code for the above Apex class....?
Regards,
Srikanth
--yvk
Hi Bro,
The Apex class name and test class name are different. But how the test code matches to apex code. and test code coverage is greater than 75% but Apex code coverage is 0%...
how to match that test code to Apex code?
Regards,
Srikanth.
I guess you didnt know whats a test class is for , read before you do any thing .
http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
-- yvk
Bro,
I know about test classes but iam having a small doubts on Apex test code..and i know how to write a test code for triggers, Apex class.
My doubt is we are writing a test code for Apex class if i mention a same class name in test class it shows an error like the class name already exists.. If we are using with different class name the test code is successful and when i run the code the test code is 100% but the Apex code is 0%.
Regards,
Srikanth

I dont know what you are referring to ' test code is 100%' .
Test controller do not have any coverage, as all the controllers code will be excluded from the organisation code limit.
After you run the test method, the original class will get displayed in the list of controllers with its code coverage with a link, if you click on the it will display the original controller in an floating window with all the code covered in blue uncovered in red.
--yvk