Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

Because control the contents the test data

our writes require us to read our own write, this technique will significantly impact throughput and latency.


The example graphs we create for each test comprise the setup or context for that test. Within this context we exercise a query, and assert that the query behaves as expected. Because we control the contents of the test data, we, as the author of the test, know what results to expect.

Tests can act like documentation. By reading the tests, developers gain an under‐standing of the problems and needs the application is intended to address, and the ways in which the authors have gone about addressing them. With this in mind, it’s best to use each test to test just one aspect of our domain. It’s far easier to read lots of small tests, each of which communicates a discrete feature of our data in a clear, sim‐ple, and concise fashion, than it is to reverse engineer a complex domain from a sin‐gle large and unwieldy test. In many cases, we’ll find a particular query being exercised by several tests, some of which demonstrate the happy path through our

Testing | 85

First, we create a small graph that is representative of our domain. Using Cypher, we create a network comprising 10 nodes and 8 relationships:

publicGraphDatabaseServicecreateDatabase() {
// Create nodes
"(ben:User {name:'Ben'}),\n"+
"(arnold:User {name:'Arnold'}),\n"+ "(charlie:User {name:'Charlie'}),\n"+ "(gordon:User {name:'Gordon'}),\n"+ "(lucy:User {name:'Lucy'}),\n"+
"(emily:User {name:'Emily'}),\n"+ "(sarah:User {name:'Sarah'}),\n"+ "(kate:User {name:'Kate'}),\n"+
"(mike:User {name:'Mike'}),\n"+
"(paula:User {name:'Paula'}),\n"+ "(ben)-[:FRIEND]->(charlie),\n"+
"(charlie)-[:FRIEND]->(lucy),\n"+ "(lucy)-[:FRIEND]->(sarah),\n"+
"(arnold)-[:FRIEND]->(gordon),\n"+ "(gordon)-[:FRIEND]->(emily),\n"+ "(emily)-[:FRIEND]->(kate),\n"+

86 |
How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELI62C3E77
Uploaded by :
Page 1 Preview
because control the contents the test data
Sell Your Old Documents & Earn Wallet Balance