Examples of unit testing methods that are expected to return JSON

Like a single unit test object or collection - specifically a JSON package? Are you just checking its structure, key / value pairs? regardless of values

Create an empty collection? and compare? the same question applies to any complex object (query, structure, array, etc.)

It would be helpful to evaluate any help with real world examples.

  • I am just starting with TDD and using MXUnit ... Im not quite sure where to start ... Here is an example 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#.' );
    
+3
source share
1 answer

Use the following process:

0

All Articles