• SandeepV
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies

Hi  

 

I am trying to deploy my classes and onjects on Production using the Force.com IDE. All my classes and triggers have code coverage more than 75 % , while running tests in force.com IDE , i found that several other test methods are running which are from other classes. There is no relation with my code. It is dropping my Code coverage percentage. How can i prevent the running the tests from other classes or triggers while deploying the code. Refer to the image below - All classes and trigger with Green symbol should only execute the test cases , rest of them should be removed.

 

I am getting error while running Tests 

 

  /**
      * Method that creates the test estimate object
      */
     public static Services_Estimate__c createTestEstimate(){
         Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps'];
        
        Services_Demand_Management__c dm= new Services_Demand_Management__c (Name = 'MyTestEstimate',
                                  Request_Status__c = DemandManagementHelper.STATUS_NEW,
                                  Request_State__c = DemandManagementHelper.STATE_OPEN,
                                  Comments__c = 'My Desc',
                                  ACI_Product1__c = prod.Id,
                                  Request_Type__c = 'Services',
                                  Oracle_Project_Number__c = 'TP00001',
                                  Oracle_Project_Name__c = 'Test Project',                                  
                                  Request_Sub_Type__c = ServicesEstimateHelper.IAE_FULL,
                                  Request_Submitter__c = UserInfo.getUserId());
         insert dm;

         Services_Estimate__c est= new Services_Estimate__c(Name = 'MyTestEstimate',
                                        Estimate_Status__c = DemandManagementHelper.STATUS_NEW,
                                        Request_Description__c = 'My Desc',
                                        Demand_Management_Request__c = dm.Id);
                                        
         
         insert est;
         
         Services_Review_Meeting__c meeting = new Services_Review_Meeting__c(Estimate_In_Review__c = est.Id,
                                        Meeting_Date__c = Date.today(),
                                        Meeting_Description__c = 'Review IA',
                                        Meeting_Goal__c = 'Reach Agreement',
                                        AD_Comments__c = 'Done',
                                        AD_Review_Disposition__c = 'Agree',
                                        Product_Review_Disposition__c = 'Agree',
                                        Sales_Review_Disposition__c = 'Agree',
                                        Services_Review_Disposition__c = 'Agree');
         insert meeting;
         return est;
        
     }
     
     public static testMethod void testReadEstimate(){
         
         Services_Estimate__c est= createTestEstimate();                                   
         
         readEstimates(est.Demand_Management_Request__c);
         readEstimate(est.Id);
         readEstimateItems(est.Id);         
         readReviewMeetings(est.Id);
         readEstimateFunctionalFeatureMappings(est.Id);
      
     }


}

 Message shows that error occurs at Line 252 which is line below , but this query is returning a single result ,I am not sure why this error is appearing. Can some one pls. help me ? 

Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps'];

I am trying to build a report as shown in the snapshot below. 

 

You can see that following filter is applied. I want to set the username  of the user who is running the report here.

 

How can it be achieved  ? 

SUP User Name equals ABCD
   3. ADDL Reporting Level1 equals ABCD
   4. ADDL Reporting Level2 equals ABCD
   5. ADDL Reporting Level3 equals ABCD

 

 

Image link -Report snapshot

I am using Google Visualizations area chart  and a Data table on my Visualforce page. When the page is initially loaded , it has a filter with with all default values selected , at this time , chart shows correctly , when i change the filter value and click on a command button , area chart disappears . but the data table gets refreshed properly.

 

Can some one pls. help me resolving this issue of area chart disappearing on refreshing filter values.

 

Thanks.

 

Sandeep.

Hi 

 

Can some one pls. let me know how to set the all valuses in multiselect Pick list as default. here is the code.

 

Controller 

-------------------------

public class sampleCon {
String[] countries = new String[]{};

public PageReference test() {
return null;
}

public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Americas','Americas'));
options.add(new SelectOption('AP','AP'));
options.add(new SelectOption('EMEA','EMEA'));
return options;
}

public String[] getCountries() {
return countries;
}

public void setCountries(String[] countries) {
this.countries = countries;
}
}

 

Page 

-------------------------------------------------------

 

<apex:page controller="sampleCon">
<apex:form >
<apex:selectList value="{!countries}" multiselect="true"> Channel :
<apex:selectOptions value="{!items}"/>
</apex:selectList><p/>

<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>

<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:outputPanel >
<p>You have selected:</p>
<apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>

 

Thanks for your help in advance.

 

Hi 

 

I am steruggling to plot a Stacked Area chart in Visualforce. Can you pls suggest what is the best way to achieve this.

 

SandeepV

I am getting error while running Tests 

 

  /**
      * Method that creates the test estimate object
      */
     public static Services_Estimate__c createTestEstimate(){
         Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps'];
        
        Services_Demand_Management__c dm= new Services_Demand_Management__c (Name = 'MyTestEstimate',
                                  Request_Status__c = DemandManagementHelper.STATUS_NEW,
                                  Request_State__c = DemandManagementHelper.STATE_OPEN,
                                  Comments__c = 'My Desc',
                                  ACI_Product1__c = prod.Id,
                                  Request_Type__c = 'Services',
                                  Oracle_Project_Number__c = 'TP00001',
                                  Oracle_Project_Name__c = 'Test Project',                                  
                                  Request_Sub_Type__c = ServicesEstimateHelper.IAE_FULL,
                                  Request_Submitter__c = UserInfo.getUserId());
         insert dm;

         Services_Estimate__c est= new Services_Estimate__c(Name = 'MyTestEstimate',
                                        Estimate_Status__c = DemandManagementHelper.STATUS_NEW,
                                        Request_Description__c = 'My Desc',
                                        Demand_Management_Request__c = dm.Id);
                                        
         
         insert est;
         
         Services_Review_Meeting__c meeting = new Services_Review_Meeting__c(Estimate_In_Review__c = est.Id,
                                        Meeting_Date__c = Date.today(),
                                        Meeting_Description__c = 'Review IA',
                                        Meeting_Goal__c = 'Reach Agreement',
                                        AD_Comments__c = 'Done',
                                        AD_Review_Disposition__c = 'Agree',
                                        Product_Review_Disposition__c = 'Agree',
                                        Sales_Review_Disposition__c = 'Agree',
                                        Services_Review_Disposition__c = 'Agree');
         insert meeting;
         return est;
        
     }
     
     public static testMethod void testReadEstimate(){
         
         Services_Estimate__c est= createTestEstimate();                                   
         
         readEstimates(est.Demand_Management_Request__c);
         readEstimate(est.Id);
         readEstimateItems(est.Id);         
         readReviewMeetings(est.Id);
         readEstimateFunctionalFeatureMappings(est.Id);
      
     }


}

 Message shows that error occurs at Line 252 which is line below , but this query is returning a single result ,I am not sure why this error is appearing. Can some one pls. help me ? 

Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps'];

Hi 

 

Can some one pls. let me know how to set the all valuses in multiselect Pick list as default. here is the code.

 

Controller 

-------------------------

public class sampleCon {
String[] countries = new String[]{};

public PageReference test() {
return null;
}

public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Americas','Americas'));
options.add(new SelectOption('AP','AP'));
options.add(new SelectOption('EMEA','EMEA'));
return options;
}

public String[] getCountries() {
return countries;
}

public void setCountries(String[] countries) {
this.countries = countries;
}
}

 

Page 

-------------------------------------------------------

 

<apex:page controller="sampleCon">
<apex:form >
<apex:selectList value="{!countries}" multiselect="true"> Channel :
<apex:selectOptions value="{!items}"/>
</apex:selectList><p/>

<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>

<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:outputPanel >
<p>You have selected:</p>
<apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>

 

Thanks for your help in advance.

 

Hi 

 

I am steruggling to plot a Stacked Area chart in Visualforce. Can you pls suggest what is the best way to achieve this.

 

SandeepV

Hi All,

 

I had a page which was working perfectly rendering 3 pageblock sections and a google chart section.  I modified this code to now show a "now loading" screen while it fetches the elements and this has now broken the google charts portion for some reason.  Charts always shows "no data" now.

 

My guess is because the script tag used to pull this data in from the controller is now run at a time when my function that pulls this data together in the backend is not yet ready.. not sure.

 

Here is what is intended:

1. on page load a "please wait while fetching info.." pops up and a single controller method is called pulling all relevant data together.

2. once the method is complete a pageblocktable is populated and the google charts data is drawn.

 

That's it.  I've tried several workarounds to this but all to no avail.  I've posted the portions of the vf which matter for now.  The controller has always worked so I have not posted that yet.

 

Thanks in advance to all who help!

 

...
<apex:actionstatus id="pleasewait">
            <apex:facet name="start">
                <div class="waitingSearchDiv" id="el_loading" style="background-color: #fbfbfb;
                       height: 100%;opacity:0.65;width:100%;"> 
                    <div class="waitingHolder" style="top: 74.2px; width: 91px;">
                        <img class="waitingImage" src="/img/loading.gif" title="Please Wait..." />
                        <span class="waitingDescription">Loading...</span>
                    </div>
                </div>
            </apex:facet>
        </apex:actionstatus>    	
    	
    	<apex:actionFunction action="{!getFinAccts}" name="initialLoad" reRender="finAccountsTable, finAcctAnalytics" oncomplete="google.setOnLoadCallback(drawChart);" status="pleasewait" />
    	<!--Load the AJAX API-->   
    	<script type="text/javascript" src="https://www.google.com/jsapi"></script>    	    		             
		<script type="text/javascript">        	
			// Load the Visualization API and the piechart package.
	           google.load('visualization', '1.0', {'packages':['corechart']});
	
	           // Set a callback to run when the Google Visualization API is loaded.
	           google.setOnLoadCallback(drawChart);
	       
	           // Callback that creates and populates a data table,
	           // instantiates the pie chart, passes in the data and
	           // draws it.
	           function drawChart() {
	       
	               // Create the data table.
	               var data = new google.visualization.DataTable();
	               data.addColumn('string', 'Account Type');
	               data.addColumn('number', '# of Accounts');
	               console.debug('DataTable: {!dataTable}');
	               {!dataTable}                
	       
	               // Set chart options
	               var options = {'title':'{!Account.Name}',
	                              'width':400,
	                              'height':300};
	       
	               // Instantiate and draw our chart, passing in some options.
	               var chart = new google.visualization.PieChart(document.getElementById('chart'));
	               chart.draw(data, options);
	           }            
	    </script>
    	
    	<script type="text/javascript">    	
        	window.setTimeout(initialLoad, 100);        	        	            
    	</script>
...
        <!-- Financial Account Analytics -->
        <apex:outputPanel id="finAcctAnalytics" layout="block">
	    	<!--Div that will hold the pie chart-->
	        <div id="chart" layout="block" style="overflow:auto;" />	        	        		        	            				              	        
		</apex:outputPanel>