Write your own executor#
The AltWalker executor is responsible for executing your tests. AltWalker provides you with a Python3 and C#/.NET executor by default. You can hook up your own executor via HTTP.
Your HTTP executor should be able to create a test execution context and execute tests. The context is initialized with path to tests provided via load route.
Executor Routes#
Root URL: /altwalker
Load#
Should load test code from a given path. AltWalker calls load with the TEST_PACKAGE
argument given to the verify, online and walk commands.
URL:
/loadMethod:
POSTData Params:
{ "path": "..." }
Success Response:
Code:
200
Error Response:
Codes:
463: Path Not Found464: Load Error (in case the path to load is invalid)
Sample Call:
curl -X POST -d '{"path": "path/to/my/tests"}}' -H 'Content-Type: application/json' http://localhost:4200/altwalker/load
Reset#
Should reset the current execution context.
URL:
/resetMethod:
PUTSuccess Response:
Code: 200
Error Response:
Codes:
465: No Test Code Loaded
Sample Call:
curl -X PUT http://localhost:4200/altwalker/reset
Has Model#
Should check if a model exists. Is used by the verify command.
URL:
/hasModelMethod:
GETURL Params:
Required:
name=[string]Success Response:
Code:
200Content:
{ "payload": { "hasModel": true } }
Sample Call:
curl http://localhost:4200/altwalker/hasModel?name="ModelName"
Has Step#
Should checks if a step exists. Is used by the verify command.
URL:
/hasStepMethod:
GETURL Params:
Required:
name=[string]Optional:
modelName=[string]The
modelNameis not needed forsetUpRunandtearDownRun.Success Response:
Code:
200Content:
{ "payload": { "hasStep": true } }
Sample Call:
curl http://localhost:4200/altwalker/hasStep?name="setUpRun"curl http://localhost:4200/altwalker/hasStep?name="setUpModel"&modelName="ModelName"
Execute Step#
Should executes the step. Is used by the online and walk commands.
URL:
/executeStepMethod:
POSTURL Params:
Required:
name=[string]Optional:
modelName=[string]The
modelNameis not needed forsetUpRunandtearDownRun.Data Params:
{ "data": { "key": "value" } }
The data is a key value dictionary containing the data form the current model.
- Success Response:
Code:
200Content:
{ "payload": { "output": "", "data": { }, "result": { }, "error": { "message": "", "trace": "" } } }
The
outputis the output of the step. It is required.The
datakey from the response should be the data modified by your tests. It is not required.The
resultis the value returned by the step. It is not required. It can be of any type.The
errorkey should be present only if the step failed.
Error Response:
Codes:
460: Model Not Found461: Step Not Found462: Invalid Step Handler (in case a method with the name of Step exists but requires invalid arguments)
Sample Call:
curl -X POST -d '{"data": {"key": "value"}}' -H 'Content-Type: application/json' http://localhost:4200/altwalker/hasStep?name="setUpModel"&modelName="ModelName"
Error Status Codes#
In case of any error in the Http executor, a status code and a json body is expected by AltWalker.
404: Not Found (for unhandled urls)460: Model Not Found461: Step Not Found462: Invalid Step Handler (in case a method with the name of Step exists but requires invalid arguments)463: Path Not Found464: Load Error (in case the path to load is invalid)465: No Test Code Loaded500: Unhandled Exception
Response Body:
{
"error": {
"message": "...",
"trace": "..."
}
}
Using your executor#
$ altwalker online -x http --url http://localhost:4200/ -m path/to/model.json "generator(stop_condition())" path/to/my/tests
-x httpUse the http executor.
--url http://localhost:4200/The url where your executor is listening.
path/to/my/testsThe path to your tests, relative to your executor location. This is passed to your executor via POST
/load.
Further Reading/Useful Links#
Check altwalker.executor.HttpExecutor to see the HttpExecutor client.