Nebula contains tools for diagnosing and debugging MSL applications, including component and language debugging for Worlds and Streams.
Component debugging involves finding and fixing bugs in directives and controllers. Nebula provides a debugging panel and a debugging message function which writes to it.
The debugging panel, mxDebug
(See Nebula Directives), is a collapsible interface that collects messages from the mxDebug()
function which you can use in your own code. mxDebug()
is declared globally and doesn't require injection into your modules.
Open and close the debugging panel with the icon in mxNavigation
that appears at the top of the screen.
Debugging information is collected whether the panel is open or closed. When open, the debugging panel consists of two columns.
mxDebug()
.Call mxDebug()
in your module to add a message to the bottom of the debug list. The name of your function is detected automatically.
The function accepts any number of arguments and concatenates them with a space to create the final message.
Inside mslWebSocket.js
:
//Debug Info
mxDebug(messageNumber, "PMCS Setup:", wireType);
Nebula includes a mimix-debug
class which can be added to any AngularJS or HTML element with a mimix-color
in order to draw a colored border around the element for debugging purposes. Use different colors to help diagnose CSS, alignment, or nesting problems which are common with HTML/JS applications.
Inside mxTestbed.js
:
<!-- Test Strip TEST NUMBER Column -->
<div ng-if="mxTestbed.isEditMode() != $index" class="col-xl-1 mimix-debug mimix-orange" style="cursor:pointer;background-color: #000000;padding-left:5px;padding-right:6px;width:100%">
The Nebula Testbed can be used to debug streams of MSL expressions from plain text files (MSL Text) or from JSON arrays (Test Lists).
To work interactively with streams, use the Communicator to send individual MSL expressions or admin messages. Note that switching to the Communicator results in the default test list being loaded when you return to the Testbed.
To develop tests for a new feature or bug, start with an empty list. (Hold Shift and click empty-list
on the list control row.) Use the test strip to light-up the bits for the features your first expression will test. Click the generated test number in the strip to push the number to your new, empty test. Compose your test with the message to send, the expected MSL, and the expected admin results. Run your test interactively from the editing panel. When satisfied, add a new blank test (or a copy of this one) and continue building your test list. Save the list as a JSON file with a unique name to help you identify which features are being tested.
When debugging a new problem, load (or create) a test list file which shows the failure. Save the file with the results using the save-info
icon on the list control row. By loading the test file with results, old results with the failure can be compared with new results (by running live) during debugging.
To run a sequence of several MSL expressions, save them into an MSL text file and load them into the MSL text editor (or copy-and-paste them there). Start with an empty test list (Hold Shift and click empty-list
on the list control row.), then push the MSL text to the list by clicking msl-text
on the MSL text editor row. Run the test list immediately or use the editing panel on individual rows to fill-in the MSL Expected and Admin Expected values as development progresses.
During development of your application, you can run the Nebula viewer in a browser. This allows interactive development without packaging the Electron app for distribution until you're ready. To do so, point a local web server to index.html
and visit it in your browser. See Nebula Viewer to install the viewer source.
As a further debugging tool, the Nebula Streams server can be run interactively from a SBCL command prompt. When doing so, it logs all received and sent messages to the console. See Nebula Streams to install the SBCL source for interactive use.
When the mxDebug
window is open, an additional row of information appears below the strip. Click the binary number
in this debug row to reset the strip to its default values as specified in the test-strip.json
.