How does one unit test an object or collection - specifically a JSON packet?? Do you just test for he structure, key/values pairs? regardless of values??
Do I create an empty collection? and compare? same question applies to any complex object (query,structure,array, etc)
Any help by real examples would be greatly appreciated.
Im just getting started with TDD, and using MXUnit... Im not really quite sure where to begin... Here is a sample of one basic test,
// Arrange // obj set up - handled in "setup" // Act var expect = 1; var result = obj.getPersonByID(); debug( result ); // throws data back to the tester for display // Assert assertEqual( expect, result, 'Expected #expect#, got #result#.' );
Use the following process:
References
Unit Testing the MVC JSON Result
Closure Library Source: closure.goog.net.jsonp_test