Narval is a cube and a bot. The cube allows to describe, in CubicWeb, jobs to be executed by the bot. These jobs are simple Python scripts. The bot is a kind of process manager, waiting for task to be executed (eg. plans in the narval vocabulary, which are execution of a recipe). A new process is forked so each task is executed independantly, looking for elements in a CubicWeb instance.
Narval is a CubicWeb based framework to run automated tests. It consists in 2 parts:
The narval bot communicates with the web application by doing HTTP(S) requests.
The schema of the cube defines 2 entities:
In order to run a Recipe, one must create a Plan (an execution plan).
In the web UI, this can be done via the Start Plan button on a Recipe main view. This creates a new Plan entity (which references the Recipe) in the ready state.
Then, as soon as the narval bot asks the application for waiting jobs (i.e. Plan in the ready workflow state), it eventually gets the Plan eid.
The narval daemon then spawns a new process to manage the execution of the plan in a separate process; the executed command is something like:
narval run-plan narval https://webapp.com/3071/ --uid narval --threads 1 --max-reprieve 1min --log-threshold DEBUG
where 3071 is the eid of the Plan to be executed. The options attribute of the Plan (which is a string of the form: "key1=value1nkey2=value2n[...]") is converted into command line arguments (--key1 value1 --key2 value2 [...]) to be passed to the run-plan command.
This run-plan narval command retrieves the parameters of the Plan (the Python code to be executed and some execution options), then:
When the narval run-plan shell command returns, the bot checks for the return code, retrieves the stdout and stderr of the process and uploads them as the execution_log of the Plan, so the user can have access to the full execution log (print statements, logging messages, etc.).
User can write plugins that will be importable from recipes when executed by narval run-plan. The normal way is to write a cubicweb cube in which you add a _narval directory where you can add python modules and packages. When run from source directory, the _narval directory of every available cube will be added in the PYTHONPATH of the narval command.
Please refer to the apycot cube as an example.
|source repository||narval repository|
|test environment||narval env|
|may be discussed on||<not specified>|
|use license||<not specified>|