Persisting and unit testing objects and their relationships with tiOPF & DUnit2

19
Peter Hinrichsen TechInsite Pty Ltd www.techinsite.com.au Persisting and unit testing objects and their relationships with tiOPF & DUnit2

description

Persisting and unit testing objects and their relationships with tiOPF & DUnit2. Topics. Demo Object model and database structure Examples in code Business object model Unit tests User interface Questions and discussion. User interface – Command box. The business object model. - PowerPoint PPT Presentation

Transcript of Persisting and unit testing objects and their relationships with tiOPF & DUnit2

Page 1: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

Peter HinrichsenTechInsite Pty Ltd

www.techinsite.com.au

Persisting and unit testing objects and their relationships with tiOPF & DUnit2

Page 2: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Topics

Demo

Object model and database structure

Examples in code

Business object model

Unit tests

User interface

Questions and discussion

Page 3: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

User interface – Command box

Page 4: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

The business object model

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 5: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

UI – BOM - Database

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 6: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Modal form based UI

Page 7: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Modal form based UI

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 8: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Add persistence to an XML flat file

- <table table_name="person">- <fields>   <field field_name="oid" field_kind="string" field_Size="36" />   <field field_name="first_name" field_kind="string" field_Size="60" />   <field field_name="last_name" field_kind="string" field_Size="60" />   </fields>- <rows>  <row oid=“..1" first_name="Ray" last_name="Konopka" title="Mr"/>   <row oid=“..2" first_name="Glenn" last_name="Crouch" title="Mr"/>   <row oid=“..3" first_name="Malcolm" last_name="Groves" title="Mr"/>   </rows>  </table>

Page 9: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Add persistence to an XML flat file

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 10: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Add persistence over the internet

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 11: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Add a web based client

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 12: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Unit tests are the starting point

TPersonList +Title+FirstName+LastName+Initials

TPerson

1 0..*

Page 13: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Code example

Building the BOM

TPersonList TPerson

1 0..*

TtiObjectList TtiObject

Page 14: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Code example

Building the BOM

Persisting to SQL & non SQL database

using tiOPF-Automap

Unit test

A robust unit test methodology for object persistence

Page 15: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Code example

Building the BOM

Persisting to SQL & non SQL database using tiOPF-

Automap

Unit test

A robust unit test methodology for object persistence

Page 16: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Code example

Building the BOM

Persisting to SQL & non SQL database using tiOPF-

Automap

Unit test

A robust unit test methodology for object persistence

Page 17: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Key points

Each developer (and the build server) requires a

database instance. This can be a challenge in large

corporates with a DBA department;

Require a rapid means of emptying and setting up the

database;

Page 18: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Key points

Persistence unit tests are written in the order:

Read, Create, Update, Delete

With each test depending on previously tested code;

Group these under TtiTestSetup

Allow two hours to write each class, persistence code

and unit test (simple classes).

Page 19: Persisting and unit testing objects and their relationships with tiOPF & DUnit2

www.tiopf.com

Source code on the web

The source from this presentation, and the

latest version of the documentation

can be found at:

www.tiopf.com

Peter [email protected]