This Presentation Courtesy of the
                              International SOA Symposium
                              ...
Tests, Testing and Testability




                                     Design & 
                                     dis...
A Map of the Territories: From What to How


                       Why?
    Who?                                         ...
(Behaviour‐Driven Development) Stories


Outside‐in
                As an rolee Man
                               Outcome...
Contracts




        Consumer‐Driven 
        Contract                                                               Desi...
Schematron
<?xml version="1.0" encoding="utf-8" ?>
<schema xmlns="http://www.ascc.net/xml/schematron">                    ...
Validating XML

 ArtistUpdated [http://example.com/notifications]
     Artist[http://example.com/artist]
         GlobalAr...
Validating YAML

 ArtistUpdated [http://example.com/notifications]
     Artist[http://example.com/artist]
         GlobalA...
Validating Forms

 ArtistUpdated [http://example.com/notifications]
     Artist[http://example.com/artist]
         Global...
Generating Consumer‐Driven Contracts

  ArtistUpdated
      Artist
          GlobalArtistCode : int
          ChangedDate ...
Summary

• How do we get started?
   – Iteratively fill out map of the territories
• 4 core artefacts:
   – Stories
   – C...
Thank you




http://iansrobinson.com
Upcoming SlideShare
Loading in …5
×

Ian Robinson Testable Foundations

306 views
257 views

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
306
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ian Robinson Testable Foundations

  1. 1. This Presentation Courtesy of the International SOA Symposium October 7-8, 2008 Amsterdam Arena www.soasymposium.com info@soasymposium.com Founding Sponsors Platinum Sponsors Gold Sponsors Silver Sponsors Testable Foundations for Service‐Oriented  Development Ian Robinson http://iansrobinson.com
  2. 2. Tests, Testing and Testability Design &  discovery Tests Asserted  behaviour Micro Alignment Stories Business‐IT  Alignment Tests
  3. 3. A Map of the Territories: From What to How Why? Who? What? How? What? Benefits Stakeholders Processes provide want deliver Capabilities realise host Outcomes Services motivate prevent implement Forces Technologies Obstacles Stories, Capabilities, Services and Contracts Stories Capabilities Describe goals  Resources to  & outcomes realise  outcomes Contracts Services Assert  interactions  Host  between  capabilities services
  4. 4. (Behaviour‐Driven Development) Stories Outside‐in As an rolee Man Outcomes  < Ord r > agemen I want <felfill orders bast service to fu a offer current ture> ed on  So that <cbn m ings I  a eneet ex ef ct> mer  i usto pectations Value  efficiently   External  behaviour Capabilities Resources People Processes Technology Capabilities Outcomes Stable Processes Technology What not How change changes
  5. 5. Contracts Consumer‐Driven  Contract Design Consumer  Adopt Contract Communicate (Validate according to…) (Use according to…) Execute Produce Consume XmlUnit public class ArtistUpdatedTestCase extends XMLTestCase { ... protected String xml; public void testXPaths() throws Exception { assertXpathExists("/n:ArtistUpdated", xml); assertXpathExists("/n:ArtistUpdated/a:Artist", xml); assertXpathExists("/n:ArtistUpdated/a:Artist/a:GlobalArtistCode", xml); assertXpathExists("/n:ArtistUpdated/a:Artist/a:DefaultName", xml); assertXpathExists("/n:ArtistUpdated/a:Artist/a:MainRepertoireOwnerCompany", xml); assertXpathExists("/n:ArtistUpdated/a:Artist/a:MainRepertoireOwnerCompany/" + "s:OperatingCompanyCode", xml); assertXpathExists("/n:ArtistUpdated/a:Artist/a:MainRepertoireOwnerCompany/" + "s:Name", xml); assertXpathExists("/n:ArtistUpdated/a:Artist/a:ChangedDate", xml); } }
  6. 6. Schematron <?xml version="1.0" encoding="utf-8" ?> <schema xmlns="http://www.ascc.net/xml/schematron"> XML XML <title>ArtistUpdated Contract</title> <ns uri="http://example.com/notifications" prefix="n"/> <ns uri="http://example.com/artist" prefix="a"/> <ns uri="http://example.com/sharedtypes" prefix="s"/> <phase id="validateStructure"> <active pattern="structure"/> </phase> Schematron  Intermediate  <pattern name="Validate structure" id="structure"> Schematron  Intermediate  XSLT XSLT rules <rule context="/"> rules transform transform <assert test="n:ArtistUpdated"/> </rule> <rule context="n:ArtistUpdated"> <assert test="a:Artist"/> </rule> <rule context="n:ArtistUpdated/a:Artist"> <assert test="a:GlobalArtistCode"/> <assert test="a:DefaultName"/> <assert test="a:MainRepertoireOwnerCompany"/> <assert test="a:ChangedDate"/> </rule> <rule context="n:ArtistUpdated/a:Artist/a:MainRepertoireOwnerCompany"> <assert test="s:OperatingCompanyCode"/> Results <assert test="s:Name"/> Results </rule> </pattern> </schema> An External DSL for Consumer Contracts Declarative ArtistUpdated [http://example.com/notifications] Artist[http://example.com/artist] GlobalArtistCode : int DefaultName : string MainRepertoireOwnerCompany : companyType (0..1) ChangedDate : datetime Company[http://example.com/company] id(companyType) OperatingCompanyCode : string Name : string What not How
  7. 7. Validating XML ArtistUpdated [http://example.com/notifications] Artist[http://example.com/artist] GlobalArtistCode : int DefaultName : string MainRepertoireOwnerCompany : companyType (0..1) ChangedDate : datetime Company[http://example.com/company] id(companyType) OperatingCompanyCode : string Name : string <ArtistUpdated xmlns="http://example.com/notifications"> <Artist xmlns="http://example.com/artist"> <GlobalArtistCode>13570</GlobalArtistCode> <DefaultName>Tom Waits</DefaultName> <MainRepertoireOwnerCompany xmlns:c="xmlns="http://example.com/company"> <c:OperatingCompanyCode>HF32L</c:OperatingCompanyCode> <c:Name>Mercury Records Ltd</c:Name> </MainRepertoireOwnerCompany> <ChangedDate>2008-09-10T13:57:14+01:00</ChangedDate> ... </Artist> <ArtistUpdated> Validating JSON ArtistUpdated [http://example.com/notifications] Artist[http://example.com/artist] GlobalArtistCode : int DefaultName : string MainRepertoireOwnerCompany : companyType (0..1) ChangedDate : datetime Company[http://example.com/company] id(companyType) OperatingCompanyCode : string Name : string { "ArtistUpdated": { "Artist": { "GlobalArtistCode": 13570, "DefaultName": "Tom Waits", "MainRepertoireOwnerCompany": { "OperatingCompanyCode": "HF32L", "Name": "Mercury Records Ltd", }, "ChangedDate": "2008-09-10T13:57:14+01:00" } } }
  8. 8. Validating YAML ArtistUpdated [http://example.com/notifications] Artist[http://example.com/artist] GlobalArtistCode : int DefaultName : string MainRepertoireOwnerCompany : companyType (0..1) ChangedDate : datetime Company[http://example.com/company] id(companyType) OperatingCompanyCode : string Name : string ArtistUpdated: Artist: GlobalArtistCode: 13570 DefaultName: Tom Waits MainRepertoireOwnerCompany: OperatingCompanyCode: HF32L Name: Mercury Records Ltd ChangedDate: 2008-09-10T13:57:14+01:00 Transformations Validator Validator ArtistUpdated [http://example.com/notifications] Artist[http://example.com/artist] GlobalArtistCode : int DefaultName : string MainRepertoireOwnerCompany : companyType (0..1) Contract ChangedDate : datetime Contract AST AST Serializer Serializer Company[http://example.com/company] id(companyType) OperatingCompanyCode : string Name : string Graph Graph
  9. 9. Validating Forms ArtistUpdated [http://example.com/notifications] Artist[http://example.com/artist] GlobalArtistCode : int DefaultName : string MainRepertoireOwnerCompany : companyType (0..1) ChangedDate : datetime Company[http://example.com/company] id(companyType) OperatingCompanyCode : string Name : string POST /notifications HTTP/1.1 Host: example.com Content-Type: application/x-www-form-urlencoded Content-Length: 301 ArtistUpdated_Artist_GlobalArtistCode=13570&ArtistUpdated_Artist_DefaultName=Tom+W aits&ArtistUpdated_Artist_MainRepertoireOwnerCompany_OperatingCompanyCode=HF32L&Ar tistUpdated_Artist_MainRepertoireOwnerCompany_Name=Mercury+Records+Ltd&ArtistUpdat ed_Artist_ChangedDate=2008-09-10T13%3A57%3A14%2B01%3A00 Social Networks for Contracts Product Catalog Product Catalog Warehouse Warehouse Marketing Marketing offers offers expects expects expects expects Name = ArtistUpdated Name = ArtistUpdated expects expects expects expects has has expects expects expects expects expects expects expects expects Name = Artist Name = Artist has has has has has Name = GlobalArtistCode Name = GlobalArtistCode Name = ChangedDate Name = ChangedDate Name = DefaultName Name = DefaultName Type = int Type = int Type = datetime Type = datetime Type = string Type = string
  10. 10. Generating Consumer‐Driven Contracts ArtistUpdated Artist GlobalArtistCode : int ChangedDate : datetime ArtistUpdated Artist GlobalArtistCode : int DefaultName : string ChangedDate : datetime ArtistUpdated Artist DefaultName : string ChangedDate : datetime Services Share Contract, Not Type Graph Contract Contract Graph Consumer‐Driven  Contract Design Consumer  Contract Validator Validator Serializer Serializer Execute Produce Consume
  11. 11. Summary • How do we get started? – Iteratively fill out map of the territories • 4 core artefacts: – Stories – Capabilities – Services – Contracts • Consumer and consumer‐driven contracts: – Tests exchanged between teams – DSL for consumer contracts Consumer‐Driven Contracts • http://www.martinfowler.com/articles/consumerDrivenCon tracts.html • http://www.infoq.com/articles/consumer‐driven‐contracts • http://iansrobinson.com/
  12. 12. Thank you http://iansrobinson.com

×