markdown Apex测试的独立自动编号

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Apex测试的独立自动编号相关的知识,希望对你有一定的参考价值。

## New Independent Auto-Number Sequence Test Option

A new option has been added to ensure that auto-number fields in your organization's records don’t have gaps due to test records created in Apex tests.
This option isolates the auto-number sequence used in Apex tests from the sequence used in your organization. As a result, the creation of test data in Apex tests doesn't cause the sequence of auto-number fields to be higher for new non-test records in your organization.

If this option isn’t enabled, there will be gaps in the auto-number field whenever Apex tests create test records with auto-number fields. For example, if Account has an auto-number field, and there are 50 account records in your organization, the field value of the last created account can be N-0050. After running an Apex test that creates five test accounts, this causes the auto-number sequence to be increased by five even though these test records aren’t committed to the database and are rolled back. Next time you create a non-test account record, its auto-number field value will be N-0056 instead of N-0051, hence, the gap in the sequence. If you enable this option before running an Apex test that creates test data, the auto-number sequence is preserved and the next non-test record will have a contiguous auto-number value of N-0051.

You can enable this option from Setup by clicking **Develop | Apex Test Execution | Options..., selecting Independent Auto-Number Sequence, and clicking OK.**

Note that gaps in the auto-number sequence can still occur in other situations, for example, when triggers that attempt to insert new records fail to execute and records are rolled back. In this case, gaps can’t be completely avoided because, in the same transaction, some records can be successfully inserted while others are rolled back.

以上是关于markdown Apex测试的独立自动编号的主要内容,如果未能解决你的问题,请参考以下文章

Oracle APEX,自动编号不起作用?

APEX 数据加载编号格式

APEX:显示/隐藏项目时如何自动调整项目宽度?

自动化测试用例编写

markdown 有用的Apex文档

markdown 将非原始参数传递给Apex方法的问题