Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
In the previous step, you created an Entity with a customized Service. You can easily test and update the Service within the same editing window. This allows you to quickly modify a Service and confirm that its new behavior is functioning as expected.
To execute a Service, you can do it while still developing and after you have created it.
If you scroll to the bottom of the page, you will see the Execute window. Enter a value for the TemperatureThreshold and click Execute.
Click the ListHotLineParts Execute play button.
Store input parameters makes testing during development and after development much faster. Whether you are testing base cases, specific scenarios, or throwing everything you possibly can at your Service, this tab will allow you to store and name test cases for later usage.
If you scroll to the bottom of the page, you will see the Execute window. Enter a value for the TemperatureThreshold and click Save Input Set.
Click the ListHotLineParts Execute play button.
While this example is pretty simple and straightforward, it is also possible to store other values and other data types! You will be provided with a dropdown of your stored test cases. Just select a case and click Execute.
You will now see the Services and Properties that were created inside of the LinePartTemplate or passed down in its object-oriented model.
Linting is a process by which your development environment warns you of possible issues even before any attempt to run or test the code. Instead, an in-editor warning pops up that alerts you to the issue as you’re writing your code. Linting is yet another feature which many IDEs provide outside of the IoT realm.
Select the Lint checkbox at the top of the Service-editing section.
Services within the composer are based on the Rhino JavaScript engine, which is built using Java.
It is currently unavailable to see the JavaScript code running within the browser, but you are able to still log what is occurring at each step of development and runtime. ThingWorx provides logging that will go to the ScriptLog under the Monitor section on the left. The logger uses different log levels that will appear differently in the ScriptLog screen.
Level | Syntax | Example |
info | logger.info | logger.info("X + 1 = " + 5); |
trace | logger.trace | logger.trace("Print this InfoTable - " + table.toJSON()); |
warning | logger.warn | logger.warn("Print random JSON data - " + JSON.stringify(data)); |
debug | logger.debug | logger.debug("Adding debug information here."); |
error | logger.error | logger.error("What kind of error took place? " + err.message); |
From the Lint website, here are some common mistakes that JavaScript Lint looks for:
JavaScript Lint also looks for the following less common mistakes:
Congratulations! You've successfully completed the Application Development Tools, Tips & Tricks, and learned how to:
We recommend the following resources to continue your learning experience:
Capability | Guide |
Build | Create Custom Business Logic Guide |
Experience | Create Your Application UI |
If you have questions, issues, or need additional information, refer to:
Resource | Link |
Community | Developer Community Forum |
Support | Help Center |