- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Apex Testing: Review Testing Fundamentals | Salesforce Trailhead
#salesforce
#trailhead
#salestraining
#salesforcetrailhead
Apex Testing: Review Testing Fundamentals
Before you can deploy or package your code for the Salesforce Platform AppExchange, at least 75% of Apex code must be covered by tests, and all those tests must pass. In addition, each trigger must have some coverage.
Increase Your Code Coverage
When writing tests, try to achieve the highest code coverage possible, including positive and negative test cases, and bulk and single-record processing. Don’t just aim for 75% coverage, which is the lowest coverage that the Salesforce Platform requires for deployments and packages. The more test cases that your tests cover, the higher the likelihood that your code is robust.
Sometimes, even after you write test methods for all your class methods, code coverage is not at 100%. One common cause is not covering all data values for conditional code execution. For example, some data values tend to be ignored when your class method has if statements that cause different branches to be executed based on whether the evaluated condition is met. Ensure that your test methods account for these different values.
Let’s look at an example. This example includes the class method, getTaskPriority, which contains two if statements. The main task of this method is to return a priority string value based on the given lead state. The method validates the state first and returns null if the state is invalid. If the state is CA, the method returns 'High'; otherwise, it returns 'Normal' for any other state value.
00:00 Introduction
00:20 Understand Why You Test
01:08 Determine What You Should Test for Apex
Видео Apex Testing: Review Testing Fundamentals | Salesforce Trailhead канала Saurabh Infotech Solutions
#trailhead
#salestraining
#salesforcetrailhead
Apex Testing: Review Testing Fundamentals
Before you can deploy or package your code for the Salesforce Platform AppExchange, at least 75% of Apex code must be covered by tests, and all those tests must pass. In addition, each trigger must have some coverage.
Increase Your Code Coverage
When writing tests, try to achieve the highest code coverage possible, including positive and negative test cases, and bulk and single-record processing. Don’t just aim for 75% coverage, which is the lowest coverage that the Salesforce Platform requires for deployments and packages. The more test cases that your tests cover, the higher the likelihood that your code is robust.
Sometimes, even after you write test methods for all your class methods, code coverage is not at 100%. One common cause is not covering all data values for conditional code execution. For example, some data values tend to be ignored when your class method has if statements that cause different branches to be executed based on whether the evaluated condition is met. Ensure that your test methods account for these different values.
Let’s look at an example. This example includes the class method, getTaskPriority, which contains two if statements. The main task of this method is to return a priority string value based on the given lead state. The method validates the state first and returns null if the state is invalid. If the state is CA, the method returns 'High'; otherwise, it returns 'Normal' for any other state value.
00:00 Introduction
00:20 Understand Why You Test
01:08 Determine What You Should Test for Apex
Видео Apex Testing: Review Testing Fundamentals | Salesforce Trailhead канала Saurabh Infotech Solutions
Комментарии отсутствуют
Информация о видео
11 марта 2024 г. 7:30:30
00:01:46
Другие видео канала





















