You need to sign in to do that
Don't have an account?
Austin Gutz
Apex Test Class Fails
I'm trying to deploy a very simple Apex class that I'll then schedule to do a nightly record update. The deployment is failing because of errors with a test class that came from an installed app. I'm an admin, so I have very little Apex knowledge.
The errors are all:
System.QueryException: List has no rows for assignment to SObject
All the errors point to a line with: User u = getUser('NotAccessible1');
From what I'm reading it has something to do with an empty query. I just don't know how to fix it. I'll post the code in a different comment.
The errors are all:
System.QueryException: List has no rows for assignment to SObject
All the errors point to a line with: User u = getUser('NotAccessible1');
From what I'm reading it has something to do with an empty query. I just don't know how to fix it. I'll post the code in a different comment.
Please check profile with NotAccessible1 name exists in org because this error comes when query return null value.
Thanks
"The test class won't pass tests
Class CaseStatusCahngeTriggerHandlerTest (yes, misspelled) won't pass tests in your org because it assumes you have Profilees named 'NotAccessible1', 'NotAccessible2', 'NotCreatable' and 'NotUpdatable' with varying levels of CRUD access to User, BusinessHours, and Case_Status_Change__c objects.
You need to make test class without sharing; and in testSetup, create the Case using a system admin user.
You can fix test: 'testAccessible1' by using Profile 'Force.com - One App User'. You can fix test 'testAccessible2' by using profile 'Read Only'. Personally, I'd comment out the testCreatable and testUpdatable test methods if not also testAccessible1 and testAccessible2"
Would it be easiest to use the suggestion to comment out those test methods? If yes, how do I do that?