Skip to content

jmcuneo/JSTestingNoFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Unit Testing Without a Framework

A basic set of JavaScript unit testing functions that can be used without a framework, built for CS 4731 (Computer Graphics) at WPI to be used with WebGL programs. The functions are integrated into a simple WebGL example to show how they can be used. The methods in tests.js are testing two of the methods from cs4731pjt1.js, which is one of the libraries we give you for Project 1.

When your page loads, the status of each test will appear in your Console in your Web Developer Tools. The tests below all pass:

Passing tests in console

Make sure that the console is set to show Log messages (circled in red), or any passing tests won't appear.

If one or more tests fail, you'll see something like the following:

A failing test in console

Remember that proper unit testing means you should minimize your reliance on global variables in your main program, as these make unit testing harder and more error-prone. Try to pass in whatever you need as parameters.

Note that some functions cannot be unit tested, such as ones that send data to the vertex shader, set event handlers, or initialize the drawing canvas. Try to keep testable and non-testable functionality as separate as possible to maximize the amount of code logic you can unit test.

About

A basic set of JavaScript unit testing functions that can be used without a framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors