Let's test the code you've just created.
A window appears with the result that will appear when we execute the script with the test data.
You tested the code of the JavaScript step.
You clicked on the Test script button, and created a dataset that served as the basis for testing the script. You previewed the test dataset.
After that, you did the test itself. A window appeared showing you how the created dataset looks like after the execution of the script—the totalScore
and wAverage
fields were added, and the skill
field was converted to uppercase.
The Test script button allows you to check that the script does what it is intended to do. It actually generates a transformation in the back with two steps—a Generate Rows step sending data to a copy of the JavaScript step. Just after clicking on the button, you are allowed to fill the Generates Rows window with the test dataset.
The first thing that the test function does is to verify that the code is properly written; that is, that there are no syntax errors in the code. Try deleting the last parenthesis in the code and click on the Test script button. When you click OK to see the result of the execution, instead of a dataset you will see an error window.
If the script is syntactically correct, what follows is the preview of the JavaScript for the transformation in the back, that is, the JavaScript code applied to the test dataset.
If you don't see any error and the previewed data shows the expected results, you are done. If not, you can check the code, fix it, and test it again until you see that the step works properly.
3.15.229.161