Commit Graph

13 Commits

Author SHA1 Message Date
Jesse Gibson
fe0f9aabf5 Restrict access to bump, begin client framework. All tests passing.
There were some race conditions involving the `bump` function, where some tests were failing because synchronous code was not acting as synchronous as it should (and I'm still not quite sure what's causing it). I've removed access to the bump function in the Test constructor (side note: none of the tests broke when I did, so apparently there was no coverage).

The client logic has been revised, as some of it was untested and wouldn't be useful for quite some time. I'm be starting with the context parser, then I'll be moving onto platform/ID filtering, then onto test runners/client context instances.
2016-03-03 18:25:33 -07:00
Jesse Gibson
3081fbc9d6 Add event emitter, always name tests
Created an event emitter instance for reporters and the test stack. Currently, the only event that fires is "begin".

All tests are now named, whether by their given name or as the name "Anonymous".
2016-03-03 17:14:52 -07:00
Jesse Gibson
87332c088b Add UID to each test, save test name when available
Each test now has a unique ID to reference by. This will be useful for reporters and tracking of "done" events. Also, each test now saves the name it's been given.
2016-03-03 16:26:41 -07:00
Jesse Gibson
3e4946951a Test coverage, imperative instead of declarative test syntax
After discussing the goals for panic more with Mark and Sean, I decided to take panic in a different direction. Previously, the interface used an options object to do test setup, and was completely declarative in nature. In order to do more complex things with the framework, it would have needed new features hacked into the existing one, without a solid, well tested foundation to build on. That was a bit frightening. As radical as it was, I decided to mostly rewrite the framework to be similar to a traditional test framework (such as jasmine or mocha), with a major twist - it will send your tests out to the connected clients to be run, and you can filter which platforms/peer IDs to run on. Since the approach is more imperative, it will be more verbose, but it also allows for faster scaling, ease of adding new features, more expressive/flexible tests, greater coverage, and approachable syntax.

With luck, panic will be around for quite some time. If that's the case, it really, really needs high test coverage, so I began with jasmine from the start. In addition, who's going to trust results from an untested test framework?
2016-03-03 14:40:51 -07:00
Jesse Gibson
a2dec1432c Add tests for the polyfill file, add function parsing for new direction
Some major modifications are coming to panic. For one, it's been decided that there will be a test file that sends test instructions to a variable number of peers and performs checks across machines to ensure the data saved correctly. In order to relay the test instructions and have an easy, flexible test interface, it's been decided that eval will be used to send setup/test functions out to the peers (eval is horrible, we know. This is only for the test framework for browsers that opt into our stress-test DDOS network. I'm gonna stop talking now).
2016-03-01 16:12:50 -07:00
Jesse Gibson
be781b5d8d Tether to UI, upgrade to gun@0.3, organize files, clean code, capture errors, add progress events, better type checking for patch.js, more polyfills, more reliable checking for finish events, server improvements
You can now boot up tests from the homepage using the UI. It's powered by jQuery.

The tests are now using the latest, greatest version of gun, v0.3.

Files now organized into folder "lib" for clarity and cleanliness.

Numerous code cleanliness improvements.

Now, if errors are passed to the acknowledgement listener, they're pushed to an array of errors on that request.

Now each time there's a response,  the statistics are recalculated and are passed to an optional progress callback.

Patch.js now has stronger type checking against the data it's been given.

Added more polyfills to aid in development, like wrapping console.log in a closure to bypass the console interface error.

The timeout accuracy and code clarity has been improved.

Server is now upgraded to use gun@0.3, and the level options have been better tailored to the application.
2016-01-07 14:20:10 -07:00
Jesse Gibson
9b3d4f29f3 Death to .DS_Store
Plaguing commits everywhere, since mac, because mac.
2015-12-22 14:09:41 -07:00
Jesse Gibson
c5e8625acc Full configuration, automatic browser tab manipulation, statistics, progress events, completion event, de-duplication of acknowledgments, accurate recursive test runners, prep for selenium instantiation, included polyfills and extensions.
New barrage of options now accepted (providing defaults in absence), such as a progress callback, a done callback and timeout configuration, a data generation function, etc...

Browser constructor meant to open new tabs, run the test (using the given options), and close the tab when finished. There is no loss of options by doing this (although it has had a notable effect on performance when the tab is not in focus).

Each progress event and the done event recieve the options object with statistics embeded in the "stats" property. It has details like the average latency, the total elapsed time, the acknowledged packets, the fastest/slowest times, etc...

Acknowledgments can fire more than once, and for now it dedupes those and only fires once. In the future I may change this to include every acknowledgment. For data!

The recursive test runner wasn't running the correct number of times (due to confusion and off-by-1 errors)... that has been fixed.

The test file checks to see if there were options globally declared. If so, run the test using those. In the future we may use selenium to boot up the browsers, and we'll need some way to kick off the test and provide options. That was a nice compromise.

I've included some useful polyfills (like interfacing with console.log so it can be passed naked to other functions, Object.keys polyfill for counting confirmed objects) and some extensions (like valMapDone).

Next steps include adding the gun instance to the options object, statistics for errors, node compatibility and the such.
2015-12-22 13:36:50 -07:00
Jesse Gibson
a601ec9da9 Implemented interval option, better defaults and a bug fix.
Interval option built with a recursive setTimeout (not setInterval) that tracks it's invoked number.

Patch function now determines it's own ID if it isn't provided, meaning that the opts-must-be-object requirement isn't needed. In other words, all options are optional (wow).

Bug fix: minor thing where I was using gun before it was defined. This was due to minor tweaking just before a commit and not having unit tests to shout at me :(
2015-12-17 23:50:59 -07:00
Jesse Gibson
d38154cb6f Test gun by passing options, Browser constructor automatically begins a test on a new window, added package.json, patch function for options (validation/default values).
Exposed a function named "test" that takes an options object, with things like how many gun requests to fire in total, what data to send, where to put it, what peers to connect to, etc...

Exposed a Browser constructor that opens up a new window and runs the test function with the options provided, returning an interface to the window.

Added a patch function to validate the option input and provide defaults where there aren't any values.
2015-12-17 23:20:57 -07:00
Jesse Gibson
aa4d9b550c Add readme 2015-12-17 19:45:56 -07:00
Jesse Gibson
8357991b11 Revised to ignore the despicable .DS_Store file 2015-12-17 19:37:01 -07:00
Jesse Gibson
f6a4132efb Initial commit (boilerplate)
index.html used from @amark
2015-12-17 19:34:01 -07:00