-
Notifications
You must be signed in to change notification settings - Fork 0
Grouped keywords together #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ssong/learn-robot-framework
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| *** Settings *** | ||
|
|
||
| Resource robot/Cumulus/resources/NPSP.robot | ||
| Library cumulusci.robotframework.PageObjects | ||
| ... robot/Cumulus/resources/GAUPageObject.py | ||
|
|
@@ -12,48 +11,81 @@ Suite Teardown Delete Records and Close Browser | |
|
|
||
| *** Keywords *** | ||
| Setup Test Data | ||
| &{campaign}= API Create Campaign | ||
| &{data}= setupdata contact ${contact1_fields} | ||
| Set suite Variable &{campaign} | ||
| Set suite Variable &{data} | ||
|
|
||
| &{campaign}= API Create Campaign | ||
| &{data}= setupdata contact ${contact1_fields} | ||
| ${ns}= Get Npsp Namespace Prefix | ||
| Set suite Variable &{campaign} | ||
| Set suite Variable &{data} | ||
| Set suite Variable ${ns} | ||
|
|
||
| *** Variables *** | ||
| &{contact1_fields} Email=test@example.com | ||
| ${amount} 100 | ||
| ${stage_name} Closed Won | ||
|
|
||
|
|
||
| *** Test Cases *** | ||
| Assign GAU to Campaign and Verify Allocation on Opportunity | ||
| Create GAU | ||
| ${name}= Generate Random String | ||
| Go To Page Listing | ||
| ... General_Accounting_Unit__c | ||
| ${gau1_name}= Generate Random String | ||
| ... General_Accounting_Unit__c | ||
| Click Object Button New | ||
| Populate Modal Form | ||
| ... General Accounting Unit Name=${gau1_name} | ||
| Populate Modal Form | ||
| ... General Accounting Unit Name=${name} | ||
| Click Modal Button Save | ||
| Wait Until Modal Is Closed | ||
| ${gau_header}= Get Main Header | ||
| ${gau1}= Save Current Record Id For Deletion General_Accounting_Unit__c | ||
| Select Tab Related | ||
| Click Object Button New | ||
| Populate Modal Form Percent=100 | ||
| ... Campaign=&{campaign}[Name] | ||
| Click Modal Button Save | ||
| ${gau_id}= Save Current Record Id For Deletion General_Accounting_Unit__c | ||
| [return] ${gau_id} | ||
|
|
||
| Create Opportunity With Campaign | ||
| [Arguments] ${account_name} ${campaign_name} | ||
| Go To Page Listing | ||
| ... Opportunity | ||
| ${opportunity_name}= Generate Random String | ||
| Click Object Button New | ||
| Select Record Type Donation | ||
| Populate Modal Form | ||
| ... Opportunity Name=${opportunity_name} | ||
| ... Account Name=${data}[contact][LastName] Household | ||
| ... Account Name=${account_name} | ||
| ... Amount=${amount} | ||
| ... Primary Campaign Source=${campaign}[Name] | ||
| ... Primary Campaign Source=${campaign_name} | ||
| Select Value From Dropdown Stage ${stage_name} | ||
| Open Date Picker Close Date | ||
| Pick Date Today | ||
| Click Modal Button Save | ||
| Wait Until Modal Is Closed | ||
| ${opp_id}= Save Current Record Id For Deletion Opportunity | ||
| [return] ${opp_id} | ||
|
|
||
| API Create Campaign GAU Allocation | ||
| [Arguments] ${gau_id} ${campaign_id} &{fields} | ||
| ${ns}= Get Npsp Namespace Prefix | ||
| ${all_id}= Salesforce Insert | ||
| ... ${ns}Allocation__c | ||
| ... ${ns}General_Accounting_Unit__c=${gau_id} | ||
| ... ${ns}Campaign__c=${campaign_id} | ||
| ... &{fields} | ||
| &{gau_alloc}= Salesforce Get ${ns}Allocation__c ${all_id} | ||
| [return] &{gau_alloc} | ||
|
|
||
| Browser Create Campaign GAU Allocation | ||
| [Arguments] ${campaign_name} | ||
| Select Tab Related | ||
| Click Object Button New | ||
| Populate Modal Form Percent=100 | ||
| ... Campaign=${campaign_name} | ||
| Click Modal Button Save | ||
|
|
||
| Verify GAU Allocation is Automatically Created | ||
| Select Tab Related | ||
| Validate Related Record Count GAU Allocations 1 | ||
| Validate Related Record Count GAU Allocations 1 | ||
|
|
||
|
|
||
| *** Variables *** | ||
| &{contact1_fields} Email=test@example.com | ||
| ${amount} 100 | ||
| ${stage_name} Closed Won | ||
|
|
||
|
|
||
| *** Test Cases *** | ||
| Assign GAU to Campaign and Verify Allocation on Opportunity | ||
| ${gau_id}= Create GAU | ||
| API Create Campaign GAU Allocation ${gau_id} | ||
| ... &{campaign}[Id] | ||
| ... ${ns}Percent__c=100.0 | ||
|
Comment on lines
+86
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could group this into a keyword called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to leave this keyword on this robot file then I'd just hard code the API Create keyword to be 100%. If you want the keyword to be more generic and usable in other tests, then I would promote your API Create Keyword to NPSP.robot file (first I'd check to make sure one doesn't already exist that you can just use an update). And then you can create a localized keyword that references the above. While not a requirement, I recommend building keywords so that there are no variables in the tests so that the tests can be very readable steps. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you promote it, you can probably put it near this keyword: https://github.com/SalesforceFoundation/NPSP/blob/master/robot/Cumulus/resources/NPSP.robot#L139
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Julian88Tex Thanks, I basically copy pasted the original keyword since that one only worked for Opportunities, how would I promote it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sungysang promote it means cut it from this file and paste it in the NPSP.robot file |
||
| Create Opportunity With Campaign ${data}[contact][LastName] Household | ||
| ... ${campaign}[Name] | ||
|
Comment on lines
+89
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason this needs to be UI? If you just testing the trigger logic, you might as well just create Opportunity through API. Looks like you can use this existing Keyword: https://github.com/SalesforceFoundation/NPSP/blob/master/robot/Cumulus/resources/NPSP.robot#L50
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Julian88Tex I felt like this should try to re-create the user scenario as close as possible through the UI, but would you recommend API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sungysang it all depends on what you're trying to test. If you trying to test the trigger, then API should be fine IMO since I wouldn't expect UI to have any impact on trigger logic vs. making an API call. If you're trying to test UI then stick with UI. |
||
| Verify GAU Allocation is Automatically Created | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sungysang looks like this can be part of Setup Test Data since it isn't part of the test.