JSCheck is a JavaScript library for property-based testing. You declare a function property, provide input generators, and let the library run many randomized cases, including abnormal edge cases that manual tests may miss. section 6.4
A JSCheck test typically combines these parts:
- A named property test describes the behavior being checked. section 6.4
Testing an average-grade property
JSC.test('Compute Average Grade', function (verdict, grades, grade) { return verdict(computeAverageGrade(grades) === grade); }, [JSC.array(JSC.integer(20), JSC.number(90, 100)), 'A'], function (grades, grade) { return 'Testing for an ' + grade + ' on grades: ' + grades; }); This generates 100 grade arrays in the shown run and reports 100 passing cases.
Custom specifiers extend the input vocabulary. An SSN generator can combine three integer generators and join their results with dashes, allowing the same property-testing workflow to exercise structured strings.
