Information for: DEVELOPERS   PARTNERS

Testing a graph

Acquia Journey allows graphs and nodes to be tested interactively prior to deployment. This allows the testing of individual components using user supplied test cases, by specifying one of an input data JavaScript object, a number of iterations of a graph or by specifying a fixed time duration. Graphs can only be tested when they are valid. Graph validity can be tested explicitly by pressing the Validate button at the top of the graph or this will be tested if the start button is pressed. If the graph is valid the Valid graph icon is displayed at the top right of the graph window. It is not necessary to validate the graph manually as the graph will be validated before the testing console is opened and any errors will prevent the testing console opening.

Testing console

The testing console is available at the bottom of the graph window and provides insight into the execution of each step in the graph and the state of the data store and public variables at the end of the execution. The testing console bar provides four buttons for control of the testing console. From left to right:

  • Start - Starts the graph engine and shows the Testing Settings window. Shown grey when the graph is executing. The Start button is only available for a valid graph.
  • Stop - Stops the execution of the current graph. Shown as green when the graph is executing.
  • Clear Logs - Clears out the Testing Console and removes information from all previous runs
  • Up and Down arrows - Maximise or minimise the Testing Console. The Console can also be enlarged or shrunk by grabbing the bar between the graph window and the console and moving it up or down

Testing Settings

At the start of each execution, after the Start button has been pressed, the Testing Settings window will appear.

The Testing Sessions window allows you to paste in some JSON data to be used as the input to the graph. This data could be the output of a previous graph test.

If the graph has a listener then the Testing Settings window will show the three modes of testing the graph.

The following interactive graph testing modes are available:

  • Iterations - For non-listening graphs the graph will always execute once. For listener graphs the number of iterations will limit the maximum number of times the graph is executed.
  • Duration - Specify the number of seconds that the graph should execute for - Applicable only to listener graphs
  • Data - Execute the graph using the supplied JSON data

Note that during visual testing there are some limits on graph execution:

  • Maximum number of iterations is 1,000
  • Duration - the maximum runtime of any graph is 30 minutes

These limits are set so that interactive graphs don’t lock up engines unnecessarily.

Testing Console output

The testing console will show the Running button if the graph is a listener. If the graph is not a listener then it will progress to the Finished state.

The Testing Console displays the following information for every node executed in the graph:

  • The name of the node and the type of the node if it is an adaptor
  • The execution time - usually in milliseconds
  • The return value of the node

The information in the testing console must be expanded using the plus icon. Second and subsequent runs appear below the first run.

After each execution the Data Store values for the schema and any public variables are also shown. The final state of the schema is available to be viewed and copied by pressing the Display JSON button.

Errors are shown highlighted in orange and show the detail of the error message from the engine.

If the graph is a listener and there are multiple iterations then the graph will show the path for a particular transaction if the mouse is held over that transaction. The graph highlights the path with an dark blue highlight.