Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Friends, in spring 13 release, Salesforce has removed the test class which shows what are all the classes covered for a test class, if we run that particular test class alone and now everything goes to Apex Test Execution which doesnt show detailed information. any ideas how to find that. Now, even if I look at my code at a later date, I won't know which test class is for covering which apex class/code. Any ideas friends??!!

share|improve this question
add comment

1 Answer 1

If you go to the Code Coverage page for a class you can use the drop down at the top of the page to see what coverage each test class gives to the class in question.

Either click on the percentage in the Code Coverage column on the Apex Classes page or directly create the URL:

https://server.salesforce.com/setup/build/viewCodeCoverage.apexp?id=classIdStartingWith01p
E.g. https://cs13.salesforce.com/setup/build/viewCodeCoverage.apexp?id=01p50000000LfkN

Alternative 1 - Run the tests outside of the Salesforce web interface

Alternatively, if you run the tests outside of the Web interface via the apex SOAP API you still be the classes covered report. See tweet from Rich Unger -

"SOAP API runTests, deploy, packaging, and change set test behavior not changed." - https://twitter.com/rich_unger/status/268772507371307009

So, if you run the tests from Eclipse you will still see the classes covered under the Code Coverage Results.

Alternative Number 2, the Developer Console.

Go to the Tests Tab in the Force.com developer console and select you test run. There is a Window that shows Class Code Coverage. Double clicking there brings up the line by line code coverage.

Using the Force.com Developer Console to view resulting Class Code Coverage from a test case

Alternative Number 3, attempt URL hacking

This is untested and may not work or may break something. It comes with no warranty. I don't know you and I don't how how you got here.

You could try recreating the URL that runs the tests. E.g.

https://server.salesforce.com/setup/build/runApexTest.apexp?class_id=classIdStartingWith01p&class_name=TestClassName&ns_prefix=namespacePrefix
E.g. https://na2.salesforce.com/setup/build/runApexTest.apexp?class_id=01p40000000Gykh&class_name=Test_SomeClass&ns_prefix=BANG

share|improve this answer
    
Oh from Eclipse I can check the classes is it? will take a look. Thanks @Daniel Ballinger But I would like to know if there is any option within Salesforce to see the same. I understand that I can go to the class list and see the coverage next to it. But if I run a test class, there are possibilities that it might cover some classes which we didnt expect to :) because of some internal dependencies. So it would reduce my time to write another test class for the class which is implicitly covered by my 1st test class itself. thats the reason am asking if there s any option in sf to view the list? –  Sathya Jan 17 '13 at 21:38
    
@Daniel Ballinger How can the user see the dependent classes that got a share of coverage in the new interface ? When I hit run test it takes to the Apex test execution page and shows the test coverage for the main class :(!!! Is there any way to go back to the earlier version !!! –  rao Jan 17 '13 at 22:04
1  
@rao, I think the Force.com Developer Console will show you the class code coverage break down that resulted from the test execution. See the new image in my answer. –  Daniel Ballinger Jan 17 '13 at 22:11
1  
DEVELOPER CONSOLE IS A MONSTER/NIGHTMARE :(!!!! I hate this approach of pushing me to meet the dev console monster to look at line by line coverage :....( (TEARS!!! ALL WAY TO HELL) –  rao Jan 17 '13 at 22:11
1  
@rao, I could use this opportunity to pimp the FuseIT SFDC Explorer. Is uses the API to run the test cases and will show the line by line break down of class code coverage. Eclipse is another valid option. –  Daniel Ballinger Jan 17 '13 at 22:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.