380 likes | 391 Views
Shopzilla's Inventory Management Platform (IMP) is a powerful system designed to help shoppers find the best value for products and assist sellers in managing their inventory. It offers features such as product comparison, trusted ratings and reviews, and access to a wide range of products and stores. This platform is supported by Merchant data, providing a seamless shopping experience for both buyers and sellers.
E N D
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… 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.
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
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
The Challenge: Need to migrate off the current Inventory system…
…to a future architecture: r The Inventory Management Platform (IMP)
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
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!
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
What to test? Service contracts
What to test? Pipeline contract
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
Languages and Frameworks • Java: • JBehave • JDave • Cucumber-JVM • Groovy: • EasyB • Python: • Lettuce
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
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
BDD for Services – code layout… StepDefs for each domain entity Asynchronous processing!
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); } }
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
Advanced Testing Techniques (1)… • Mostly from: • Outside-in testing Inner and outer feedback loops in TDD Source: Freeman et al
Advanced Testing Techniques (2)… • Sensible defaults • Polling for results
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!
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