To make sure your custom form logic in
...
GoMeddo is unit tested a global class called Test_FormHelper, is added to the applications. This class contains helper methods that allow you to trigger form events.
Note |
---|
Because these methods fire an event as if it was fired from the form to make the behaviour consistent during unit tests and normal operation the default |
...
GoMeddo handlers are also fired. This means the return value of FormEvent could include FormEvents produced by |
...
GoMeddo. |
Start of the unit test
To let
...
GoMeddo know that there is custom logic in place you need to add a @TestSetup
. Which creates the setting in the unit test.
Code Block | ||
---|---|---|
| ||
@TestSetup
static void makeData(){
B25__System_Setting__c systemSetting = new B25__System_Setting__c();
systemSetting.Name ='Reservation Form Customizer Class';
systemSetting.B25__String_Value__c = <CUSTOMIZER_APEX_CLASS_NAME>;
Database.insert(systemSetting);
} |
Methods
runFormInitializationEvent
Using this method, you can trigger a form initialization event to test your custom form implementations.
Code Block |
---|
List<B25.FormEvent> runFormInitializationEvent(B25.Test_FormHelper.TestFormContext formContext) |
Return value: List<B25.FormEvent>
Parameters:
Name | Type | Description |
---|---|---|
formContext |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603745285/B25.Test+FormHelper.TestFormContext | The context of the form during the initialization event. |
runFieldChangeEvent
Using this method you can trigger a field change event to test your custom form implementations.
Code Block |
---|
List<B25.FormEvent> runFieldChangeEvent(B25.Test_FormHelper.TestFormContext formContext, B25.Test_FormHelper.TestChangeEvent changeEvent) |
Return value: List<B25.FormEvent>
Parameters:
Name | Type | Description |
---|---|---|
formContext |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603745285/B25.Test+FormHelper.TestFormContext | The context of the form during the field change event. |
changeEvent |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2604105733/B25.Test+FormHelper.TestChangeEvent | The change event that is being fired |
runRelatedListAddEvent
Using this method you can trigger a related list item add event to test your custom form implementations.
Code Block |
---|
List<B25.FormEvent> runRelatedListAddEvent(B25.Test_FormHelper.TestFormContext formContext, B25.Test_FormHelper.TestRelatedListEvent changeEvent) |
Return value: List<B25.FormEvent>
Parameters:
Name | Type | Description |
---|---|---|
formContext |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603745285/B25.Test+FormHelper.TestFormContext | The context of the form during the related list add event. |
changeEvent |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2604367887/B25.Test+FormHelper.TestRelatedListEvent | The related list event that is being fired |
runRelatedListRemoveEvent
Using this method you can trigger a related list item remove event to test your custom form implementations.
Code Block |
---|
List<B25.FormEvent> runRelatedListRemoveEvent(B25.Test_FormHelper.TestFormContext formContext, B25.Test_FormHelper.TestRelatedListEvent changeEvent) |
Return value: List<B25.FormEvent>
Parameters:
Name | Type | Description |
---|---|---|
formContext |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603745285/B25.Test+FormHelper.TestFormContext | The context of the form during the related list remove event. |
changeEvent |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2604367887/B25.Test+FormHelper.TestRelatedListEvent | The related list event that is being fired |
runLookupOverrideSearch
Using this method you can trigger a search event to test your custom form implementations.
Code Block |
---|
B25.SearchResultCollection runLookupOverrideSearch(B25.Test_FormHelper.TestFormContext formContext, B25.Test_FormHelper.TestSearchContext testSearchContext) |
Return value: B25.SearchResultCollection
Parameters:
Name | Type | Description |
---|---|---|
formContext |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603745285/B25.Test+FormHelper.TestFormContext | The context of the form during the search event. |
changeEvent |
...
gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603614233/B25.Test+FormHelper.TestSearchContext | The search context. |
runBeforeSaveEvent
...
On this page
...
Using this method, you can trigger a form before save event to test your custom form implementations.
Code Block |
---|
List<B25.FormEvent> runBeforeSaveEvent(B25.Test_FormHelper.TestFormContext formContext) |
Return value: List<B25.FormEvent>
Parameters:
Name | Type | Description |
---|---|---|
formContext | https://gomeddo.atlassian.net/wiki/spaces/BPD/pages/2603745285/B25.Test+FormHelper.TestFormContext | The context of the form during the save event. |