You need to sign in to do that
Don't have an account?
angela mullen-smith 18
build conference app - test code for the Controller
I am getting myself confused here - I have built the App and my hotels are displaying on the Google map which is fab, but I now want to transfer it into Production and I appreciate that I need to test the Controller.
Am I testing that I can create a new record in my custom object?
OR
Am I testing that a new visualforce page is created
Am I testing that I can create a new record in my custom object?
OR
Am I testing that a new visualforce page is created
All Answers
The example in the Visualforce Developer Guide is confusing.
Am I testing that I bring back a list of records or am I testing that I bring back my visualforce page
<apex:page sidebar="false" showheader="false" controller="FacilityRemoter">
<head>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script src="https://maps.googleapis.com/maps/api/js?key= AIzaSyC3GwkxsiGHfc0y5sheupDf7QzKtbFI4jg®ion=AU">
</script>
<script>
var map;
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(-16.45789579, 145.3789838),
zoom: 15
};
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
loadFacilities();
}
function loadFacilities() {
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.FacilityRemoter.findAll}',
function(result, event){
if (event.status) {
for (var i=0; i<result.length; i++) {
var id = result[i].Id;
var name = result[i].Name;
var lat = result[i].Location__Latitude__s;
var lng = result[i].Location__Longitude__s;
addMarker(id, name, lat, lng);
}
} else {
alert(event.message);
}
},
{escape: true}
);
}
function addMarker(id, name, lat, lng) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lng),
map: map,
title: name
});
google.maps.event.addListener(marker, 'click', function(event) {
window.top.location = '/' + id;
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"/>
</body>
</apex:page>
Thank you - that makes it easier to understand. I am in effect testing the Controller Extension rather than the ability to create the Visual force page.
One more question if you don't mind.
When I test it in the Developer Console - I have 100%
It says that I have no Code coverage %