Last active
August 29, 2015 14:06
-
-
Save karanrajs/31b68bb93659f99c35d5 to your computer and use it in GitHub Desktop.
Getting over all code coverage using Tooling API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page showHeader="true" sidebar="true" docType="html-5.0" standardStylesheets="false"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$.ajax('/services/data/v30.0/tooling/query/?q=SELECT PercentCovered FROM ApexOrgWideCoverage', | |
{ | |
beforeSend: function(xhr) { | |
xhr.setRequestHeader('Authorization', 'Bearer {!$Api.Session_ID}'); | |
}, | |
success: function(response) { | |
var overall; | |
$.each(response.records, function(index, record) { | |
$('#percen').append(record.PercentCovered); | |
}); | |
}, | |
error: function(jqXHR, textStatus, errorThrown) { | |
alert(jqXHR.status + ': ' + errorThrown); | |
} | |
} | |
); | |
}); | |
</script> | |
<p id="percen">Over all code coverage: </p> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment