How to Run a Test

To test your work as you develop each method of your Connector, you should run your tests within Forge. This allows for quick turnaround on adjusting your methods and modules as you go, alongside your code.

To run a test within Forge, select the method you would like to test, and then select the “Run” button in the upper right. Once clicked, the Run panel will pop up. In this panel, there will be a text field for Auth, Params, Inputs and Since.

For each text field, there will be a generated code schema that matches the schema specified in that method. For example, if your “Input” section has a “Character” header with the field “Character ID”, this text box will have a “Character” header with a spot to input the value you would like to test with.

To run a test, you should fill in each area of your Auth, Params and Inputs schema with the values that you would like to test against. It is not necessary to fill in values for blank or empty schemas, the test will run without it. However, you cannot run an Event method without inputting a “Since” value, so you can simulate grabbing data properly.

Once everything is set up, push “Submit”. At this point, all of the testing data will be generated as logs created by Forge as it simulates a run of that method.

Interpreting Logs

Once you’ve ran a test, you will see logs appear in the console below your code. On the left side of the console is a log navigation panel, and on the right side will be the actual JSON objects and responses passed around between the modules in your method.

The left navigation panel is sorted by the time that the step is executed, and is labeled by the type of module that enacted function originated from. Once a step on the left side is selected, the right side of the pane will auto-scroll through the list of responses to the response that corresponds to that log. You will be able to see the shape and values of the JSON objects you are manipulating to run your Connector.

Errors will show up in red, and can be filtered to by selecting the “Errors” tab. These runtime errors will show you which step failed, and from what call.

Using Control.Log

If in the case you want to control your own logs, Forge has a Control.Log module that will allow you to output logs into our logging console that you fully control. To use this, insert a Control.Log module into your method relative to where you would like it to show up in the Forge logger. For example, if you want a log to appear at the end of a method’s execution, you should put the Control.Log into your method as the last module.

Then, to specify what content you would like placed in the Forge logger, you will need to place your desired logs as items within the Control.Log’s “inputs” object.

Example:

{
"brick": "control.log",
"id": "log brick",
"inputs": {
"[insertName]" : "Test!!!!!!!!!!!!!!!! + {{input.Character.CharacterID}}",
"outputs": {}
}