1 / 38

BDD and Shopzilla’s Inventory Management Platform

BDD and Shopzilla’s Inventory Management Platform. April 2013 . Who we are…. “We are passionate about changing retail for the better. We build products that help shoppers shop and sellers sell.” . Some of our properties….

cili
Download Presentation

BDD and Shopzilla’s Inventory Management Platform

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BDD and Shopzilla’sInventory Management Platform April 2013

  2. Who we are… “We are passionate about changing retail for the better.We build products that help shoppers shop and sellers sell.”

  3. Some of our properties… Devoted exclusively to the joy of shopping, Beso offers rich content, editorial features, and products from the best stores on the web. It's a place where shoppers can discover new pieces, favorite their finds, build collections, and share their picks across the web. With the ability to compare across products, prices, and store information and access to trusted ratings and reviews, Bizrate and Shopzillahelp shoppers find the best value for all the products they are looking to buy. One of the largest consumer electronics shopping and review sites, where consumers can discover, learn about, and ultimately buy gadgets and gear. Retrevo welcomes more than 6 million gadget enthusiasts a month to our site for unbiased advice and a marketplace with trust merchants, low prices, and high quality products.

  4. Today’s agenda… • Architectural overview • Key principles during development • Technology trial and selection • What to test? • Blackbox testing • Whitebox testing • Languages and Frameworks • BDD for Services • BDD for Hadoop • BDD for web sites • Advanced Testing Techniques • What worked, what didn’t work

  5. All are powered by Merchant data… • 17,000 merchants • 200MM offers • Daily and intra daily processing of feeds submitted by Merchants • Processing of raw data: • Validation • Normalisation • Enrichment: • Classification • Alignment • Attribution • Image download • Image colour detection • Publishing to downstream systems -> mainly Search

  6. The Challenge: Need to migrate off the current Inventory system…

  7. …to a future architecture: r The Inventory Management Platform (IMP)

  8. Create a Platform: IMP version 1.0

  9. De-risking: Go to Production early… • Early understanding of: • Application / technology in OUR organisation • Prove it works throughout all environments: • Validate features ASAP • Decreases number features in ‘ready for release but not yet proven’ state • Allows focus on features Source: Freeman et al Easier if have good automated tests

  10. Walking Skeletons “A Walking Skeleton is the implementation of the thinnest possible slice of real functionality that we can automatically build, deploy and test end-to-end” Alistair Cockburn in Crystal Clear: A Human Powered Methodology for Small Teams …in production!

  11. Designing the system: Principles • Helps keep in-flux solution within guiderails, especially when more than one option • For IMP: • High throughput, low latency • Each "step" of the flow can be separately deployed and scaled • … • Can have test automation set up at the pipeline and service or (sub-workflow) level

  12. What to test? Service contracts

  13. What to test? Pipeline contract

  14. Blackbox and Whitebox testing using BDD • Strategy and responsibilities • Blackbox Responsibilities: • Test the system as a whole • Coordinate service configuration and deployment to cloud nodes. • Test individual service compatibility in the overall system • Test and verify the final output “published” files • Produce a published file from submitting a merchant feed that is run through 17 different services under the black box framework • Whitebox Responsibilities: • Primary and secondary scenarios – verify edge cases • Test the individual service, not worrying about downstream or upstream services

  15. Languages and Frameworks • Java: • JBehave • JDave • Cucumber-JVM • Groovy: • EasyB • Python: • Lettuce

  16. The evolution of the selected framework… • Whitebox BDD tests vsBlackbox BDD tests • Started writing in Python using Lettuce • Blackbox BDD tests in Python • Excellent framework that would be more complicated in Java…we thought • Switched Whitebox BDD tests to Cucumber: • Faster execution • Better error reporting – e.g. missing steps • Works with Maven(!) far more efficiently – take advantage of classpath etc. already set up • No local installs of libraries like Sybase – just need a jar

  17. Blackbox BDD tests: Components • Dedicated integration environment • Can become a bottleneck • Don’t run as fast as they could • Components: • test-deployer • test-runner • test-notifier • Component Responsibilities: • test-deployer • Configuration and deployment of inventory services into the cloud • Integration with Jenkinsand our deployment systems • test-runner • Wrapper tool to run the tests individually and aggregate the results • test-notifier • Email the results to a team alias

  18. BDD Blackboxorganisation…

  19. BDD Blackbox Test Example…

  20. BDD for Services – code layout… StepDefs for each domain entity Asynchronous processing!

  21. BDD for Services – encodings feature file…

  22. BDD for Services – asynchronous feature file…

  23. BDD for Services – World pattern… public class World { static final String PROCESS_PATH = "http://localhost:%s/feed-quality-service/services/feed-quality/process"; static final int MERCHANT = 78; static final int FEED = 0; static final int FEED_RUN = 12349; static final char OUTPUT_FILE_DELIMITER = '\t'; static final String INPUT_FILE = "feed.csv"; static final String OUTPUT_FILE = "mid_8/78/feed_0/imp/current/imp-78-0-validated.tsv"; static HttpServerhttpServer; static CannedResponseHttpHandlerdataIngestionHandler; @Before public void startMockedServices() throws Exception { dataIngestionHandler = new CannedResponseHttpHandler(); dataIngestionHandler.respond("{\"statusMessage\":\"SUCCESS\"}").type("application/json").to(RequestFilter.any()); httpServer = ImpServiceUtils.createHttpServer(); httpServer.createContext("/dataIngestor/process", dataIngestionHandler); httpServer.start(); } @After public void shutdownServices() throws Exception { httpServer.stop(0); } }

  24. BDD for Hadoop – code layout…

  25. BDD for Hadoop – feature file…

  26. BDD for Hadoop – World pattern (1)…

  27. BDD for Hadoop – World pattern (2)…

  28. BDD for Hadoop – World pattern (3)…

  29. BDD tests for websites – code layout…

  30. BDD tests for websites – feature file…

  31. BDD tests for websites – Selenium integration… • Run Firefox in headless mode on Jenkins • Requires xvfb and Firefox driver to be installed on Jenkins node • Maven scaffolding is key • :20 – the xvfb listen port • -ac – disables access control restrictions

  32. BDD tests for websites – Selenium integration (1)

  33. BDD tests for websites – Selenium integration (2)

  34. BDD tests for websites – Selenium integration (3)

  35. Advanced Testing Techniques (1)… • Mostly from: • Outside-in testing Inner and outer feedback loops in TDD Source: Freeman et al

  36. Advanced Testing Techniques (2)… • Sensible defaults • Polling for results

  37. What did not work… • Evolutionary path • Lettuce tests slow, Cucumber-JVM fast! • Development efficiency – Java vs Python • Original StepDefs were per feature file – anti pattern! • cucumber-jvm and JUnit had a bug with Sonar – patch them! • Now would probably re-write the blackbox tests in Java – we have!

  38. We are hiring! • Follow me on Twitter: @mikquinlan • Email: mquinlan@shopzilla.com • Software Engineers • Senior Software Engineers • Data Architect • Front End Engineers • Hadoop Data Ops • Senior Hadoop Administrator http://about.shopzilla.com OR Google Search: Shopzilla Jobs

More Related