package - Salesforce 包中的个人资料
问题描述
嘿,我在 2GP 中有以下代码:
User u = new User(firstname= 'testPOWERBI',
lastname='testPOWERBI',
Alias='a',
email = 'testPOWERBI@gmail.com',
username= 'testPOWERBI@test.com',
emailencodingkey='UTF-8',
languagelocalekey='en_US',
localesidkey='en_US',
ProfileId = p.id,
timezonesidkey='America/Los_Angeles');
insert u;
system.runAs(u)
{///what i need to do/// }
我的测试类在我的开发者控制台中以 100% 的测试覆盖率工作。但是当我创建包时,我收到以下错误:
Apex 测试失败:
Class.PowerBIApp.LWC_DashboardTest.getAllDashboardTest: line 5, column 1 System.ListException: List index out of bounds: 0
第 5 行是:
profile p = [SELECT id, Name FROM profile where name = 'System Administrator'].get(0);
因此,我无法创建包。但是当我在没有 runas 的情况下进行测试时,我收到:
Apex Test Failure: Class.PowerBIApp.LWC_Dashboard.getAllDashboard: line 4, column 1
Class.PowerBIApp.LWC_DashboardTest.getAllDashboardTest: line 25, column 1 System.QueryException: Insufficient permissions: secure query included inaccessible field
如果有人可以帮助我???
感谢
解决方案
推荐阅读
- excel - 将列复制到新工作簿并另存为 csv
- mips - MIPS - 刷新和停顿可以同时发生吗
- java - 如何检查一个数字是否大于数组中它右侧的所有其他数字
- python - 后端 CPU 的预期对象,但获得了参数 #2 'source' 的后端 CUDA
- jquery - 下拉菜单在本地工作但不在服务器上
- xamarin.forms - 日期选择器的更新模式
- c# - 基于异步 Web 服务的消息队列
- python - Scrapy - 发送 AJAX FormRequest 返回错误 419
- speech-recognition - “有没有办法在 .grxml 文件中循环规则?”
- python-3.x - Selenium - 文本属性仅在调试器检查后才可用