You need to sign in to do that
Don't have an account?
test class
When i run a test class, i get this error. However Debug logs show that this is not null.
How can i get rid of this errr in my test class.
Message:
System.QueryException: List has no rows for assignment to SObjectClass.
Stack Trace:
controllerA.ProcessApprovalDecision: line 72, column 1 Class.TEST_controllerA.testREJECT: line 637, column 1
14:15:36.313 (45313579000)|USER_DEBUG|[70]|DEBUG|ROOOOOOVVVV:a1wS000000057H5IAI
14:15:36.313 (45313852000)|SOQL_EXECUTE_BEGIN|[71]|Aggregations:0|select Engagement_Country_Status__c from Supplier_Engagement_Country__c where ID = :tmpVar1
14:15:36.335 (45335362000)|SOQL_EXECUTE_END|[71]|Rows:1
14:15:36.335 (45335487000)|USER_DEBUG|[73]|DEBUG|Retrieved: On-Boarding
The test debug logs, or when you actually use the logs when manually testing? I'd hazard a guess that you're trying to retrieve data from your existing database? If so, you need to use @isTest(SeeAllData=true) instead of just @isTest, or your query would fail.
Thanks. The test debug logs, not when i am manually testing.
when i add @isTest(SeeAllData=true), i het an error , Unknown annotation parameter: seeAlldata
Any suggestion?
Can you post your test code here?
~ sfdcfox ~ thanks for the help. However i haven't written this test class, so not comfortable posting here.
I will try a few things if not, i will send the code to you in a private message, if you are ok with it.
Your API version of the test class might be older. Hence you get the error while using "SeeAllData = true". Try changing it to 24.0 or 25.0 and then adding the " @isTest(SeeAllData = True) as posted by sfdcfox
You can change the API version of the class from the UI :
Setup -> Develop -> Apex Classes -> Go to the specific class and there you have the "Version settings" tab, change it from there.
Thanks Vishal, I tried as you suggested chnaged version to 24.0 on both the test class and the base class. The code coverage percentage from 18% is 0 (No code coverage), the amufactured data in the test class is from a test data factory. I wil try changing the version on the test data factory class.
Rov you can put Supplier_Engagement_Country__c object in list
list<Supplier_Engagement_Country__c> lstchildSEC = [query here];
when your query return null it will not send error.
Thanks,
Bhup
Thanks. i'll try.