JS Agent / Admin Backend Communication
#
Messages#
AdminAdmin backend sends messages in the following format:
"text" field is stringified.
Admin backend expects to get a response for each message, called "delivery confirmation" in the following format:
Some messages aren't used in JS agent initialization, so no actions are performed on JS agent side, but delivery confirmation is still sent:
- /agent/change-header-name
- /agent/set-packages-prefixes
- /agent/load-classes-data
#
Plugin"content" field is stringified.
#
Agent Registration & Test2Code Plugin InitializationOpen WS connection to Admin backend API on the /agent/attach route (e.g. http://localhost:8090/agent/attach) with the following headers specified:
At that point, agent should appear in Admin Panel. Register it, make sure to enable Test2Code plugin at step 3.
Wait for the following message:
In response to that particular message JS agent sends 2 delivery confirmations:
send that first:
send delivery confirmation for the original destination:
"AST" data (metadata on packages, classes, methods) are sent during the next steps.
Wait for the following message:
Send containing "AST" data:
Send delivery confirmation for
/plugin/togglePlugin
:
At that point, test2code plugin dashboard should be available in the Admin Panel. Check that methods table reflects actual packages, classes and methods.
#
Start SessionWait for the "Start agent session" message:
Send "Session started" message:
Send delivery confirmation:
#
Send CoverageThat might be better to implement it differently for the .NET agent, we've got to discuss that.
Send coverage data part message:
#
Stop/Cancel SessionWait for the "Stop agent session" message:
Send "Session finished" message:
Send delivery confirmation:
#
Init Active ScopeWait for the "Init active scope" message:
Send the "Scope initialized" message:
Send delivery confirmation: