Skip to content

Instantly share code, notes, and snippets.

@richardlawrence
Created August 10, 2011 20:01
Show Gist options
  • Save richardlawrence/1138036 to your computer and use it in GitHub Desktop.
Save richardlawrence/1138036 to your computer and use it in GitHub Desktop.
Experiments with scenarios around tiered sales commissions
Feature: Tiered Sales Commissions
As a salesperson sells more, his commission percentage should get higher. Commissions are tiered.
Scenario: Flat commission
Given I earn a flat 10% commission
When I sell $10,000 of services
Then I should earn $1,000 in commissions
Scenario: Two tier commission (in second tier)
Given I earn 10% commission up to $5,000 of sales
And I earn 12% commission above $5,000 of sales
When I sell $6,000 of services
Then I should earn $620 in commissions
Scenario: Two tier commission (in first tier only)
Given I earn 10% commission up to $5,000 of sales
And I earn 12% commission above $5,000 of sales
When I sell $4,000 of services
Then I should earn $400 in commissions
Scenario: Two tier commission (at boundary)
Given I earn 10% commission up to $5,000 of sales
And I earn 12% commission above $5,000 of sales
When I sell $5,000 of services
Then I should earn $500 in commissions
Scenario Outline: Two tier commission
Given I earn <rate1> commission up to <boundary> of sales
And I earn <rate2> commission above <boundary> of sales
When I sell <sales> of services
Then I should earn <expected commission> in commissions
Examples:
| scenario | rate1 | boundary | rate2 | sales | expected commission |
| in first tier only | 10% | $5,000 | 12% | $4,000 | $400 |
| at boundary | 10% | $5,000 | 12% | $5,000 | $500 |
| in second tier | 10% | $5,000 | 12% | $6,000 | $620 |
Scenario Outline: Three tier commission
Given I earn <rate1> commission for sales up to <boundary1>
And I earn <rate2> commission for sales between <boundary1> and <boundary2>
And I earn <rate3> commission for sales above <boundary2>
When I sell <sales> of services
Then I should earn <expected commission> in commissions
Examples:
| scenario | rate1 | boundary1 | rate2 | boundary2 | rate3 | sales | expected commission |
| in first tier only | 10% | $5,000 | 12% | $10,000 | 20% | $4,000 | $400 |
| at first boundary | 10% | $5,000 | 12% | $10,000 | 20% | $5,000 | $500 |
| in second tier | 10% | $5,000 | 12% | $10,000 | 20% | $6,000 | $620 |
| at second boundary | 10% | $5,000 | 12% | $10,000 | 20% | $10,000 | $1,100 |
| in third tier | 10% | $5,000 | 12% | $10,000 | 20% | $12,000 | $1,500 |
Scenario Outline: Three tier commission (with rates table)
Given I earn the following commissions:
| rate | from | to |
| <rate1> | 0 | <boundary1> |
| <rate2> | <boundary1> | <boundary2> |
| <rate3> | <boundary2> | |
When I sell <sales> of services
Then I should earn <expected commission> in commissions
Examples:
| scenario | rate1 | boundary1 | rate2 | boundary2 | rate3 | sales | expected commission |
| in first tier only | 10% | $5,000 | 12% | $10,000 | 20% | $4,000 | $400 |
| at first boundary | 10% | $5,000 | 12% | $10,000 | 20% | $5,000 | $500 |
| in second tier | 10% | $5,000 | 12% | $10,000 | 20% | $6,000 | $620 |
| at second boundary | 10% | $5,000 | 12% | $10,000 | 20% | $10,000 | $1,100 |
| in third tier | 10% | $5,000 | 12% | $10,000 | 20% | $12,000 | $1,500 |
Scenario Outline: Three tier commission (with rates hard-coded in table)
Given I earn the following commissions:
| rate | from | to |
| 10% | $0 | $5,000 |
| 12% | $5,000 | $10,000 |
| 20% | $10,000 | |
When I sell <sales> of services
Then I should earn <expected commission> in commissions
Examples:
| scenario | sales | expected commission |
| in first tier only | $4,000 | $400 |
| at first boundary | $5,000 | $500 |
| in second tier | $6,000 | $620 |
| at second boundary | $10,000 | $1,100 |
| in third tier | $12,000 | $1,500 |
Scenario Outline: Three tier commission (with rates hard-coded in pivoted table)
Given I earn the following commissions:
| rate 1 | 10% |
| boundary 1 | $5,000 |
| rate 2 | 12% |
| boundary 2 | $10,000 |
| rate 3 | 20% |
When I sell <sales> of services
Then I should earn <expected commission> in commissions
Examples:
| scenario | sales | expected commission |
| in first tier only | $4,000 | $400 |
| at first boundary | $5,000 | $500 |
| in second tier | $6,000 | $620 |
| at second boundary | $10,000 | $1,100 |
| in third tier | $12,000 | $1,500 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment