├── acceptance-testing.iml ├── build.gradle ├── build ├── classes │ ├── java │ │ ├── main │ │ │ └── com │ │ │ │ └── cd │ │ │ │ └── acceptance │ │ │ │ └── examples │ │ │ │ ├── accounting │ │ │ │ ├── DummyAccountingSUT.class │ │ │ │ ├── ExternalKYCCheck.class │ │ │ │ ├── Invoice.class │ │ │ │ ├── SubmittedInvoice.class │ │ │ │ ├── User.class │ │ │ │ ├── UserAccessDeniedException.class │ │ │ │ └── UserRole.class │ │ │ │ └── bookshopping │ │ │ │ ├── Book.class │ │ │ │ └── MyLocalBookStore.class │ │ └── test │ │ │ ├── com │ │ │ └── cd │ │ │ │ └── acceptance │ │ │ │ ├── dsl │ │ │ │ ├── Card.class │ │ │ │ ├── ParamsTest.class │ │ │ │ └── utils │ │ │ │ │ ├── Channel.class │ │ │ │ │ ├── ChannelFinder.class │ │ │ │ │ ├── Channels.class │ │ │ │ │ ├── Params$DslContext.class │ │ │ │ │ ├── Params.class │ │ │ │ │ └── PollWithTimeOut.class │ │ │ │ └── examples │ │ │ │ ├── accounting │ │ │ │ ├── InvoiceSubmissionAcceptanceTest.class │ │ │ │ ├── drivers │ │ │ │ │ ├── AccountingSystemProtocolDriver.class │ │ │ │ │ ├── DummyAccountingSystemProtocolDriver.class │ │ │ │ │ └── StubExternalKYCCheck.class │ │ │ │ └── dsl │ │ │ │ │ ├── Dsl$AccountApproval.class │ │ │ │ │ ├── Dsl.class │ │ │ │ │ └── InvoicesDsl.class │ │ │ │ ├── bookshopping │ │ │ │ ├── BookShopDriver.class │ │ │ │ ├── BookShopDrivers.class │ │ │ │ ├── BookShoppingDsl.class │ │ │ │ ├── CucumberDsl.class │ │ │ │ ├── Dsl.class │ │ │ │ ├── ExampleAmazonAcceptanceTest.class │ │ │ │ ├── ExampleBookStoreAcceptanceTest.class │ │ │ │ ├── ExampleMyLocalBookStoreAcceptanceTest.class │ │ │ │ └── drivers │ │ │ │ │ ├── AmazonBookShopDriver.class │ │ │ │ │ ├── BookDepositoryBookShopDriver.class │ │ │ │ │ ├── BookShopDrivers.class │ │ │ │ │ └── MyLocalBookStoreBookShopDriver.class │ │ │ │ └── stubdemo │ │ │ │ ├── StubDemonstrationAcceptanceTest.class │ │ │ │ ├── drivers │ │ │ │ ├── AccountingSystemProtocolDriver.class │ │ │ │ ├── DummyAccountingSystemProtocolDriver.class │ │ │ │ ├── KYCCheckProtocolDriver.class │ │ │ │ └── StubExternalKYCCheck.class │ │ │ │ └── dsl │ │ │ │ ├── AccountRegistrationDsl.class │ │ │ │ ├── Dsl.class │ │ │ │ └── InvoicesDsl.class │ │ │ └── feature │ │ │ ├── AddBookToBasketSteps.class │ │ │ └── AddBookToBasketTest.class │ ├── main │ │ └── com │ │ │ └── cd │ │ │ └── acceptance │ │ │ └── examples │ │ │ ├── Book.class │ │ │ └── MyLocalBookStore.class │ └── test │ │ ├── com │ │ └── cd │ │ │ └── acceptance │ │ │ ├── dsl │ │ │ ├── BookShoppingDsl.class │ │ │ ├── Channel.class │ │ │ ├── Channels.class │ │ │ ├── CucumberDsl.class │ │ │ ├── Dsl.class │ │ │ ├── Params.class │ │ │ ├── TestAnnotationFinderTest.class │ │ │ └── drivers │ │ │ │ ├── AmazonBookShopDriver.class │ │ │ │ ├── BookDepositoryBookShopDriver.class │ │ │ │ ├── BookShopDriver.class │ │ │ │ ├── BookShopDrivers.class │ │ │ │ ├── ChannelFinder.class │ │ │ │ └── MyLocalBookStoreBookShopDriver.class │ │ │ ├── examples │ │ │ ├── ExampleAmazonAcceptanceTest.class │ │ │ ├── ExampleBookStoreAcceptanceTest.class │ │ │ └── ExampleMyLocalBookStoreAcceptanceTest.class │ │ │ └── utils │ │ │ └── PollWithTimeOut.class │ │ └── feature │ │ ├── AddBookToBasketSteps.class │ │ └── AddBookToBasketTest.class ├── libs │ └── acceptance-testing-1.0.jar ├── reports │ └── tests │ │ └── test │ │ ├── classes │ │ └── com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest.html │ │ ├── css │ │ ├── base-style.css │ │ └── style.css │ │ ├── index.html │ │ ├── js │ │ └── report.js │ │ └── packages │ │ └── com.cd.acceptance.examples.bookshopping.html ├── resources │ └── test │ │ └── feature │ │ └── OrderBook.feature ├── test-results │ └── test │ │ ├── TEST-com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest.xml │ │ └── binary │ │ ├── output.bin │ │ ├── output.bin.idx │ │ └── results.bin └── tmp │ ├── jar │ └── MANIFEST.MF │ └── test │ ├── jar_extract_1048083030857714788_tmp │ ├── jar_extract_1159399572669467194_tmp │ ├── jar_extract_1166224236138320668_tmp │ ├── jar_extract_1306031345043704182_tmp │ ├── jar_extract_1652157456513910046_tmp │ ├── jar_extract_1656904070061580563_tmp │ ├── jar_extract_167745781231496235_tmp │ ├── jar_extract_1752691090693611332_tmp │ ├── jar_extract_1937301074287776387_tmp │ ├── jar_extract_2023717721979116341_tmp │ ├── jar_extract_2636985862052516286_tmp │ ├── jar_extract_2847505292665439170_tmp │ ├── jar_extract_2854018412965560934_tmp │ ├── jar_extract_2874308182973609280_tmp │ ├── jar_extract_2908211348054790206_tmp │ ├── jar_extract_3390195103300879005_tmp │ ├── jar_extract_355985686393018443_tmp │ ├── jar_extract_4157699181802622881_tmp │ ├── jar_extract_4485455956454253177_tmp │ ├── jar_extract_4813342041175929104_tmp │ ├── jar_extract_5007538170225049517_tmp │ ├── jar_extract_5049754333185260579_tmp │ ├── jar_extract_5151904991086119828_tmp │ ├── jar_extract_5261985293551022499_tmp │ ├── jar_extract_529986652090348612_tmp │ ├── jar_extract_535686333318735112_tmp │ ├── jar_extract_5399139465269860643_tmp │ ├── jar_extract_5424206296747912892_tmp │ ├── jar_extract_5490544698340168624_tmp │ ├── jar_extract_5572329297531721924_tmp │ ├── jar_extract_5600577061199650579_tmp │ ├── jar_extract_5603300587476173754_tmp │ ├── jar_extract_5820275438480345844_tmp │ ├── jar_extract_5976055674371755419_tmp │ ├── jar_extract_6060056173045836363_tmp │ ├── jar_extract_6106972373212129937_tmp │ ├── jar_extract_6108057837579097630_tmp │ ├── jar_extract_6145905544629802660_tmp │ ├── jar_extract_6275608373987838249_tmp │ ├── jar_extract_6307777218133280536_tmp │ ├── jar_extract_6358970988792600090_tmp │ ├── jar_extract_6534304427224174449_tmp │ ├── jar_extract_6620687105125395297_tmp │ ├── jar_extract_665828278335233042_tmp │ ├── jar_extract_6687040518628022292_tmp │ ├── jar_extract_6777077274901724631_tmp │ ├── jar_extract_6888168034936702300_tmp │ ├── jar_extract_7091853949137508230_tmp │ ├── jar_extract_7252101521626156540_tmp │ ├── jar_extract_7419535414187010479_tmp │ ├── jar_extract_7476747305875884133_tmp │ ├── jar_extract_7484490375568007393_tmp │ ├── jar_extract_7503055758221915479_tmp │ ├── jar_extract_7507497258809787969_tmp │ ├── jar_extract_7640495213220734500_tmp │ ├── jar_extract_7849792192051827728_tmp │ ├── jar_extract_7884059679965255776_tmp │ ├── jar_extract_7930000048954739293_tmp │ ├── jar_extract_8126636214595506259_tmp │ ├── jar_extract_8145343503676732357_tmp │ ├── jar_extract_8210319304660288336_tmp │ ├── jar_extract_8247543427891190330_tmp │ ├── jar_extract_8371636306610568200_tmp │ ├── jar_extract_8533033846260479465_tmp │ ├── jar_extract_8930736551108474841_tmp │ └── jar_extract_9184184750065989451_tmp ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main └── java │ └── com │ └── cd │ └── acceptance │ └── examples │ ├── accounting │ ├── DummyAccountingSUT.java │ ├── ExternalKYCCheck.java │ ├── Invoice.java │ ├── SubmittedInvoice.java │ ├── User.java │ ├── UserAccessDeniedException.java │ └── UserRole.java │ └── bookshopping │ ├── Book.java │ └── MyLocalBookStore.java └── test ├── java ├── com │ └── cd │ │ └── acceptance │ │ ├── dsl │ │ └── utils │ │ │ ├── Channel.java │ │ │ ├── ChannelFinder.java │ │ │ ├── ChannelFinderTest.java │ │ │ ├── Channels.java │ │ │ ├── Params.java │ │ │ ├── ParamsTest.java │ │ │ └── PollWithTimeOut.java │ │ └── examples │ │ ├── accounting │ │ ├── InvoiceSubmissionAcceptanceTest.java │ │ ├── drivers │ │ │ ├── AccountingSystemProtocolDriver.java │ │ │ ├── DummyAccountingSystemProtocolDriver.java │ │ │ └── StubExternalKYCCheck.java │ │ └── dsl │ │ │ ├── Dsl.java │ │ │ └── InvoicesDsl.java │ │ ├── bookshopping │ │ ├── BookShopDriver.java │ │ ├── BookShopDrivers.java │ │ ├── BookShoppingDsl.java │ │ ├── Card.java │ │ ├── CucumberDsl.java │ │ ├── Dsl.java │ │ ├── ExampleAmazonAcceptanceTest.java │ │ ├── ExampleBookStoreAcceptanceTest.java │ │ ├── ExampleMyLocalBookStoreAcceptanceTest.java │ │ └── drivers │ │ │ ├── AmazonBookShopDriver.java │ │ │ ├── BookDepositoryBookShopDriver.java │ │ │ ├── BookShopDrivers.java │ │ │ └── MyLocalBookStoreBookShopDriver.java │ │ └── stubdemo │ │ ├── StubDemonstrationAcceptanceTest.java │ │ ├── drivers │ │ ├── AccountingSystemProtocolDriver.java │ │ ├── DummyAccountingSystemProtocolDriver.java │ │ ├── KYCCheckProtocolDriver.java │ │ └── StubExternalKYCCheck.java │ │ └── dsl │ │ ├── AccountRegistrationDsl.java │ │ ├── Dsl.java │ │ └── InvoicesDsl.java └── feature │ ├── AddBookToBasketSteps.java │ └── AddBookToBasketTest.java └── resources └── feature └── OrderBook.feature /acceptance-testing.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | group 'cd' 2 | version '1.0' 3 | 4 | apply plugin: 'java' 5 | 6 | sourceCompatibility = 1.8 7 | 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | implementation 'junit:junit:4.13.1' 14 | testCompile group: 'junit', name: 'junit', version: '4.12' 15 | testCompile group: 'org.seleniumhq.selenium.client-drivers', name: 'selenium-java-client-driver', version: '1.0.2' 16 | testCompile group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '3.0.1' 17 | 18 | compile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5' 19 | compile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5' 20 | } 21 | -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/DummyAccountingSUT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/DummyAccountingSUT.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/ExternalKYCCheck.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/ExternalKYCCheck.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/Invoice.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/Invoice.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/SubmittedInvoice.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/SubmittedInvoice.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/User.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/UserAccessDeniedException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/UserAccessDeniedException.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/accounting/UserRole.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/accounting/UserRole.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/bookshopping/Book.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/bookshopping/Book.class -------------------------------------------------------------------------------- /build/classes/java/main/com/cd/acceptance/examples/bookshopping/MyLocalBookStore.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/main/com/cd/acceptance/examples/bookshopping/MyLocalBookStore.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/Card.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/Card.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/ParamsTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/ParamsTest.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/utils/Channel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/utils/Channel.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/utils/ChannelFinder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/utils/ChannelFinder.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/utils/Channels.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/utils/Channels.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/utils/Params$DslContext.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/utils/Params$DslContext.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/utils/Params.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/utils/Params.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/dsl/utils/PollWithTimeOut.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/dsl/utils/PollWithTimeOut.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/InvoiceSubmissionAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/InvoiceSubmissionAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/drivers/AccountingSystemProtocolDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/drivers/AccountingSystemProtocolDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/drivers/DummyAccountingSystemProtocolDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/drivers/DummyAccountingSystemProtocolDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/drivers/StubExternalKYCCheck.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/drivers/StubExternalKYCCheck.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/dsl/Dsl$AccountApproval.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/dsl/Dsl$AccountApproval.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/dsl/Dsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/dsl/Dsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/accounting/dsl/InvoicesDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/accounting/dsl/InvoicesDsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/BookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/BookShopDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/BookShopDrivers.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/BookShopDrivers.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/BookShoppingDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/BookShoppingDsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/CucumberDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/CucumberDsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/Dsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/Dsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/ExampleAmazonAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/ExampleAmazonAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/ExampleBookStoreAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/ExampleBookStoreAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/ExampleMyLocalBookStoreAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/ExampleMyLocalBookStoreAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/AmazonBookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/AmazonBookShopDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/BookDepositoryBookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/BookDepositoryBookShopDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/BookShopDrivers.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/BookShopDrivers.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/MyLocalBookStoreBookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/bookshopping/drivers/MyLocalBookStoreBookShopDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/StubDemonstrationAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/StubDemonstrationAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/AccountingSystemProtocolDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/AccountingSystemProtocolDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/DummyAccountingSystemProtocolDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/DummyAccountingSystemProtocolDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/KYCCheckProtocolDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/KYCCheckProtocolDriver.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/StubExternalKYCCheck.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/drivers/StubExternalKYCCheck.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/dsl/AccountRegistrationDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/dsl/AccountRegistrationDsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/dsl/Dsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/dsl/Dsl.class -------------------------------------------------------------------------------- /build/classes/java/test/com/cd/acceptance/examples/stubdemo/dsl/InvoicesDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/com/cd/acceptance/examples/stubdemo/dsl/InvoicesDsl.class -------------------------------------------------------------------------------- /build/classes/java/test/feature/AddBookToBasketSteps.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/feature/AddBookToBasketSteps.class -------------------------------------------------------------------------------- /build/classes/java/test/feature/AddBookToBasketTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/java/test/feature/AddBookToBasketTest.class -------------------------------------------------------------------------------- /build/classes/main/com/cd/acceptance/examples/Book.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/main/com/cd/acceptance/examples/Book.class -------------------------------------------------------------------------------- /build/classes/main/com/cd/acceptance/examples/MyLocalBookStore.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/main/com/cd/acceptance/examples/MyLocalBookStore.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/BookShoppingDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/BookShoppingDsl.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/Channel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/Channel.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/Channels.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/Channels.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/CucumberDsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/CucumberDsl.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/Dsl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/Dsl.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/Params.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/Params.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/TestAnnotationFinderTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/TestAnnotationFinderTest.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/drivers/AmazonBookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/drivers/AmazonBookShopDriver.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/drivers/BookDepositoryBookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/drivers/BookDepositoryBookShopDriver.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/drivers/BookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/drivers/BookShopDriver.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/drivers/BookShopDrivers.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/drivers/BookShopDrivers.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/drivers/ChannelFinder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/drivers/ChannelFinder.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/dsl/drivers/MyLocalBookStoreBookShopDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/dsl/drivers/MyLocalBookStoreBookShopDriver.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/examples/ExampleAmazonAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/examples/ExampleAmazonAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/examples/ExampleBookStoreAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/examples/ExampleBookStoreAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/examples/ExampleMyLocalBookStoreAcceptanceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/examples/ExampleMyLocalBookStoreAcceptanceTest.class -------------------------------------------------------------------------------- /build/classes/test/com/cd/acceptance/utils/PollWithTimeOut.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/com/cd/acceptance/utils/PollWithTimeOut.class -------------------------------------------------------------------------------- /build/classes/test/feature/AddBookToBasketSteps.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/feature/AddBookToBasketSteps.class -------------------------------------------------------------------------------- /build/classes/test/feature/AddBookToBasketTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/classes/test/feature/AddBookToBasketTest.class -------------------------------------------------------------------------------- /build/libs/acceptance-testing-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/libs/acceptance-testing-1.0.jar -------------------------------------------------------------------------------- /build/reports/tests/test/classes/com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test results - Class com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest 7 | 8 | 9 | 10 | 11 | 12 |
13 |

Class com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest

14 | 17 |
18 | 19 | 20 | 52 | 58 | 59 |
21 |
22 | 23 | 24 | 30 | 36 | 42 | 48 | 49 |
25 |
26 |
1
27 |

tests

28 |
29 |
31 |
32 |
0
33 |

failures

34 |
35 |
37 |
38 |
0
39 |

ignored

40 |
41 |
43 |
44 |
0.013s
45 |

duration

46 |
47 |
50 |
51 |
53 |
54 |
100%
55 |

successful

56 |
57 |
60 |
61 |
62 | 67 |
68 |

Tests

69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
TestDurationResult
shouldAddBookToShoppingBasket0.013spassed
83 |
84 |
85 | 94 |
95 | 96 | 97 | -------------------------------------------------------------------------------- /build/reports/tests/test/css/base-style.css: -------------------------------------------------------------------------------- 1 | 2 | body { 3 | margin: 0; 4 | padding: 0; 5 | font-family: sans-serif; 6 | font-size: 12pt; 7 | } 8 | 9 | body, a, a:visited { 10 | color: #303030; 11 | } 12 | 13 | #content { 14 | padding-left: 50px; 15 | padding-right: 50px; 16 | padding-top: 30px; 17 | padding-bottom: 30px; 18 | } 19 | 20 | #content h1 { 21 | font-size: 160%; 22 | margin-bottom: 10px; 23 | } 24 | 25 | #footer { 26 | margin-top: 100px; 27 | font-size: 80%; 28 | white-space: nowrap; 29 | } 30 | 31 | #footer, #footer a { 32 | color: #a0a0a0; 33 | } 34 | 35 | #line-wrapping-toggle { 36 | vertical-align: middle; 37 | } 38 | 39 | #label-for-line-wrapping-toggle { 40 | vertical-align: middle; 41 | } 42 | 43 | ul { 44 | margin-left: 0; 45 | } 46 | 47 | h1, h2, h3 { 48 | white-space: nowrap; 49 | } 50 | 51 | h2 { 52 | font-size: 120%; 53 | } 54 | 55 | ul.tabLinks { 56 | padding-left: 0; 57 | padding-top: 10px; 58 | padding-bottom: 10px; 59 | overflow: auto; 60 | min-width: 800px; 61 | width: auto !important; 62 | width: 800px; 63 | } 64 | 65 | ul.tabLinks li { 66 | float: left; 67 | height: 100%; 68 | list-style: none; 69 | padding-left: 10px; 70 | padding-right: 10px; 71 | padding-top: 5px; 72 | padding-bottom: 5px; 73 | margin-bottom: 0; 74 | -moz-border-radius: 7px; 75 | border-radius: 7px; 76 | margin-right: 25px; 77 | border: solid 1px #d4d4d4; 78 | background-color: #f0f0f0; 79 | } 80 | 81 | ul.tabLinks li:hover { 82 | background-color: #fafafa; 83 | } 84 | 85 | ul.tabLinks li.selected { 86 | background-color: #c5f0f5; 87 | border-color: #c5f0f5; 88 | } 89 | 90 | ul.tabLinks a { 91 | font-size: 120%; 92 | display: block; 93 | outline: none; 94 | text-decoration: none; 95 | margin: 0; 96 | padding: 0; 97 | } 98 | 99 | ul.tabLinks li h2 { 100 | margin: 0; 101 | padding: 0; 102 | } 103 | 104 | div.tab { 105 | } 106 | 107 | div.selected { 108 | display: block; 109 | } 110 | 111 | div.deselected { 112 | display: none; 113 | } 114 | 115 | div.tab table { 116 | min-width: 350px; 117 | width: auto !important; 118 | width: 350px; 119 | border-collapse: collapse; 120 | } 121 | 122 | div.tab th, div.tab table { 123 | border-bottom: solid #d0d0d0 1px; 124 | } 125 | 126 | div.tab th { 127 | text-align: left; 128 | white-space: nowrap; 129 | padding-left: 6em; 130 | } 131 | 132 | div.tab th:first-child { 133 | padding-left: 0; 134 | } 135 | 136 | div.tab td { 137 | white-space: nowrap; 138 | padding-left: 6em; 139 | padding-top: 5px; 140 | padding-bottom: 5px; 141 | } 142 | 143 | div.tab td:first-child { 144 | padding-left: 0; 145 | } 146 | 147 | div.tab td.numeric, div.tab th.numeric { 148 | text-align: right; 149 | } 150 | 151 | span.code { 152 | display: inline-block; 153 | margin-top: 0em; 154 | margin-bottom: 1em; 155 | } 156 | 157 | span.code pre { 158 | font-size: 11pt; 159 | padding-top: 10px; 160 | padding-bottom: 10px; 161 | padding-left: 10px; 162 | padding-right: 10px; 163 | margin: 0; 164 | background-color: #f7f7f7; 165 | border: solid 1px #d0d0d0; 166 | min-width: 700px; 167 | width: auto !important; 168 | width: 700px; 169 | } 170 | 171 | span.wrapped pre { 172 | word-wrap: break-word; 173 | white-space: pre-wrap; 174 | word-break: break-all; 175 | } 176 | 177 | label.hidden { 178 | display: none; 179 | } -------------------------------------------------------------------------------- /build/reports/tests/test/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | #summary { 3 | margin-top: 30px; 4 | margin-bottom: 40px; 5 | } 6 | 7 | #summary table { 8 | border-collapse: collapse; 9 | } 10 | 11 | #summary td { 12 | vertical-align: top; 13 | } 14 | 15 | .breadcrumbs, .breadcrumbs a { 16 | color: #606060; 17 | } 18 | 19 | .infoBox { 20 | width: 110px; 21 | padding-top: 15px; 22 | padding-bottom: 15px; 23 | text-align: center; 24 | } 25 | 26 | .infoBox p { 27 | margin: 0; 28 | } 29 | 30 | .counter, .percent { 31 | font-size: 120%; 32 | font-weight: bold; 33 | margin-bottom: 8px; 34 | } 35 | 36 | #duration { 37 | width: 125px; 38 | } 39 | 40 | #successRate, .summaryGroup { 41 | border: solid 2px #d0d0d0; 42 | -moz-border-radius: 10px; 43 | border-radius: 10px; 44 | } 45 | 46 | #successRate { 47 | width: 140px; 48 | margin-left: 35px; 49 | } 50 | 51 | #successRate .percent { 52 | font-size: 180%; 53 | } 54 | 55 | .success, .success a { 56 | color: #008000; 57 | } 58 | 59 | div.success, #successRate.success { 60 | background-color: #bbd9bb; 61 | border-color: #008000; 62 | } 63 | 64 | .failures, .failures a { 65 | color: #b60808; 66 | } 67 | 68 | .skipped, .skipped a { 69 | color: #c09853; 70 | } 71 | 72 | div.failures, #successRate.failures { 73 | background-color: #ecdada; 74 | border-color: #b60808; 75 | } 76 | 77 | ul.linkList { 78 | padding-left: 0; 79 | } 80 | 81 | ul.linkList li { 82 | list-style: none; 83 | margin-bottom: 5px; 84 | } 85 | -------------------------------------------------------------------------------- /build/reports/tests/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test results - Test Summary 7 | 8 | 9 | 10 | 11 | 12 |
13 |

Test Summary

14 |
15 | 16 | 17 | 49 | 55 | 56 |
18 |
19 | 20 | 21 | 27 | 33 | 39 | 45 | 46 |
22 |
23 |
1
24 |

tests

25 |
26 |
28 |
29 |
0
30 |

failures

31 |
32 |
34 |
35 |
0
36 |

ignored

37 |
38 |
40 |
41 |
0.013s
42 |

duration

43 |
44 |
47 |
48 |
50 |
51 |
100%
52 |

successful

53 |
54 |
57 |
58 |
59 | 67 |
68 |

Packages

69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
PackageTestsFailuresIgnoredDurationSuccess rate
83 | com.cd.acceptance.examples.bookshopping 84 | 1000.013s100%
93 |
94 |
95 |

Classes

96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
ClassTestsFailuresIgnoredDurationSuccess rate
110 | com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest 111 | 1000.013s100%
119 |
120 |
121 | 130 |
131 | 132 | 133 | -------------------------------------------------------------------------------- /build/reports/tests/test/js/report.js: -------------------------------------------------------------------------------- 1 | (function (window, document) { 2 | "use strict"; 3 | 4 | var tabs = {}; 5 | 6 | function changeElementClass(element, classValue) { 7 | if (element.getAttribute("className")) { 8 | element.setAttribute("className", classValue); 9 | } else { 10 | element.setAttribute("class", classValue); 11 | } 12 | } 13 | 14 | function getClassAttribute(element) { 15 | if (element.getAttribute("className")) { 16 | return element.getAttribute("className"); 17 | } else { 18 | return element.getAttribute("class"); 19 | } 20 | } 21 | 22 | function addClass(element, classValue) { 23 | changeElementClass(element, getClassAttribute(element) + " " + classValue); 24 | } 25 | 26 | function removeClass(element, classValue) { 27 | changeElementClass(element, getClassAttribute(element).replace(classValue, "")); 28 | } 29 | 30 | function initTabs() { 31 | var container = document.getElementById("tabs"); 32 | 33 | tabs.tabs = findTabs(container); 34 | tabs.titles = findTitles(tabs.tabs); 35 | tabs.headers = findHeaders(container); 36 | tabs.select = select; 37 | tabs.deselectAll = deselectAll; 38 | tabs.select(0); 39 | 40 | return true; 41 | } 42 | 43 | function getCheckBox() { 44 | return document.getElementById("line-wrapping-toggle"); 45 | } 46 | 47 | function getLabelForCheckBox() { 48 | return document.getElementById("label-for-line-wrapping-toggle"); 49 | } 50 | 51 | function findCodeBlocks() { 52 | var spans = document.getElementById("tabs").getElementsByTagName("span"); 53 | var codeBlocks = []; 54 | for (var i = 0; i < spans.length; ++i) { 55 | if (spans[i].className.indexOf("code") >= 0) { 56 | codeBlocks.push(spans[i]); 57 | } 58 | } 59 | return codeBlocks; 60 | } 61 | 62 | function forAllCodeBlocks(operation) { 63 | var codeBlocks = findCodeBlocks(); 64 | 65 | for (var i = 0; i < codeBlocks.length; ++i) { 66 | operation(codeBlocks[i], "wrapped"); 67 | } 68 | } 69 | 70 | function toggleLineWrapping() { 71 | var checkBox = getCheckBox(); 72 | 73 | if (checkBox.checked) { 74 | forAllCodeBlocks(addClass); 75 | } else { 76 | forAllCodeBlocks(removeClass); 77 | } 78 | } 79 | 80 | function initControls() { 81 | if (findCodeBlocks().length > 0) { 82 | var checkBox = getCheckBox(); 83 | var label = getLabelForCheckBox(); 84 | 85 | checkBox.onclick = toggleLineWrapping; 86 | checkBox.checked = false; 87 | 88 | removeClass(label, "hidden"); 89 | } 90 | } 91 | 92 | function switchTab() { 93 | var id = this.id.substr(1); 94 | 95 | for (var i = 0; i < tabs.tabs.length; i++) { 96 | if (tabs.tabs[i].id === id) { 97 | tabs.select(i); 98 | break; 99 | } 100 | } 101 | 102 | return false; 103 | } 104 | 105 | function select(i) { 106 | this.deselectAll(); 107 | 108 | changeElementClass(this.tabs[i], "tab selected"); 109 | changeElementClass(this.headers[i], "selected"); 110 | 111 | while (this.headers[i].firstChild) { 112 | this.headers[i].removeChild(this.headers[i].firstChild); 113 | } 114 | 115 | var h2 = document.createElement("H2"); 116 | 117 | h2.appendChild(document.createTextNode(this.titles[i])); 118 | this.headers[i].appendChild(h2); 119 | } 120 | 121 | function deselectAll() { 122 | for (var i = 0; i < this.tabs.length; i++) { 123 | changeElementClass(this.tabs[i], "tab deselected"); 124 | changeElementClass(this.headers[i], "deselected"); 125 | 126 | while (this.headers[i].firstChild) { 127 | this.headers[i].removeChild(this.headers[i].firstChild); 128 | } 129 | 130 | var a = document.createElement("A"); 131 | 132 | a.setAttribute("id", "ltab" + i); 133 | a.setAttribute("href", "#tab" + i); 134 | a.onclick = switchTab; 135 | a.appendChild(document.createTextNode(this.titles[i])); 136 | 137 | this.headers[i].appendChild(a); 138 | } 139 | } 140 | 141 | function findTabs(container) { 142 | return findChildElements(container, "DIV", "tab"); 143 | } 144 | 145 | function findHeaders(container) { 146 | var owner = findChildElements(container, "UL", "tabLinks"); 147 | return findChildElements(owner[0], "LI", null); 148 | } 149 | 150 | function findTitles(tabs) { 151 | var titles = []; 152 | 153 | for (var i = 0; i < tabs.length; i++) { 154 | var tab = tabs[i]; 155 | var header = findChildElements(tab, "H2", null)[0]; 156 | 157 | header.parentNode.removeChild(header); 158 | 159 | if (header.innerText) { 160 | titles.push(header.innerText); 161 | } else { 162 | titles.push(header.textContent); 163 | } 164 | } 165 | 166 | return titles; 167 | } 168 | 169 | function findChildElements(container, name, targetClass) { 170 | var elements = []; 171 | var children = container.childNodes; 172 | 173 | for (var i = 0; i < children.length; i++) { 174 | var child = children.item(i); 175 | 176 | if (child.nodeType === 1 && child.nodeName === name) { 177 | if (targetClass && child.className.indexOf(targetClass) < 0) { 178 | continue; 179 | } 180 | 181 | elements.push(child); 182 | } 183 | } 184 | 185 | return elements; 186 | } 187 | 188 | // Entry point. 189 | 190 | window.onload = function() { 191 | initTabs(); 192 | initControls(); 193 | }; 194 | } (window, window.document)); -------------------------------------------------------------------------------- /build/reports/tests/test/packages/com.cd.acceptance.examples.bookshopping.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test results - Package com.cd.acceptance.examples.bookshopping 7 | 8 | 9 | 10 | 11 | 12 |
13 |

Package com.cd.acceptance.examples.bookshopping

14 | 16 |
17 | 18 | 19 | 51 | 57 | 58 |
20 |
21 | 22 | 23 | 29 | 35 | 41 | 47 | 48 |
24 |
25 |
1
26 |

tests

27 |
28 |
30 |
31 |
0
32 |

failures

33 |
34 |
36 |
37 |
0
38 |

ignored

39 |
40 |
42 |
43 |
0.013s
44 |

duration

45 |
46 |
49 |
50 |
52 |
53 |
100%
54 |

successful

55 |
56 |
59 |
60 |
61 | 66 |
67 |

Classes

68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
ClassTestsFailuresIgnoredDurationSuccess rate
81 | ExampleMyLocalBookStoreAcceptanceTest 82 | 1000.013s100%
90 |
91 |
92 | 101 |
102 | 103 | 104 | -------------------------------------------------------------------------------- /build/resources/test/feature/OrderBook.feature: -------------------------------------------------------------------------------- 1 | Feature: Add Book to Shopping-Basket 2 | As a book-buyer 3 | I would like to select a book and add it to my shopping-basket 4 | So that I can pay for it later 5 | 6 | Scenario: 7 | Given I search for books about "Continuous Delivery" 8 | And I select a book by "David Farley" 9 | 10 | When I add my selected book to my shopping-basket 11 | 12 | Then I can see the book "Continuous Delivery" listed in my shopping-basket 13 | -------------------------------------------------------------------------------- /build/test-results/test/TEST-com.cd.acceptance.examples.bookshopping.ExampleMyLocalBookStoreAcceptanceTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/test-results/test/binary/output.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/test-results/test/binary/output.bin -------------------------------------------------------------------------------- /build/test-results/test/binary/output.bin.idx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /build/test-results/test/binary/results.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/test-results/test/binary/results.bin -------------------------------------------------------------------------------- /build/tmp/jar/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | 3 | -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1048083030857714788_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1048083030857714788_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1159399572669467194_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1159399572669467194_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1166224236138320668_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1166224236138320668_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1306031345043704182_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1306031345043704182_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1652157456513910046_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1652157456513910046_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1656904070061580563_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1656904070061580563_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_167745781231496235_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_167745781231496235_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1752691090693611332_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1752691090693611332_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_1937301074287776387_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_1937301074287776387_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_2023717721979116341_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_2023717721979116341_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_2636985862052516286_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_2636985862052516286_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_2847505292665439170_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_2847505292665439170_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_2854018412965560934_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_2854018412965560934_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_2874308182973609280_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_2874308182973609280_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_2908211348054790206_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_2908211348054790206_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_3390195103300879005_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_3390195103300879005_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_355985686393018443_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_355985686393018443_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_4157699181802622881_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_4157699181802622881_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_4485455956454253177_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_4485455956454253177_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_4813342041175929104_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_4813342041175929104_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5007538170225049517_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5007538170225049517_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5049754333185260579_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5049754333185260579_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5151904991086119828_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5151904991086119828_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5261985293551022499_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5261985293551022499_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_529986652090348612_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_529986652090348612_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_535686333318735112_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_535686333318735112_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5399139465269860643_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5399139465269860643_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5424206296747912892_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5424206296747912892_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5490544698340168624_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5490544698340168624_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5572329297531721924_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5572329297531721924_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5600577061199650579_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5600577061199650579_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5603300587476173754_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5603300587476173754_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5820275438480345844_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5820275438480345844_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_5976055674371755419_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_5976055674371755419_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6060056173045836363_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6060056173045836363_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6106972373212129937_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6106972373212129937_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6108057837579097630_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6108057837579097630_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6145905544629802660_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6145905544629802660_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6275608373987838249_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6275608373987838249_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6307777218133280536_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6307777218133280536_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6358970988792600090_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6358970988792600090_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6534304427224174449_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6534304427224174449_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6620687105125395297_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6620687105125395297_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_665828278335233042_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_665828278335233042_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6687040518628022292_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6687040518628022292_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6777077274901724631_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6777077274901724631_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_6888168034936702300_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_6888168034936702300_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7091853949137508230_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7091853949137508230_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7252101521626156540_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7252101521626156540_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7419535414187010479_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7419535414187010479_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7476747305875884133_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7476747305875884133_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7484490375568007393_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7484490375568007393_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7503055758221915479_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7503055758221915479_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7507497258809787969_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7507497258809787969_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7640495213220734500_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7640495213220734500_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7849792192051827728_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7849792192051827728_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7884059679965255776_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7884059679965255776_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_7930000048954739293_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_7930000048954739293_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8126636214595506259_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8126636214595506259_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8145343503676732357_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8145343503676732357_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8210319304660288336_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8210319304660288336_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8247543427891190330_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8247543427891190330_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8371636306610568200_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8371636306610568200_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8533033846260479465_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8533033846260479465_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_8930736551108474841_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_8930736551108474841_tmp -------------------------------------------------------------------------------- /build/tmp/test/jar_extract_9184184750065989451_tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/build/tmp/test/jar_extract_9184184750065989451_tmp -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davef77/atdd-course-examples/b2ebc88166bdfbbf23935ce4db60350ac8955c66/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'atdd-course-examples' 2 | 3 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/DummyAccountingSUT.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class DummyAccountingSUT { 9 | private final Map registeredUsers = new HashMap<>(); 10 | private final Map currentUsers = new HashMap<>(); 11 | private final List submittedInvoices = new ArrayList<>(); 12 | private final List pendingReview = new ArrayList<>(); 13 | private ExternalKYCCheck kycCheck; 14 | 15 | public DummyAccountingSUT(ExternalKYCCheck acctReg) { 16 | this.kycCheck = acctReg; 17 | } 18 | 19 | public void registerUser(String name, String password, UserRole role) { 20 | if (kycCheck.verifyAccount(name)) { 21 | registeredUsers.put(name, new User(name, password, role)); 22 | } 23 | } 24 | 25 | public void loginUser(String name, String pasword) throws UserAccessDeniedException { 26 | User user = registeredUsers.get(name); 27 | if (user == null || !user.validate(pasword)) 28 | throw new UserAccessDeniedException(); 29 | 30 | currentUsers.put(name, user); 31 | } 32 | 33 | public void submitInvoice(String userName, Invoice invoice) throws UserAccessDeniedException { 34 | SubmittedInvoice submittedInvoice = new SubmittedInvoice(verifyAccessForUser(userName, UserRole.Submitter), invoice); 35 | submittedInvoices.add(submittedInvoice); 36 | pendingReview.add(submittedInvoice); 37 | } 38 | 39 | public List listSubmittedInvoices() { 40 | return submittedInvoices; 41 | } 42 | 43 | public List listInvoicesPendingReview(String userName) throws UserAccessDeniedException { 44 | verifyAccessForUser(userName, UserRole.AccountingSupervisor); 45 | 46 | return pendingReview; 47 | } 48 | 49 | private User verifyAccessForUser(String userName, UserRole permissionRequired) throws UserAccessDeniedException { 50 | User user = currentUsers.get(userName); 51 | if (user == null || !user.hasPermission(permissionRequired)) 52 | throw new UserAccessDeniedException(); 53 | return user; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/ExternalKYCCheck.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | public interface ExternalKYCCheck { 4 | boolean verifyAccount(String name); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/Invoice.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | import java.util.List; 4 | 5 | public class Invoice { 6 | private String invoiceName; 7 | private String purchaseOrder; 8 | private String invoiceNumber; 9 | private List items; 10 | private String total; 11 | 12 | public Invoice(String invoiceName, String purchaseOrder, String invoiceNumber, List items, String total) { 13 | 14 | this.invoiceName = invoiceName; 15 | this.purchaseOrder = purchaseOrder; 16 | this.invoiceNumber = invoiceNumber; 17 | this.items = items; 18 | this.total = total; 19 | } 20 | 21 | public String getInvoiceName() { 22 | return invoiceName; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/SubmittedInvoice.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | public class SubmittedInvoice { 4 | private User user; 5 | private Invoice invoice; 6 | 7 | public SubmittedInvoice(User user, Invoice invoice) { 8 | 9 | this.user = user; 10 | this.invoice = invoice; 11 | } 12 | 13 | public User getUser() { 14 | return user; 15 | } 16 | 17 | public Invoice getInvoice() { 18 | return invoice; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/User.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | public class User { 4 | private String name; 5 | private String password; 6 | private UserRole role; 7 | 8 | public User(String name, String password, UserRole role) { 9 | 10 | this.name = name; 11 | this.password = password; 12 | this.role = role; 13 | } 14 | 15 | public boolean validate(String pasword) { 16 | return this.password.equals(pasword); 17 | } 18 | 19 | public boolean hasPermission(UserRole role) { 20 | return this.role == role; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/UserAccessDeniedException.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | public class UserAccessDeniedException extends Exception { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/accounting/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | public enum UserRole { 4 | Accountant, AccountingSupervisor, Submitter 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/bookshopping/Book.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | public class Book 4 | { 5 | private final String title; 6 | private final String author; 7 | 8 | public Book(String title, String author) 9 | { 10 | this.title = title; 11 | this.author = author; 12 | } 13 | 14 | public boolean isWrittenBy(String author) 15 | { 16 | return this.author.contains(author); 17 | } 18 | 19 | public String title() 20 | { 21 | return title; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cd/acceptance/examples/bookshopping/MyLocalBookStore.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class MyLocalBookStore 7 | { 8 | private List allBooks = new ArrayList<>(); 9 | private List shoppingBasket = new ArrayList<>(); 10 | 11 | 12 | public void addBook(Book book) 13 | { 14 | allBooks.add(book); 15 | } 16 | 17 | public List findBooksByTitle(String title) 18 | { 19 | List books = new ArrayList<>(); 20 | 21 | for (Book book : allBooks) 22 | { 23 | if (book.title().contains(title)) 24 | { 25 | books.add(book); 26 | } 27 | } 28 | return books; 29 | } 30 | 31 | public void addToBasket(Book selectedBook) 32 | { 33 | shoppingBasket.add(selectedBook); 34 | } 35 | 36 | public List listBasketItems() 37 | { 38 | return shoppingBasket; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/Channel.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | /** 7 | * Copyright (c) Continuous Delivery Ltd. 2016 8 | */ 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Channel 11 | { 12 | Channels[] value() default Channels.Unknown; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/ChannelFinder.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | 4 | import org.junit.Test; 5 | 6 | import java.lang.annotation.Annotation; 7 | import java.lang.reflect.Method; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | public class ChannelFinder 12 | { 13 | public static List listChannels() 14 | { 15 | ArrayList channels = new ArrayList(); 16 | 17 | Method testMethod = findTestMethod(); 18 | 19 | if (testMethod != null) 20 | { 21 | Channel c = testMethod.getAnnotation(Channel.class); 22 | 23 | for (Channels channel : c.value()) 24 | { 25 | channels.add(channel.name()); 26 | } 27 | } 28 | else 29 | { 30 | channels.add("default"); 31 | } 32 | 33 | return channels; 34 | } 35 | 36 | private static Method findTestMethod() 37 | { 38 | StackTraceElement[] elements = new Throwable().fillInStackTrace().getStackTrace(); 39 | 40 | for (int i = 1; i < elements.length; i++) 41 | { 42 | StackTraceElement element = elements[i]; 43 | 44 | try 45 | { 46 | Class clz = Class.forName(element.getClassName()); 47 | Method method = clz.getMethod(element.getMethodName(), new Class[0]); 48 | 49 | for (Annotation annotation : method.getAnnotations()) 50 | { 51 | if (annotation.annotationType() == Test.class) 52 | { 53 | return method; 54 | } 55 | } 56 | } 57 | catch (NoSuchMethodException ignored) 58 | { 59 | 60 | } 61 | catch (SecurityException ignored) 62 | { 63 | 64 | } 65 | catch (ClassNotFoundException ignored) 66 | { 67 | 68 | } 69 | 70 | } 71 | return null; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/ChannelFinderTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import java.util.Arrays; 7 | 8 | import static com.cd.acceptance.dsl.utils.Channels.Amazon; 9 | import static com.cd.acceptance.dsl.utils.Channels.BookDepository; 10 | 11 | public class ChannelFinderTest { 12 | @Channel({Amazon, BookDepository}) 13 | @Test 14 | public void shouldReportChannelList() throws Exception 15 | { 16 | Assert.assertEquals(Arrays.asList("Amazon", "BookDepository"), ChannelFinder.listChannels()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/Channels.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | public enum Channels { 4 | Unknown, 5 | Amazon, 6 | BookDepository, 7 | MyLocalBookStore; 8 | } 9 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/Params.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import static junit.framework.TestCase.fail; 8 | 9 | /** 10 | * Copyright (c) Continuous Delivery Ltd. 2022 11 | */ 12 | public class Params 13 | { 14 | private final DslContext context; 15 | private final String[] args; 16 | 17 | public Params(DslContext context, String[] args) 18 | { 19 | this.context = context; 20 | this.args = args; 21 | } 22 | 23 | public String Optional(String name, String defaultValue) 24 | { 25 | String arg = getParamValue(name); 26 | if (arg != null) return arg; 27 | return defaultValue; 28 | } 29 | 30 | public String Alias(String name) 31 | { 32 | String value = getParamValue(name); 33 | if (value == null) { 34 | fail("No '" + name + "' supplied for alias"); 35 | } 36 | return context.alias(value); 37 | } 38 | 39 | public String OptionalSequence(String name, int start) { 40 | return Optional(name, context.sequenceNumberForName(name, start)); 41 | } 42 | 43 | private String getParamValue(String name) { 44 | for (String arg : args) 45 | { 46 | int index = arg.indexOf(name + ": "); 47 | if (index != -1) 48 | { 49 | return arg.substring(index + name.length() + 2); 50 | } 51 | } 52 | return null; 53 | } 54 | 55 | public List OptionalList(String name, String[] items) { 56 | return null; 57 | } 58 | 59 | public static class DslContext { 60 | private static final Map globalSequenceNumbers = new HashMap<>(); 61 | private final Map sequenceNumbers = new HashMap<>(); 62 | private final Map aliases = new HashMap<>(); 63 | 64 | public String sequenceNumberForName(String name, int start) { 65 | return seqForName(name, start, sequenceNumbers); 66 | } 67 | 68 | public String alias(String name) { 69 | if (!aliases.containsKey(name)) { 70 | String sequenceNo = seqForName(name, 1, globalSequenceNumbers); 71 | aliases.put(name, name + sequenceNo); 72 | } 73 | return aliases.get(name); 74 | } 75 | 76 | private String seqForName(String name, int start, Map sequenceNumbers) { 77 | int retVal = start; 78 | if (sequenceNumbers.containsKey(name)) { 79 | retVal = sequenceNumbers.get(name); 80 | } 81 | sequenceNumbers.put(name, retVal + 1); 82 | 83 | return String.valueOf(retVal); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/ParamsTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | import com.cd.acceptance.dsl.utils.Params; 4 | import junit.framework.AssertionFailedError; 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | public class ParamsTest { 11 | private Params.DslContext context; 12 | 13 | @Before 14 | public void setUp(){ 15 | context = new Params.DslContext(); 16 | } 17 | 18 | @Test 19 | public void shouldReturnOptionValueOfParam() { 20 | Params params = new Params(context, new String[]{"One: 1", "Two: 2"}); 21 | 22 | assertEquals("3", params.Optional("Three", "3")); 23 | } 24 | 25 | @Test 26 | public void shouldReturnDefinedValueOverridingDefault() { 27 | Params params = new Params(context, new String[]{"One: 1", "Two: 2"}); 28 | 29 | assertEquals("1", params.Optional("One", "3")); 30 | } 31 | 32 | @Test 33 | public void shouldReturnValueOverridingOptionalSequenceValue() { 34 | Params params = new Params(context, new String[]{"One: 1", "Two: 2"}); 35 | 36 | assertEquals("1", params.OptionalSequence("One", 3)); 37 | } 38 | 39 | @Test 40 | public void shouldReturnStartValueOfOptionalSequence() { 41 | Params params = new Params(context, new String[]{"One: 1", "Two: 2"}); 42 | 43 | assertEquals("3", params.OptionalSequence("Three", 3)); 44 | } 45 | 46 | @Test 47 | public void shouldReturnNextValueOfOptionalSequence() { 48 | Params params = new Params(context, new String[]{"One: 1", "Two: 2"}); 49 | 50 | params.OptionalSequence("Three", 5); 51 | assertEquals("6", params.OptionalSequence("Three", 5)); 52 | } 53 | 54 | @Test 55 | public void shouldSupplyIncrementedAliasAcrossContexts() { 56 | Params params = new Params(context, new String[]{"name: nameTest"}); 57 | Params params2 = new Params(new Params.DslContext(), new String[]{"name: nameTest"}); 58 | 59 | assertNotEquals(params.Alias("name"), params2.Alias("name")); 60 | } 61 | 62 | @Test 63 | public void shouldSupplyConsistentAliasWithinContext() { 64 | Params params = new Params(context, new String[]{"name: nameTest"}); 65 | assertEquals(params.Alias("name"), params.Alias("name")); 66 | } 67 | 68 | @Test(expected = AssertionFailedError.class) 69 | public void shouldFailAliasIfValueNotPresent() { 70 | Params params = new Params(context, new String[]{"name: nameTest"}); 71 | params.Alias("name2"); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/dsl/utils/PollWithTimeOut.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.dsl.utils; 2 | 3 | import org.openqa.selenium.WebElement; 4 | 5 | import java.util.List; 6 | import java.util.function.IntConsumer; 7 | import java.util.function.Supplier; 8 | 9 | public class PollWithTimeOut 10 | { 11 | private long duration; 12 | private long waitDuration = 10L; 13 | private long start; 14 | 15 | public static PollWithTimeOut await() 16 | { 17 | return new PollWithTimeOut(); 18 | } 19 | 20 | public PollWithTimeOut atMost(long millis) 21 | { 22 | duration = millis; 23 | 24 | return this; 25 | } 26 | 27 | 28 | public void until(Supplier> supplier, IntConsumer consumer) 29 | { 30 | List found; 31 | start = System.currentTimeMillis(); 32 | 33 | do 34 | { 35 | found = supplier.get(); 36 | 37 | } while (found.size() == 0 && !timedOut()); 38 | 39 | consumer.accept(found.size()); 40 | } 41 | 42 | private boolean timedOut() 43 | { 44 | long now = System.currentTimeMillis(); 45 | boolean isTimedOut = now - start >= duration; 46 | 47 | if (!isTimedOut) 48 | try 49 | { 50 | Thread.sleep(waitDuration); 51 | } 52 | catch (InterruptedException e) 53 | { 54 | // Intentionally Ignored 55 | } 56 | 57 | return isTimedOut; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/accounting/InvoiceSubmissionAcceptanceTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting; 2 | 3 | import com.cd.acceptance.examples.accounting.dsl.Dsl; 4 | import org.junit.Test; 5 | 6 | public class InvoiceSubmissionAcceptanceTest extends Dsl { 7 | 8 | @Test 9 | public void shouldAcknowledgeInvoiceSubmission() { 10 | invoices.createAuthorisedAccount("name: InvoiceSubmitter1", "role: Submitter"); 11 | invoices.submitInvoice("name: InvoiceSubmitter1", "invoice: invoice1", "Item: Software License"); 12 | invoices.confirmInvoiceSubmitted("name: InvoiceSubmitter1", "invoice: invoice1"); 13 | } 14 | 15 | @Test 16 | public void shouldSendSubmittedInvoiceToSupervisor() { 17 | invoices.createAuthorisedAccount("name: InvoiceSubmitter1", "role: Submitter"); 18 | invoices.createAuthorisedAccount("name: Supervisor1", "role: AccountingSupervisor"); 19 | invoices.submitInvoice("name: InvoiceSubmitter1", "invoice: invoice1", "Item: Software License"); 20 | invoices.confirmPendingAuthorisations("name: Supervisor1", "pendingItem: invoice1"); 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/accounting/drivers/AccountingSystemProtocolDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting.drivers; 2 | 3 | import java.util.List; 4 | 5 | public interface AccountingSystemProtocolDriver { 6 | void createAuthorisedAccount(String name, String password, String role); 7 | 8 | void submitInvoice(String userName, String invoiceName, String purchaseOrder, String invoiceNumber, List items, String total); 9 | 10 | void confirmInvoiceSubmitted(String userName, String invoice); 11 | 12 | void confirmPendingAuthorisations(String userName, String pendingItem); 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/accounting/drivers/DummyAccountingSystemProtocolDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting.drivers; 2 | 3 | import com.cd.acceptance.examples.accounting.*; 4 | 5 | import java.util.List; 6 | 7 | import static junit.framework.TestCase.fail; 8 | 9 | // Pretend System Under Test 10 | public class DummyAccountingSystemProtocolDriver implements AccountingSystemProtocolDriver { 11 | private final DummyAccountingSUT accountingSystem; 12 | 13 | public DummyAccountingSystemProtocolDriver(DummyAccountingSUT accountingSystem) { 14 | this.accountingSystem = accountingSystem; 15 | } 16 | 17 | @Override 18 | public void createAuthorisedAccount(String name, String password, String role) { 19 | try { 20 | accountingSystem.registerUser(name, password, UserRole.valueOf(role)); 21 | accountingSystem.loginUser(name, password); 22 | } catch (UserAccessDeniedException e) 23 | { 24 | fail("Unable to create authorised account for: " + name); 25 | } 26 | } 27 | 28 | @Override 29 | public void submitInvoice(String userName, String invoiceName, String purchaseOrder, String invoiceNumber, List items, String total) { 30 | try 31 | { 32 | Invoice invoice = new Invoice(invoiceName, purchaseOrder, invoiceNumber, items, total); 33 | accountingSystem.submitInvoice(userName, invoice); 34 | } catch (UserAccessDeniedException e) { 35 | fail("User '" + userName + "' does not have permission to submit invoices"); 36 | } 37 | } 38 | 39 | @Override 40 | public void confirmInvoiceSubmitted(String userName, String invoice) { 41 | List invoices = accountingSystem.listSubmittedInvoices(); 42 | for (SubmittedInvoice item : invoices) { 43 | if (item.getUser().getName().equals(userName) && item.getInvoice().getInvoiceName().equals(invoice)) { 44 | return; 45 | } 46 | } 47 | fail("Invoice '" + invoice + "' does not exist!"); 48 | } 49 | 50 | @Override 51 | public void confirmPendingAuthorisations(String userName, String pendingItem) { 52 | try { 53 | List invoices = accountingSystem.listInvoicesPendingReview(userName); 54 | for (SubmittedInvoice item : invoices) { 55 | if (item.getInvoice().getInvoiceName().equals(pendingItem)) { 56 | return; 57 | } 58 | fail("'" + pendingItem + "' Is not pending review!"); 59 | } 60 | } catch (UserAccessDeniedException e) 61 | { 62 | fail("Access Denied for User '" + userName + "'"); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/accounting/drivers/StubExternalKYCCheck.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting.drivers; 2 | 3 | import com.cd.acceptance.examples.accounting.ExternalKYCCheck; 4 | 5 | import java.util.HashSet; 6 | import java.util.Set; 7 | 8 | public class StubExternalKYCCheck implements ExternalKYCCheck { 9 | private Set validUsers = new HashSet<>(); 10 | 11 | public void onVerifyApproveAccount(String account) { 12 | validUsers.add(account); 13 | } 14 | 15 | public void onVerifyRejectAccount(String account) { 16 | validUsers.remove(account); 17 | } 18 | 19 | @Override 20 | public boolean verifyAccount(String name) { 21 | return validUsers.contains(name); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/accounting/dsl/Dsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting.dsl; 2 | 3 | import com.cd.acceptance.examples.accounting.ExternalKYCCheck; 4 | import com.cd.acceptance.examples.accounting.drivers.DummyAccountingSystemProtocolDriver; 5 | import com.cd.acceptance.dsl.utils.Params; 6 | import com.cd.acceptance.examples.accounting.DummyAccountingSUT; 7 | import org.junit.Before; 8 | 9 | public class Dsl { 10 | private final Params.DslContext context = new Params.DslContext(); 11 | 12 | protected InvoicesDsl invoices; 13 | 14 | @Before 15 | public void setUp() { 16 | // In reality the Protocol Driver would connect to the real "System Under Test" 17 | // For the purpose of this example, we use a simple class to represent the SUT here. 18 | // A real Protocol Driver would do whatever it takes to translate from DSL to interactions with the SUT 19 | DummyAccountingSUT sut = new DummyAccountingSUT(new AccountApproval()); 20 | invoices = new InvoicesDsl(context, new DummyAccountingSystemProtocolDriver(sut)); 21 | } 22 | 23 | class AccountApproval implements ExternalKYCCheck { 24 | 25 | @Override 26 | public boolean verifyAccount(String name) { 27 | return true; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/accounting/dsl/InvoicesDsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.accounting.dsl; 2 | 3 | import com.cd.acceptance.examples.accounting.drivers.AccountingSystemProtocolDriver; 4 | import com.cd.acceptance.dsl.utils.Params; 5 | 6 | import java.util.List; 7 | 8 | public class InvoicesDsl { 9 | private final Params.DslContext context; 10 | private final AccountingSystemProtocolDriver driver; 11 | 12 | protected InvoicesDsl(Params.DslContext context, AccountingSystemProtocolDriver driver) { 13 | this.context = context; 14 | this.driver = driver; 15 | } 16 | 17 | public void createAuthorisedAccount(String... args) { 18 | Params params = new Params(context, args); 19 | 20 | String name = params.Alias("name"); 21 | String role = params.Optional("role", "Accountant"); 22 | String password = params.Optional("password", "password123"); 23 | 24 | driver.createAuthorisedAccount(name, password, role); 25 | } 26 | 27 | public void submitInvoice(String... args) { 28 | Params params = new Params(context, args); 29 | 30 | String userName = params.Alias("name"); 31 | String invoice = params.Optional("invoice", "anInvoice"); 32 | String purchaseOrder = params.Optional("po", "po1"); 33 | String invoiceNumber = params.OptionalSequence("InvoiceNo", 1); 34 | String total = params.Optional("total", "0"); 35 | List items = params.OptionalList("item", new String[] {"item1"}); 36 | 37 | driver.submitInvoice(userName, invoice, purchaseOrder, invoiceNumber, items, total); 38 | } 39 | 40 | public void confirmInvoiceSubmitted(String... args) { 41 | Params params = new Params(context, args); 42 | 43 | String userName = params.Alias("name"); 44 | String invoice = params.Optional("invoice", "anInvoice"); 45 | 46 | driver.confirmInvoiceSubmitted(userName, invoice); 47 | } 48 | 49 | public void confirmPendingAuthorisations(String... args) { 50 | Params params = new Params(context, args); 51 | 52 | String userName = params.Alias("name"); 53 | String pendingItem = params.Optional("pendingItem", "someItem"); 54 | 55 | driver.confirmPendingAuthorisations(userName, pendingItem); 56 | } 57 | 58 | public void confirmInvoiceRejected(String... args) { 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/BookShopDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | public interface BookShopDriver 4 | { 5 | void searchForBook(String title); 6 | 7 | void selectBook(String author); 8 | 9 | void addSelectedItemToShoppingBasket(); 10 | 11 | void assertListedInShoppingBasket(String item); 12 | 13 | void checkOut(String item, String price, Card card); 14 | 15 | void assertItemPurchased(String item); 16 | 17 | void goToStore(); 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/BookShopDrivers.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import com.cd.acceptance.dsl.utils.ChannelFinder; 4 | import com.cd.acceptance.examples.bookshopping.drivers.AmazonBookShopDriver; 5 | import com.cd.acceptance.examples.bookshopping.drivers.BookDepositoryBookShopDriver; 6 | import com.cd.acceptance.examples.bookshopping.drivers.MyLocalBookStoreBookShopDriver; 7 | 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public class BookShopDrivers implements BookShopDriver 13 | { 14 | private final Map drivers = new HashMap(); 15 | 16 | public BookShopDrivers() 17 | { 18 | drivers.put("Amazon", new AmazonBookShopDriver()); 19 | drivers.put("BookDepository", new BookDepositoryBookShopDriver()); 20 | drivers.put("MyLocalBookStore", new MyLocalBookStoreBookShopDriver()); 21 | drivers.put("default", new MyLocalBookStoreBookShopDriver()); 22 | } 23 | 24 | private BookShopDriver driver() 25 | { 26 | List channels = ChannelFinder.listChannels(); 27 | 28 | return drivers.get(channels.get(0)); 29 | } 30 | 31 | @Override 32 | public void searchForBook(String title) 33 | { 34 | driver().searchForBook(title); 35 | } 36 | 37 | @Override 38 | public void selectBook(String author) 39 | { 40 | driver().selectBook(author); 41 | } 42 | 43 | @Override 44 | public void addSelectedItemToShoppingBasket() 45 | { 46 | driver().addSelectedItemToShoppingBasket(); 47 | } 48 | 49 | @Override 50 | public void assertListedInShoppingBasket(String item) 51 | { 52 | driver().assertListedInShoppingBasket(item); 53 | } 54 | 55 | @Override 56 | public void checkOut(String item, String price, Card card) 57 | { 58 | driver().checkOut(item, price, card); 59 | } 60 | 61 | @Override 62 | public void assertItemPurchased(String item) 63 | { 64 | driver().assertItemPurchased(item); 65 | } 66 | 67 | @Override 68 | public void goToStore() 69 | { 70 | 71 | } 72 | } 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/BookShoppingDsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import com.cd.acceptance.dsl.utils.Params; 4 | 5 | public class BookShoppingDsl 6 | { 7 | private final Params.DslContext context = new Params.DslContext(); 8 | private final BookShopDrivers driver; 9 | 10 | public BookShoppingDsl(BookShopDrivers drivers) 11 | { 12 | this.driver = drivers; 13 | } 14 | 15 | public void searchForBook(String... args) 16 | { 17 | Params params = new Params(context, args); 18 | String title = params.Optional("title", "Continuous Delivery"); 19 | 20 | driver.searchForBook(title); 21 | } 22 | 23 | public void selectBook(String... args) 24 | { 25 | Params params = new Params(context, args); 26 | String author = params.Optional("author", "David Farley"); 27 | 28 | driver.selectBook(author); 29 | } 30 | 31 | public void addSelectedItemToShoppingBasket() 32 | { 33 | driver.addSelectedItemToShoppingBasket(); 34 | } 35 | 36 | public void assertItemListedInShoppingBasket(String... args) 37 | { 38 | Params params = new Params(context, args); 39 | String item = params.Optional("item", "Continuous Delivery"); 40 | 41 | driver.assertListedInShoppingBasket(item); 42 | } 43 | 44 | public void checkOut(String... args) 45 | { 46 | Params params = new Params(context, args); 47 | String item = params.Optional("item", "Continuous Delivery"); 48 | String price = params.Optional("price", "£10.00"); 49 | Card card = parseCard(params.Optional("card", "1234 5678 9101 0001 12/23 007")); 50 | 51 | driver.checkOut(item, price, card); 52 | } 53 | 54 | public void assertItemPurchased(String... args) 55 | { 56 | Params params = new Params(context, args); 57 | String item = params.Optional("item", "Continuous Delivery"); 58 | 59 | driver.assertItemPurchased(item); 60 | } 61 | 62 | private Card parseCard(String card) 63 | { 64 | String cardDetails = card; 65 | return new Card(cardDetails.substring(19), 66 | cardDetails.substring(20, 25), 67 | cardDetails.substring(26, 29)); 68 | } 69 | 70 | public void goToStore() 71 | { 72 | driver.goToStore(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/Card.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | public class Card 4 | { 5 | public final String cardNo; 6 | public final String date; 7 | public final String cvc; 8 | 9 | public Card(String cardNo, String date, String cvc) 10 | { 11 | this.cardNo = cardNo; 12 | this.date = date; 13 | this.cvc = cvc; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/CucumberDsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | public class CucumberDsl 4 | { 5 | public BookShoppingDsl shopping; 6 | 7 | public CucumberDsl() 8 | { 9 | shopping = new BookShoppingDsl(new BookShopDrivers()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/Dsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import org.junit.Before; 4 | 5 | public class Dsl 6 | { 7 | public BookShoppingDsl shopping; 8 | 9 | @Before 10 | public void setUp() 11 | { 12 | shopping = new BookShoppingDsl(new BookShopDrivers()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/ExampleAmazonAcceptanceTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import com.cd.acceptance.dsl.utils.Channel; 4 | import org.junit.Test; 5 | 6 | import static com.cd.acceptance.dsl.utils.Channels.Amazon; 7 | 8 | public class ExampleAmazonAcceptanceTest extends Dsl 9 | { 10 | @Test 11 | @Channel(Amazon) 12 | public void shouldAddBookToShoppingBasket() throws Exception 13 | { 14 | shopping.searchForBook("title: Continuous Delivery"); 15 | shopping.selectBook("author: David Farley"); 16 | 17 | shopping.addSelectedItemToShoppingBasket(); 18 | 19 | shopping.assertItemListedInShoppingBasket("item: Continuous Delivery"); 20 | } 21 | 22 | @Test 23 | @Channel(Amazon) 24 | public void shouldBuyBookWithCreditCard() 25 | { 26 | shopping.goToStore(); 27 | 28 | shopping.searchForBook("title: Continuous Delivery"); 29 | shopping.selectBook("author: David Farley"); 30 | shopping.addSelectedItemToShoppingBasket(); 31 | 32 | shopping.checkOut("item: Continuous Delivery"); 33 | 34 | shopping.assertItemPurchased("item: Continuous Delivery"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/ExampleBookStoreAcceptanceTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import com.cd.acceptance.dsl.utils.Channel; 4 | import org.junit.Test; 5 | 6 | import static com.cd.acceptance.dsl.utils.Channels.Amazon; 7 | import static com.cd.acceptance.dsl.utils.Channels.BookDepository; 8 | 9 | public class ExampleBookStoreAcceptanceTest extends Dsl 10 | { 11 | @Test 12 | @Channel({BookDepository, Amazon}) 13 | public void shouldAddBookToShoppingBasket() throws Exception 14 | { 15 | //Given 16 | shopping.searchForBook("title: Continuous Delivery"); 17 | shopping.selectBook("author: David Farley"); 18 | 19 | //When 20 | shopping.addSelectedItemToShoppingBasket(); 21 | 22 | //Then 23 | shopping.assertItemListedInShoppingBasket("item: Continuous Delivery"); 24 | } 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/ExampleMyLocalBookStoreAcceptanceTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping; 2 | 3 | import com.cd.acceptance.dsl.utils.Channel; 4 | import org.junit.Test; 5 | 6 | import static com.cd.acceptance.dsl.utils.Channels.*; 7 | 8 | public class ExampleMyLocalBookStoreAcceptanceTest extends Dsl 9 | { 10 | @Test 11 | @Channel({MyLocalBookStore, BookDepository, Amazon}) 12 | public void shouldAddBookToShoppingBasket() throws Exception 13 | { 14 | //Given 15 | shopping.searchForBook("title: Continuous Delivery"); 16 | shopping.selectBook("author: David Farley"); 17 | 18 | //When 19 | shopping.addSelectedItemToShoppingBasket(); 20 | 21 | //Then 22 | shopping.assertItemListedInShoppingBasket("item: Continuous Delivery"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/drivers/AmazonBookShopDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping.drivers; 2 | 3 | 4 | import com.cd.acceptance.examples.bookshopping.Card; 5 | import com.cd.acceptance.examples.bookshopping.BookShopDriver; 6 | import org.openqa.selenium.By; 7 | import org.openqa.selenium.WebDriver; 8 | import org.openqa.selenium.WebElement; 9 | import org.openqa.selenium.remote.DesiredCapabilities; 10 | import org.openqa.selenium.remote.RemoteWebDriver; 11 | 12 | import java.net.MalformedURLException; 13 | import java.net.URL; 14 | import java.util.List; 15 | 16 | import static junit.framework.TestCase.assertEquals; 17 | 18 | public class AmazonBookShopDriver implements BookShopDriver 19 | { 20 | 21 | private final static String BOOKSHOP_URL = "http://www.amazon.co.uk"; 22 | 23 | private WebDriver driver; 24 | 25 | public AmazonBookShopDriver() 26 | { 27 | } 28 | 29 | @Override 30 | public void searchForBook(String title) 31 | { 32 | WebElement searchBox = driver().findElement(By.id("twotabsearchtextbox")); 33 | 34 | searchBox.sendKeys(title + "\n"); 35 | } 36 | 37 | @Override 38 | public void selectBook(String author) 39 | { 40 | WebElement book = driver().findElement(By.xpath(String.format( 41 | "//div[@class=\"a-row a-spacing-none\"]/span/a[text()='%s']/../../../div/a[contains(@class, 's-access-detail-page')]", author))); 42 | 43 | book.click(); 44 | } 45 | 46 | @Override 47 | public void addSelectedItemToShoppingBasket() 48 | { 49 | WebElement buyButton = driver().findElement(By.id("add-to-cart-button")); 50 | 51 | buyButton.click(); 52 | } 53 | 54 | @Override 55 | public void assertListedInShoppingBasket(String item) 56 | { 57 | gotoPage("https://www.amazon.co.uk/gp/cart/view.html/ref=nav_cart", 58 | "Amazon.co.uk Shopping Basket"); 59 | 60 | List found = driver().findElements( 61 | By.xpath("//span[@class=\"a-list-item\"]/*[contains(., \"Continuous Delivery\")]")); 62 | 63 | assertEquals(String.format("Item '%s' not found in shopping basket", item), 64 | 1, found.size()); 65 | } 66 | 67 | @Override 68 | public void checkOut(String item, String price, Card card) 69 | { 70 | 71 | } 72 | 73 | @Override 74 | public void assertItemPurchased(String item) 75 | { 76 | 77 | } 78 | 79 | @Override 80 | public void goToStore() 81 | { 82 | gotoPage(BOOKSHOP_URL, "Amazon.co.uk: Low Prices in Electronics, Books, Sports Equipment & more"); 83 | } 84 | 85 | private void gotoPage(String page, String expectedTitle) 86 | { 87 | driver().get(page); 88 | 89 | assertEquals(expectedTitle, driver().getTitle()); 90 | } 91 | 92 | private WebDriver driver() 93 | { 94 | if (driver == null) 95 | { 96 | try 97 | { 98 | driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub/"), DesiredCapabilities.chrome()); 99 | } 100 | catch (MalformedURLException e) 101 | { 102 | e.printStackTrace(); 103 | } 104 | } 105 | return driver; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/drivers/BookDepositoryBookShopDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping.drivers; 2 | 3 | 4 | import com.cd.acceptance.examples.bookshopping.Card; 5 | import com.cd.acceptance.examples.bookshopping.BookShopDriver; 6 | import org.openqa.selenium.By; 7 | import org.openqa.selenium.WebDriver; 8 | import org.openqa.selenium.WebElement; 9 | import org.openqa.selenium.remote.DesiredCapabilities; 10 | import org.openqa.selenium.remote.RemoteWebDriver; 11 | 12 | import java.net.MalformedURLException; 13 | import java.net.URL; 14 | 15 | //import static com.cd.acceptance.utils.PollWithTimeOut.await; 16 | import static junit.framework.TestCase.assertEquals; 17 | 18 | public class BookDepositoryBookShopDriver implements BookShopDriver 19 | { 20 | 21 | private final static String BOOKSHOP_URL = "http://www.bookdepository.com/"; 22 | 23 | private WebDriver driver; 24 | 25 | @Override 26 | public void searchForBook(String title) 27 | { 28 | gotoPage(BOOKSHOP_URL, "Book Depository: Millions of books with free delivery worldwide"); 29 | WebElement searchBox = driver().findElement(By.name("searchTerm")); 30 | 31 | searchBox.sendKeys(title + "\n"); 32 | } 33 | 34 | 35 | @Override 36 | public void selectBook(String author) 37 | { 38 | WebElement book = driver().findElement(By.xpath(String.format("//div[@class=\"book-item\"]/div/p/a[text()='%s']/../../../div[@class=\"item-info\"]/h3/a", getAuthor(author)))); 39 | 40 | book.click(); 41 | } 42 | 43 | @Override 44 | public void addSelectedItemToShoppingBasket() 45 | { 46 | WebElement buyButton = driver().findElement(By.className("add-to-basket")); 47 | 48 | buyButton.click(); 49 | } 50 | 51 | @Override 52 | public void assertListedInShoppingBasket(String item) 53 | { 54 | gotoPage("https://www.bookdepository.com/basket", "Your basket"); 55 | 56 | // await() 57 | // .atMost(1000) 58 | // .until(() -> driver().findElements(By.xpath("//div[@class=\"basket-item\"]/*[contains(., \"Continuous Delivery\")]")), 59 | // found -> assertEquals(String.format("Item '%s' not found in shopping basket", item), 1, found)); 60 | } 61 | 62 | @Override 63 | public void checkOut(String item, String price, Card card) 64 | { 65 | 66 | } 67 | 68 | @Override 69 | public void assertItemPurchased(String item) 70 | { 71 | 72 | } 73 | 74 | @Override 75 | public void goToStore() 76 | { 77 | 78 | } 79 | 80 | private void gotoPage(String url, String expectedTitle) 81 | { 82 | driver().get(url); 83 | 84 | String title = driver().getTitle(); 85 | 86 | assertEquals(expectedTitle, title); 87 | } 88 | 89 | private String getAuthor(String author) 90 | { 91 | if ("David Farley".equals(author)) 92 | return "Jez Humble"; // Hack because Jez is more famous than me :) 93 | else 94 | return author; 95 | } 96 | 97 | private WebDriver driver() 98 | { 99 | if (driver == null) 100 | { 101 | try 102 | { 103 | driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub/"), DesiredCapabilities.chrome()); 104 | } 105 | catch (MalformedURLException e) 106 | { 107 | e.printStackTrace(); 108 | } 109 | } 110 | 111 | return driver; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/drivers/BookShopDrivers.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping.drivers; 2 | 3 | 4 | import com.cd.acceptance.examples.bookshopping.Card; 5 | import com.cd.acceptance.dsl.utils.ChannelFinder; 6 | import com.cd.acceptance.examples.bookshopping.BookShopDriver; 7 | 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public class BookShopDrivers implements BookShopDriver 13 | { 14 | private final Map drivers = new HashMap(); 15 | 16 | public BookShopDrivers() 17 | { 18 | drivers.put("Amazon", new AmazonBookShopDriver()); 19 | drivers.put("BookDepository", new BookDepositoryBookShopDriver()); 20 | drivers.put("MyLocalBookStore", new MyLocalBookStoreBookShopDriver()); 21 | drivers.put("default", new MyLocalBookStoreBookShopDriver()); 22 | } 23 | 24 | private BookShopDriver driver() 25 | { 26 | List channels = ChannelFinder.listChannels(); 27 | 28 | return drivers.get(channels.get(0)); 29 | } 30 | 31 | @Override 32 | public void searchForBook(String title) 33 | { 34 | driver().searchForBook(title); 35 | } 36 | 37 | @Override 38 | public void selectBook(String author) 39 | { 40 | driver().selectBook(author); 41 | } 42 | 43 | @Override 44 | public void addSelectedItemToShoppingBasket() 45 | { 46 | driver().addSelectedItemToShoppingBasket(); 47 | } 48 | 49 | @Override 50 | public void assertListedInShoppingBasket(String item) 51 | { 52 | driver().assertListedInShoppingBasket(item); 53 | } 54 | 55 | @Override 56 | public void checkOut(String item, String price, Card card) 57 | { 58 | driver().checkOut(item, price, card); 59 | } 60 | 61 | @Override 62 | public void assertItemPurchased(String item) 63 | { 64 | driver().assertItemPurchased(item); 65 | } 66 | 67 | @Override 68 | public void goToStore() 69 | { 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/bookshopping/drivers/MyLocalBookStoreBookShopDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.bookshopping.drivers; 2 | 3 | import com.cd.acceptance.examples.bookshopping.Card; 4 | import com.cd.acceptance.examples.bookshopping.Book; 5 | import com.cd.acceptance.examples.bookshopping.MyLocalBookStore; 6 | import com.cd.acceptance.examples.bookshopping.BookShopDriver; 7 | import org.junit.Assert; 8 | 9 | import java.util.List; 10 | 11 | public class MyLocalBookStoreBookShopDriver implements BookShopDriver 12 | { 13 | private MyLocalBookStore store = new MyLocalBookStore(); 14 | private List booksByTitle; 15 | private Book selectedBook; 16 | 17 | public MyLocalBookStoreBookShopDriver() 18 | { 19 | store.addBook(new Book("Continuous Delivery", "David Farley & Jez Humble")); 20 | store.addBook(new Book("Continuous Delivery for Dummies", "Someone Else")); 21 | store.addBook(new Book("Continuous Delivery of Insulin", "Another Person")); 22 | } 23 | 24 | 25 | @Override 26 | public void searchForBook(String title) 27 | { 28 | booksByTitle = store.findBooksByTitle(title); 29 | } 30 | 31 | @Override 32 | public void selectBook(String author) 33 | { 34 | for (Book book : booksByTitle) 35 | { 36 | if (book.isWrittenBy(author)) 37 | { 38 | selectedBook = book; 39 | } 40 | } 41 | } 42 | 43 | @Override 44 | public void addSelectedItemToShoppingBasket() 45 | { 46 | store.addToBasket(selectedBook); 47 | } 48 | 49 | @Override 50 | public void assertListedInShoppingBasket(String item) 51 | { 52 | List basket = store.listBasketItems(); 53 | 54 | for (Book book : basket) 55 | { 56 | if (item.equals(book.title())) 57 | { 58 | return; 59 | } 60 | } 61 | 62 | Assert.fail(String.format("Item '%s' not found in shopping basket", item)); 63 | } 64 | 65 | @Override 66 | public void checkOut(String item, String price, Card card) 67 | { 68 | 69 | } 70 | 71 | @Override 72 | public void assertItemPurchased(String item) 73 | { 74 | 75 | } 76 | 77 | @Override 78 | public void goToStore() 79 | { 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/StubDemonstrationAcceptanceTest.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo; 2 | 3 | import com.cd.acceptance.examples.stubdemo.dsl.Dsl; 4 | import org.junit.Test; 5 | import junit.framework.AssertionFailedError; 6 | import static junit.framework.TestCase.assertTrue; 7 | 8 | public class StubDemonstrationAcceptanceTest extends Dsl { 9 | 10 | @Test 11 | public void shouldAllowInvoiceSubmissionForApprovedAccounts() { 12 | accounts.approveAccount("name: InvoiceSubmitter1"); 13 | invoices.createAuthorisedAccount("name: InvoiceSubmitter1", "role: Submitter"); 14 | invoices.submitInvoice("name: InvoiceSubmitter1", "invoice: invoice1", "Item: Software License"); 15 | invoices.confirmInvoiceSubmitted("name: InvoiceSubmitter1", "invoice: invoice1"); 16 | } 17 | 18 | @Test 19 | public void shouldRejectInvoiceSubmissionForRejectedAccounts() { 20 | try { 21 | accounts.rejectAccount("name: InvoiceSubmitter1"); 22 | invoices.createAuthorisedAccount("name: InvoiceSubmitter1", "role: Submitter"); 23 | } catch (AssertionFailedError e) { 24 | assertTrue(e.getMessage().startsWith("Unable to create authorised account for: ")); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/drivers/AccountingSystemProtocolDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.drivers; 2 | 3 | import java.util.List; 4 | 5 | public interface AccountingSystemProtocolDriver { 6 | void createAuthorisedAccount(String name, String password, String role); 7 | 8 | void submitInvoice(String userName, String invoiceName, String purchaseOrder, String invoiceNumber, List items, String total); 9 | 10 | void confirmInvoiceSubmitted(String userName, String invoice); 11 | 12 | void confirmPendingAuthorisations(String userName, String pendingItem); 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/drivers/DummyAccountingSystemProtocolDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.drivers; 2 | 3 | import com.cd.acceptance.examples.accounting.*; 4 | 5 | import java.util.List; 6 | 7 | import static junit.framework.TestCase.fail; 8 | 9 | // Pretend System Under Test 10 | public class DummyAccountingSystemProtocolDriver implements AccountingSystemProtocolDriver { 11 | private final DummyAccountingSUT accountingSystem; 12 | 13 | public DummyAccountingSystemProtocolDriver(DummyAccountingSUT accountingSystem) { 14 | this.accountingSystem = accountingSystem; 15 | } 16 | 17 | @Override 18 | public void createAuthorisedAccount(String name, String password, String role) { 19 | try { 20 | accountingSystem.registerUser(name, password, UserRole.valueOf(role)); 21 | accountingSystem.loginUser(name, password); 22 | } catch (UserAccessDeniedException e) 23 | { 24 | fail("Unable to create authorised account for: " + name); 25 | } 26 | } 27 | 28 | @Override 29 | public void submitInvoice(String userName, String invoiceName, String purchaseOrder, String invoiceNumber, List items, String total) { 30 | try 31 | { 32 | Invoice invoice = new Invoice(invoiceName, purchaseOrder, invoiceNumber, items, total); 33 | accountingSystem.submitInvoice(userName, invoice); 34 | } catch (UserAccessDeniedException e) { 35 | fail("User '" + userName + "' does not have permission to submit invoices"); 36 | } 37 | } 38 | 39 | @Override 40 | public void confirmInvoiceSubmitted(String userName, String invoice) { 41 | List invoices = accountingSystem.listSubmittedInvoices(); 42 | for (SubmittedInvoice item : invoices) { 43 | if (item.getUser().getName().equals(userName) && item.getInvoice().getInvoiceName().equals(invoice)) { 44 | return; 45 | } 46 | } 47 | fail("Invoice '" + invoice + "' does not exist!"); 48 | } 49 | 50 | @Override 51 | public void confirmPendingAuthorisations(String userName, String pendingItem) { 52 | try { 53 | List invoices = accountingSystem.listInvoicesPendingReview(userName); 54 | for (SubmittedInvoice item : invoices) { 55 | if (item.getInvoice().getInvoiceName().equals(pendingItem)) { 56 | return; 57 | } 58 | fail("'" + pendingItem + "' Is not pending review!"); 59 | } 60 | } catch (UserAccessDeniedException e) 61 | { 62 | fail("Access Denied for User '" + userName + "'"); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/drivers/KYCCheckProtocolDriver.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.drivers; 2 | 3 | public class KYCCheckProtocolDriver { 4 | private StubExternalKYCCheck kycCheck; 5 | 6 | public KYCCheckProtocolDriver(StubExternalKYCCheck kycCheck) { 7 | this.kycCheck = kycCheck; 8 | } 9 | 10 | public void approveAccount(String account) { 11 | kycCheck.onVerifyApproveAccount(account); 12 | } 13 | 14 | public void rejectAccount(String account) { 15 | kycCheck.onVerifyRejectAccount(account); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/drivers/StubExternalKYCCheck.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.drivers; 2 | 3 | import com.cd.acceptance.examples.accounting.ExternalKYCCheck; 4 | 5 | import java.util.HashSet; 6 | import java.util.Set; 7 | 8 | public class StubExternalKYCCheck implements ExternalKYCCheck { 9 | private Set validUsers = new HashSet<>(); 10 | 11 | public void onVerifyApproveAccount(String account) { 12 | validUsers.add(account); 13 | } 14 | 15 | public void onVerifyRejectAccount(String account) { 16 | validUsers.remove(account); 17 | } 18 | 19 | @Override 20 | public boolean verifyAccount(String name) { 21 | return validUsers.contains(name); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/dsl/AccountRegistrationDsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.dsl; 2 | 3 | import com.cd.acceptance.dsl.utils.Params; 4 | import com.cd.acceptance.examples.stubdemo.drivers.KYCCheckProtocolDriver; 5 | 6 | public class AccountRegistrationDsl { 7 | private final Params.DslContext context; 8 | private final KYCCheckProtocolDriver protocolDriver; 9 | 10 | public AccountRegistrationDsl(Params.DslContext context, KYCCheckProtocolDriver protocolDriver) { 11 | this.context = context; 12 | this.protocolDriver = protocolDriver; 13 | } 14 | 15 | public void approveAccount(String... args) { 16 | Params params = new Params(context, args); 17 | String account = params.Alias("name"); 18 | 19 | protocolDriver.approveAccount(account); 20 | } 21 | 22 | public void rejectAccount(String... args) { 23 | Params params = new Params(context, args); 24 | String account = params.Alias("name"); 25 | 26 | protocolDriver.rejectAccount(account); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/dsl/Dsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.dsl; 2 | 3 | import com.cd.acceptance.dsl.utils.Params; 4 | import com.cd.acceptance.examples.accounting.DummyAccountingSUT; 5 | import com.cd.acceptance.examples.stubdemo.drivers.DummyAccountingSystemProtocolDriver; 6 | import com.cd.acceptance.examples.stubdemo.drivers.KYCCheckProtocolDriver; 7 | import com.cd.acceptance.examples.stubdemo.drivers.StubExternalKYCCheck; 8 | import org.junit.Before; 9 | 10 | public class Dsl { 11 | private final Params.DslContext context = new Params.DslContext(); 12 | 13 | protected InvoicesDsl invoices; 14 | protected AccountRegistrationDsl accounts; 15 | 16 | @Before 17 | public void setUp() { 18 | // In reality the Protocol Driver would connect to the real "System Under Test" 19 | // For the purpose of this example, we use a simple class to represent the SUT here. 20 | // A real Protocol Driver would do whatever it takes to translate from DSL to interactions with the SUT 21 | StubExternalKYCCheck kycCheck = new StubExternalKYCCheck(); 22 | DummyAccountingSUT sut = new DummyAccountingSUT(kycCheck); 23 | 24 | invoices = new InvoicesDsl(context, new DummyAccountingSystemProtocolDriver(sut)); 25 | accounts = new AccountRegistrationDsl(context, new KYCCheckProtocolDriver(kycCheck)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/cd/acceptance/examples/stubdemo/dsl/InvoicesDsl.java: -------------------------------------------------------------------------------- 1 | package com.cd.acceptance.examples.stubdemo.dsl; 2 | 3 | import com.cd.acceptance.dsl.utils.Params; 4 | import com.cd.acceptance.examples.stubdemo.drivers.AccountingSystemProtocolDriver; 5 | 6 | import java.util.List; 7 | 8 | public class InvoicesDsl { 9 | private final Params.DslContext context; 10 | private final AccountingSystemProtocolDriver driver; 11 | 12 | protected InvoicesDsl(Params.DslContext context, AccountingSystemProtocolDriver driver) { 13 | this.context = context; 14 | this.driver = driver; 15 | } 16 | 17 | public void createAuthorisedAccount(String... args) { 18 | Params params = new Params(context, args); 19 | 20 | String name = params.Alias("name"); 21 | String role = params.Optional("role", "Accountant"); 22 | String password = params.Optional("password", "password123"); 23 | 24 | driver.createAuthorisedAccount(name, password, role); 25 | } 26 | 27 | public void submitInvoice(String... args) { 28 | Params params = new Params(context, args); 29 | 30 | String userName = params.Alias("name"); 31 | String invoice = params.Optional("invoice", "anInvoice"); 32 | String purchaseOrder = params.Optional("po", "po1"); 33 | String invoiceNumber = params.OptionalSequence("InvoiceNo", 1); 34 | String total = params.Optional("total", "0"); 35 | List items = params.OptionalList("item", new String[] {"item1"}); 36 | 37 | driver.submitInvoice(userName, invoice, purchaseOrder, invoiceNumber, items, total); 38 | } 39 | 40 | public void confirmInvoiceSubmitted(String... args) { 41 | Params params = new Params(context, args); 42 | 43 | String userName = params.Alias("name"); 44 | String invoice = params.Optional("invoice", "anInvoice"); 45 | 46 | driver.confirmInvoiceSubmitted(userName, invoice); 47 | } 48 | 49 | public void confirmPendingAuthorisations(String... args) { 50 | Params params = new Params(context, args); 51 | 52 | String userName = params.Alias("name"); 53 | String pendingItem = params.Optional("pendingItem", "someItem"); 54 | 55 | driver.confirmPendingAuthorisations(userName, pendingItem); 56 | } 57 | 58 | public void confirmInvoiceRejected(String... args) { 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/feature/AddBookToBasketSteps.java: -------------------------------------------------------------------------------- 1 | package feature; 2 | 3 | import com.cd.acceptance.examples.bookshopping.CucumberDsl; 4 | import cucumber.api.java.en.Given; 5 | import cucumber.api.java.en.Then; 6 | import cucumber.api.java.en.When; 7 | 8 | /** 9 | * Copyright (c) Continuous Delivery Ltd. 2016 10 | */ 11 | public class AddBookToBasketSteps 12 | { 13 | private CucumberDsl dsl = new CucumberDsl(); 14 | 15 | @Given("^I search for books about \"([^\"]*)\"$") 16 | public void i_search_for_books_about(String subject) throws Throwable { 17 | dsl.shopping.searchForBook(subject); 18 | } 19 | 20 | @Given("^I select a book by \"([^\"]*)\"$") 21 | public void i_select_a_book_by(String author) throws Throwable { 22 | dsl.shopping.selectBook(author); 23 | } 24 | 25 | @When("^I add my selected book to my shopping-basket$") 26 | public void i_add_my_selected_book_to_my_shopping_basket() throws Throwable { 27 | dsl.shopping.addSelectedItemToShoppingBasket(); 28 | } 29 | 30 | @Then("^I can see the book \"([^\"]*)\" listed in my shopping-basket$") 31 | public void i_can_see_the_book_listed_in_my_shopping_basket(String title) throws Throwable { 32 | dsl.shopping.assertItemListedInShoppingBasket(title); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/feature/AddBookToBasketTest.java: -------------------------------------------------------------------------------- 1 | package feature; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | import cucumber.api.junit.Cucumber; 6 | 7 | @RunWith(Cucumber.class) 8 | public class AddBookToBasketTest 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/feature/OrderBook.feature: -------------------------------------------------------------------------------- 1 | Feature: Add Book to Shopping-Basket 2 | As a book-buyer 3 | I would like to select a book and add it to my shopping-basket 4 | So that I can pay for it later 5 | 6 | Scenario: 7 | Given I search for books about "Continuous Delivery" 8 | And I select a book by "David Farley" 9 | 10 | When I add my selected book to my shopping-basket 11 | 12 | Then I can see the book "Continuous Delivery" listed in my shopping-basket 13 | --------------------------------------------------------------------------------