DOWNLOAD xUNIT: https://github.com/dschaffe/brackets-xunit
The goal of the extension is to help with the setup and execution of unit tests during creation so the user can focus on the test content. Once installed the extension will detect a file is a unit test by it’s extension or content. The unit test will have a menu item in the project context menu to run the test. The extension generates the necessary framework files and html to run the test and display the results in brackets.
Once installed you can open the
brackets-xunit/samples directory in brackets. When right-clicking any of the test files in the file navigator a menu item to run the test will appear. For example click on the
jasmine.spec.js file and select
Run Jasmine xUnit Test. You will see a new window appear with the title Jasmine Test â€“ jasmine.spec.js. Inside the window will be the jasmine test results. The results appear the same as if you downloaded Jasmine and ran in a browser. You may then modify the test file, change test values or add new tests. After saving, rerun the test to view the results. If you encounter problems, it is useful to be able to edit and rerun tests quickly to get instant feedback.
A new feature in the extension is the ability to create skeleton unit tests. In the
samples/simpleapi directory, right-click on the
mathfns.js file to generate a skeleton unit test file for Jasmine, Qunit, or YUITest. Selecting
Generate Jasmine will create a new file called
mathfns.spec.js. The file contains a unit test describe function for each of the 4 methods defined in the
mathfns.js file. Each “describe” function contains an “it” function with an “expect” assertion. You can fill in the parameter values and expected values to make a unit test for the function. The test generation feature is meant to help you get started writing unit tests for an api in any of the supported unit test frameworks.
The extension also uses the built-in node.js server to run additional scripts. Any shell scripts with
#!/usr/bin in the header can be run. Try clicking on each of the scripts in the sample directory to see their output as they run inside brackets. The file
bashscript.sh is a bash shell script,
pythonscript.py runs python, and
There is also experimental support for running test262 (the ECMAScript standard) tests from within Brackets. The extension is still under development. Let us know if you have any feedback or suggestions.
Here is a short video that highlights all the features of xUnit.