Skip to content

guywaldman/db_systems_hw4_tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HW4 Wet Tests 🚀

Caveat

These tests might not be 100% accurate, may contain mistakes and may contain false positives/negatives. Please use them at your discretion

Requirements

  • MongoDB shell version: >=3.4.6
  • MongoDB server version: >=3.4.6

Usage

With Node.js

Make sure that you've moved script.js to the root directory, the NPM scripts rely on this.

$ npm run test

Without Node.js

Assuming your MongoDB server is running on localhost:27017. Otherwise, run instead of the first command, for example:

  # replace <address:port> as needed
$ mongo <address:port> test/lib/populate.js
  # populate the DB
$ mongo test/lib/populate.js
  # run your script
$ mongo script.js
  # run the test
$ mongo test/script.test.js
  # drop the collections
$ mongo test/lib/destroy.js

If the above doesn't work

Try running from the mongo shell:

#!/usr/local/bin/mongo

// populate the DB
load('test/lib/populate.js');
// run your script
load('script.js');
// run the test
load('test/script.test.js');
// drop the collections
load('test/lib/destroy.js');

In either case, you can always just run the populate.js script which (surprise, surprise) populates the DB, running your script and then comparing the results1, results2, results3 collections to the expected one (see the diffing part).

Output

If you passed, there should be no special output. Something like this:

screenshot

If you failed, there should be indication as to which test you've failed (and sometimes a suggestion as to why you probably failed).

screenshot

Diffing

To see expected output, run:

$ mongo test/lib/showExpected.js

About

Tests for 236363 HW4 wet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published