Loading

MyProfilePageControllerTest fails when StateAndCountryPicklist is enabled in the project-scratch-def.json

Дата публикации: Apr 14, 2026
Описание

MyProfilePageControllerTest class fails when StateAndCountryPicklist is enabled, and a System.AssertException occurs in the auto-generated MyProfilePageControllerTest class.

Sample JSON

{
"orgName": "aikebe company",

 "edition": "Developer",

 "features": [

  "Communities",

  "StateAndCountryPicklist", "PlatformCache", "Sites"

  ],

 "settings": {

  "lightningExperienceSettings": {

   "enableS1DesktopEnabled": true

  },

  "mobileSettings": {

   "enableS1EncryptedStoragePref2": false

  }

 }

}

Steps to reproduce

1. Create a Scratch Org - Enable StateAndCountryPicklist feature in the project-scratch-def.json.

2. Once its created, it auto generates an apex class MyProfilePageControllerTest

3. Run Test- Execute MyProfilePageControllerTest.testSave().

4. Observe Failure - System.AssertException: Assertion Failed: Class.MyProfilePageControllerTest.testSave: line 30, column 1

 

Решение

1.Exclude StateAndCountryPicklist feature when creating the scratch org

2.Enable the S/C feature manually once the scratch org is created by following the required steps in the UI which will requires converting the State and Country values to a valid value.

3.Then run the apex test once the S/C is successfully enabled

 

Номер статьи базы знаний

005318600

 
Загрузка
Salesforce Help | Article