Questions tagged [seealldata]
The seealldata tag has no usage guidance.
16
questions
0
votes
0
answers
201
views
How to test ConnectApi.ChatterFeeds.postFeedElement() method
We're trying to follow good practices and remove SeeAllData=True from test classes but when dealing with ConnectApi most of the methods need to see all org data. Except some methods which can use the ...
2
votes
1
answer
34
views
Test Class For Schedulable Apex Without Using (SellAllData=true)
Folks,
I wonder if we have another way to create test class if we don't annotate with (SeeAllData=true).
Here, my SOQL to retrieve a list of ContentDocument have been created more than 7 days. That ...
3
votes
2
answers
620
views
Is it wrong to put 'insert' in test class with SeeAllData = true?
As the Vlocity documentation says, for Integration Procedure Unit Testing from Apex, we must use Salesforce seeAllData property.
In my case, the ideal would be to insert Order data for the test unit. ...
1
vote
2
answers
103
views
Is it possible to have an APEX Testmethod to see SOME, but not ALL data?
Usually I only need @isTest(SeeAllData=false)
But now I need to see some Custom Settings (they count as "data", too). And at the same time I must ensure to see only the Custom Settings, but ...
0
votes
1
answer
239
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 ...
0
votes
1
answer
3k
views
How to use SeeAllData = True method inside a test class with SeeAllData = False
I have written a test class where I need to insert Survey Invitation record, for which Survey required (i.e. Survey is parent and Survey invitation is child).
I'm querying the Survey record since ...
6
votes
2
answers
2k
views
When should I use SeeAllData=true in my test methods?
This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through ...
1
vote
3
answers
184
views
Is it necessary to SeeAllData in this case? Thoughts on Best Practice?
There's a lot of talk about SeeAllData being something to always avoid for best practice. My understanding is, if you're using it to test, for example, a Contact Trigger on a specific Contact, this is ...
1
vote
2
answers
374
views
Test fails in destination Org with System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE
I've a test class for a controller which passes in the development Org but not in the destination/sandbox. Here's the error I get
System.DmlException: Insert failed. First exception on row 0; first ...
0
votes
1
answer
409
views
Query returning value from database and not test class
I'm having trouble with my code coverage and have a couple of hypothesis why this could be.
My class:
public class Tareas_Ordenador {
public static void Ordenar(){
User Usuario = [Select Id ...
0
votes
1
answer
379
views
Potential usecase for SeeAllData = true
As current api set default test class with SeeAllData=false and is advisable for us to use sample data,I am wondering what is ideal case for SeeAllData=true.
I am planning to write test class that ...
8
votes
2
answers
8k
views
why need seeAllData = true in test class when use connectAPI
In my controller i'm using connectApi and my class functionality is working fine but the issue is when i'm using in my Test class (SeeAllData=true) it's covered 100% but seeAllData = true is not ...
4
votes
1
answer
4k
views
How to use Test.getStandardPricebookId for classes that automaticaly sync quotes
I was hopping to be able to remove the @seeAllData annotation from my tests by using Summer'14's addition - Test.getStandardPricebookId() but the test are failing with this error:
System....
3
votes
1
answer
1k
views
How to avoid hard coding Id into a class?
I am running my test class but keep getting thrown this error
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
I have even added seealldata=true to try overcome this but want a more clean solution my ...
4
votes
1
answer
2k
views
SOQL returning org data in test class. Not using isTest(SeeAllData=true)
A method in my class I'm testing is suppose to return all users in the org, plus an extra user empty user at the beginning of the list. The reason for this is I wanted the default to be empty.
@...
43
votes
4
answers
2k
views
Why Are Data Silos Important in Unit Tests?
I have a lot of strong opinions about this issue, but had a hard time finding official documents today to back up my position. A lot of times we say it is bad practice to use seeAllData=true, but we ...