Linked Questions
13 questions linked to/from Unit Test - Creating Custom Metadata
0
votes
1
answer
7k
views
Custom metadata type code coverage in test class [duplicate]
I Have a map of custom metadata type Map<String,error_mdt> error
error=[select id, DeveloperName from error_mdt].How can we Use meta data types in test class to get code coverage.
I have ...
1
vote
1
answer
2k
views
Apex test coverage for custom metadata type [duplicate]
Question: How can a unit test cover the throw exception part?
List<abc__mdt> settings = [
SELECT DeveloperName, Value__c
FROM Setting__mdt
WHERE ...
1
vote
1
answer
1k
views
Metadata cannot be deployed from within a test [duplicate]
When trying to insert a custom metadata record within the test it gives me the following error
@IsTest
public class Object_1TriggerTest {
@IsTest
public static void Load_field_1_from_metadata()...
0
votes
1
answer
1k
views
Test class for Custom Metadata Types [duplicate]
I have a custom metadata type with one field(text) which holds a single value. I am referring this field value in the Lightning Component to pass it as a URL.
Apex controller:
@AuraEnabled
public ...
76
votes
3
answers
37k
views
What is the difference between Custom Settings and Custom Metadata Types
Summer '15 is going to include the GA release of Custom Metadata Types. See Introducing custom metadata types: the app configuration engine for Force.com
Are Custom Metadata Types intended as a ...
42
votes
7
answers
98k
views
Insert Custom Metadata for Unit Test
I have a controller that is querying custom metadata. I'm attempting to write unit tests to test the queries. Is it possible to insert test custom metadata for the purposes of unit tests?
3
votes
1
answer
4k
views
How to Make Metadata.Operation deploy work?
Did anyone tried to new Salesforce Summer 17 feature to deploy metadata records and layouts by Apex Code?
I tried to use this feature to update custom metadata record and it fails for me.
I just ...
1
vote
1
answer
2k
views
system.runas and user's time zone
I am writing a test class for testing an API, which populates the value of an iVAR with the logged in user's time zone.
In real time, this API works fine. If the logged in User's time zone is EST, I ...
3
votes
1
answer
702
views
Testing Metadata Using Mock Call Outs to Static Resources
I have a class that is called before the handler method of a trigger to check and see if a Custom Metadata Field is checked and therefore the code in the trigger handler should not be run. I can ...
0
votes
2
answers
310
views
insertion fail due to custom metadata in handler
Here is the handler which contains meta data Petrol_Price__mdt due to which my record in test class is not getting inserted.
public with sharing class HandlerExpenseManagement{
public void ...
0
votes
1
answer
240
views
What is the proper way to enable SeeAllData when working with Event Monitoring Big Objects?
I'm using Event Monitoring & would like to use @SeAllData = true in my unit tests, so that I can leverage pre-existing logs.
However, when I enable it & query an Event Monitoring object, I ...
1
vote
1
answer
396
views
How to create a unit test for custom objects meta?
We are building a package that creates custom setting with reference to custom objects. Then we use settings to create records for these custom objects.
How we can create unit test in the package for ...
2
votes
0
answers
39
views
How can Product2.StockKeepingUnit already exist in a test? [duplicate]
I'm trying to create some Apex tests.
Of course I am NOT using SeeAllData=true.
When I try to insert some instances of Product2, even though I've inserted none before, I get:
System.DmlException: ...