Top Banner
Testing Business Logic begins in Requirements Paul Vincent BCS SIGiST – Summer 2015 Conference - Friday 5 June 2015
48

Testing begins with requirements - Presentation to BCS SIGiST jun15

Aug 17, 2015

Download

Software

isvana
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Testing begins with requirements - Presentation to BCS SIGiST jun15

Testing Business Logic begins in Requirements

Paul Vincent

BCS SIGiST – Summer 2015 Conference - Friday 5 June 2015

Page 2: Testing begins with requirements - Presentation to BCS SIGiST jun15

Some Known Best Practices …

• Agile development(fail early, deliver often)

• Test-driven development(test specification = system specification)

• Model-driven development(formal models are more easily transformed into software)

Page 3: Testing begins with requirements - Presentation to BCS SIGiST jun15

Ref: BCS SIGiST Spring 2015

Page 4: Testing begins with requirements - Presentation to BCS SIGiST jun15

Ref: BCS SIGiST Winter 2014

Page 5: Testing begins with requirements - Presentation to BCS SIGiST jun15

BCS SIGiST Autumn 2014

Page 6: Testing begins with requirements - Presentation to BCS SIGiST jun15

1. Why Test in Requirements?

Ref: http://loadstorm.com/2011/10/cost-fixing-software-defects/

Page 7: Testing begins with requirements - Presentation to BCS SIGiST jun15

2. But how can Requirements be Formal?

• Models can be formal

• Example = BPMN process

• Can be validated, simulated,loops detected etc

Decision

Gateway

Task

Ref OMG DMN

Page 8: Testing begins with requirements - Presentation to BCS SIGiST jun15

3. Decision Models for Requirements

• Decision “models” are not new!

Babylon 1800BC - Mathematical look-up table

Page 9: Testing begins with requirements - Presentation to BCS SIGiST jun15

3. Decision Models for Requirements

• Decision “models” are not new!

Page 10: Testing begins with requirements - Presentation to BCS SIGiST jun15

4. Decision Models for Testing

1977

Page 11: Testing begins with requirements - Presentation to BCS SIGiST jun15

5. Decision Models as Requirements

• How can we define a formal model for business logic that Business Analysts can use?

With appropriate notation, methodology and standards?

• Can modelling tools embed appropriate testing to automate tests?

Page 12: Testing begins with requirements - Presentation to BCS SIGiST jun15

Decision Methodologies

• TDM - The Decision Model (von Halle, Goldberg)• Published, commercially supported, specific notation

• Tooling (BiZZDesign, Sapiens, SAP,…)

• DTM - Decision Table Methodology (Vanthienen)• Published across papers and books, commercially supported

• Tooling (Various) for decision tables

• Decision Management Systems Methodology (Taylor)• Published, commercially supported

• Own tooling (Decision Management Solutions)

Page 13: Testing begins with requirements - Presentation to BCS SIGiST jun15

Decision Notations

• TDM - The Decision Model (von Halle, Goldberg)• Published, commercially supported, specific notation• Tooling (BiZZDesign, Sapiens, SAP,…)

• OMG DMN - Decision Model and Notation• Published, commercial support starting, specific notation• Tooling (Signavio, DMS, FICO, …)

Page 14: Testing begins with requirements - Presentation to BCS SIGiST jun15

Case Study: Example using TDM

Determine PolicyRenewal Method

Manual Renewal

Automatic Renewal

Manual or Automatic

Page 15: Testing begins with requirements - Presentation to BCS SIGiST jun15

A. What is Decision?

• Find Manual or Automated status…

Determine PolicyRenewal Method

BPMN

TDM

Page 16: Testing begins with requirements - Presentation to BCS SIGiST jun15

Per OMG DMN

•A Decision is the act of applying decision logic to one or more inputs to produce one output

•A Decision Logic is a formal expression that defines the output of a decision with respect to its inputs• A decision logic can be a Computation• Or a Fixed Alternatives Ruleset, represented as a Decision

Table or a Decision Tree• Or it can be an Imported Formulation (e.g. a predictive model

in PMML)

Page 17: Testing begins with requirements - Presentation to BCS SIGiST jun15

B. What is the Decision Logic

Page 18: Testing begins with requirements - Presentation to BCS SIGiST jun15

Decision Table / Rule Family describing logic

AND

OR

FAMILYOF RELATEDBUSINESSRULES

CONCLUSION

Page 19: Testing begins with requirements - Presentation to BCS SIGiST jun15

C. Is this complete, no duplications etc?

ALL VALUES TESTED? ALL VALUE COMBINATIONS TESTED? ALL CONCLUSIONS CONSISTENT?

Page 20: Testing begins with requirements - Presentation to BCS SIGiST jun15

Verify Rule Family / Decision Table (static test)

Page 21: Testing begins with requirements - Presentation to BCS SIGiST jun15

D. Does this do what is intended?

ARE THE RESULTS AS EXPECTED AGAINST TEST CASES?

Page 22: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

Page 23: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

Page 24: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

Page 25: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

Page 26: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

TEST CASES CREATED, CUSTOMISED, ETC

Page 27: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

TEST RESULTS SHOWN

Page 28: Testing begins with requirements - Presentation to BCS SIGiST jun15

Validate Rule Family / Decision Table (test cases)

TEST CASE SHOWN IN DECISION TABLE / RULE FAMILY

Page 29: Testing begins with requirements - Presentation to BCS SIGiST jun15

E. Unit Testing Done

REPEAT EXHAUSTIVE TESTS FOR THESE RULE FAMILIES

Page 30: Testing begins with requirements - Presentation to BCS SIGiST jun15

F. Test Connections to Rule Families

DEFINE TESTS FOR ALL BRANCHES, TESTING EACH LINK

Page 31: Testing begins with requirements - Presentation to BCS SIGiST jun15

Assumptions for decision modelling for testing1. I know the decision I need to make

(may be re-used across processes)

2. I define a formal / rigorous data model too (name, type, value domain, single/list)• See Data Modelling for Requirements Testing

presentation at some future SIGiST!

Page 32: Testing begins with requirements - Presentation to BCS SIGiST jun15

For Business Logic requirements…

1. We can model business logic using Decision Models

Page 33: Testing begins with requirements - Presentation to BCS SIGiST jun15

For Business Logic requirements…

1. We can model business logic using Decision Models

2. We can verify the completeness + uniqueness of this business logic

Page 34: Testing begins with requirements - Presentation to BCS SIGiST jun15

For Business Logic requirements…

1. We can model business logic using Decision Models

2. We can verify the completeness + uniqueness of this business logic

3. We can validate the business logic against all possible use cases for each rule family + all links in a decision model of multiple rule families

Page 35: Testing begins with requirements - Presentation to BCS SIGiST jun15

How useful is this?

• Example 1: a product selection requirement

• Original analysis = 15,000 rows of business logic in Excel

• Decision Modelled = ~220 rows across ~18 decisionsby 6 Business Analysts over 2-3 weeks

Page 36: Testing begins with requirements - Presentation to BCS SIGiST jun15

How useful is this?

• Example 2: business loan compliance with policy

• Original analysis = spreadsheet of X tabs ofmetrics vs business sector vs threshold levels

• Decision Modelled = Validate-able thresholds vs policies,Side by side comparison of thresholds,

Champion challenger etc

Page 37: Testing begins with requirements - Presentation to BCS SIGiST jun15

Standards to support this pattern?

• Standardisation effort by OMG DMN• Notation and metamodel

• Can be used with multiple methodologies eg DTM, TDM

• Tooling to support DMN underway

Page 38: Testing begins with requirements - Presentation to BCS SIGiST jun15

DMN Decision Requirements Diagram

DECISION BUSINESSKNOWLEDGEMODEL

INPUT

Page 39: Testing begins with requirements - Presentation to BCS SIGiST jun15

TDM / DMN

=

Page 40: Testing begins with requirements - Presentation to BCS SIGiST jun15

DRD Key

Page 41: Testing begins with requirements - Presentation to BCS SIGiST jun15

DRDConnectionsGuide

Page 42: Testing begins with requirements - Presentation to BCS SIGiST jun15

Decision Table (a Business Knowledge Model)

Page 43: Testing begins with requirements - Presentation to BCS SIGiST jun15

Decision Table Hit PoliciesIndicator Indicator

TermDescription

Single Hit U Unique Only 1 rule matched = DEFAULT POLICY

A Any Many rules can match but matched rules must have same output

P Priority Many rules can match and matched rules can have different outputs; output selected per a prioritised list of possible outputs

F First Many rules can match and matched rules can have different outputs; output selected per ordering of rules

Multi Hit O Output Matched rule outputs are returned in order per a prioritised list of possible outputs

R Rule Matched rule outputs are returned in order per ordering of rules

C Collect No operator Matched rule outputs are returned in arbitrary order

C+ Collect operator(+, <, >, #)

Operator (sum, min, max, count) applied to the outputs and the result returned

C>

C<

C#

Page 44: Testing begins with requirements - Presentation to BCS SIGiST jun15

DMN Spec Example

Page 45: Testing begins with requirements - Presentation to BCS SIGiST jun15

DRD

Page 46: Testing begins with requirements - Presentation to BCS SIGiST jun15

BKM(s)

Page 47: Testing begins with requirements - Presentation to BCS SIGiST jun15
Page 48: Testing begins with requirements - Presentation to BCS SIGiST jun15

THANK YOU

• Credits:

• OMG DMN standards teamstandardising notations for best practice decision analysis and design

• Larry Goldberg and Barbara Vonhalledefining The Decision Model as a best practice methodology

• Sapiens DECISION product teampermitting the use of their tool for this presentation