ZeuZ API examples
ZeuZ API provides an external interface for clients to interact with the server and fetch various information. Complete API documentation can be found here.
This page lists example scenarios for using the API.
#
Deploy Test SetsSteps which are marked [OPT] can be skipped if you already know that the data is valid (for example, you already know that a Milestone exists for a given ID, or a Test Set with the given name already exists).
[API Doc]#
Get access tokenFirst, you need to get an access (Bearer) token through which the ZeuZ server will be able to identify that any request that you're making is actually you and not someone else. For this, you will need to provide the server an API Key, which can be found from your "Profile > Api Key" Key tab (click Generate if none is present).
In this case, the API Key is
2a69d429-fa4d-47ec-a8d7-eff88bf063ef
. This will return a JSON object with two keystoken
andstatus
. Thistoken
value needs to be sent to the server with any subsequent API requests as an Authorization header as you will see in the next steps.[API Doc]#
[OPT] Verify Test SetNext, you will need to get the Test Set that you want to run/deploy using API. You can create a Test Set by navigating to "Testing > Set > New Set". Add the test cases that you want to run as part of this test set. You can verify that the test set is accessible via the API using the following request.
In this case
project
andteam
can be found by clicking on your username. Take the values inside parentheses.search_term
is the name of the set that you just created. For this example, it iscicd
.[API Doc]#
[OPT] Verify milestoneYou need to provide the ID of a Milestone. This can be found from "Project > Milestone (Others)". It is better to choose a milestone that has the "Started" status.
status
can be either started or not_started.
#
[OPT] Create on-demand ZeuZ NodeYou can also create an On-demand ZeuZ Node that runs in your ZeuZ Server. This enables you to run test cases without even having a ZeuZ Node running already.
To acheive this, you first need to get the current user's
uid
andusername
. This can be fetched via the following API callNote that this may return multiple results for the same user (multiple team and projects). You can simply parse the
uid
andusername
from this response from the first item of the list.Next, make the following request to deploy an on-demand node in the ZeuZ Server.
Substitute
user_id
andusername
with the ones you received from the previous response. This API call will result in the following response:You can now use this
node_id
value in the next step.[API Doc]#
Get ZeuZ Node (machine) IDYou need to get the ZeuZ Node/machine ID to tell the server that you want to deploy/run your test set in that particular machine/zeuz node. If you have ZeuZ Node installed locally, navigate to the folder where it is installed (usually "Desktop > ZeuZ_Node") and open the
node_id.conf
file. Theid
specified here will become a part of the name of the machine. For example, if my username is foo and theid
specified innode_id.conf
file is set to cicd, the name of the ZeuZ Node instance will become available as foo_cicd.You will need to grab the
id
field from here. The above is an example response for the following request:[API Doc]#
Deploy/Run Test SetNow you can deploy/run your test set using the following request:
domain [str]
: Doman name of the server.start_date
andend_date
[str]: These can be set to any date (you can set it to your current date).branch_version [array(str)]
: Used to specify the version. Can be empty[]
.run_time_settings [array(str)]
: Used to control ZeuZ Node behavior. Keep them as is if you don't want to modify default settings.loop [int]
: Indicates how many times to run the selected Test Set.machine [int]
: ZeuZ Node/machine ID (you need to specify the ID and not the name).run_time_params [object(object(str))]
: Specify any run time parameter. These can be obtained from "Testing > Run Tests". In this exampleserver
is the name of the runtime parameter. Its value is https://demo.zeuz.ai which is part of thesubfield
key. Thefield
key can be set to anything and will be ignored.team_id [int]
: Team ID can be found from "Profile".project_id [str]
: Project ID can be found from "Profile".milestone [str]
: ID of the selected milestone. Needs to provided as a string. See step #3.objective [str]
: Any string can be specified as an objective. Indicates the objective of the deploy/run.email_receivers [array(str)]
: List of emails to send reports to.dependency [object(str)]
: Specify the OS and and browser that you want to deploy the test set for. For iOS/Android you can setMobile
key to iOS or Android.test_set_name [str]
: Name of the test set to deploy/run. See step #2.
Executing this API endpoint will give back the
run_id
that you can then use to periodically check for status.
#
Check Deploy/Run history/status/detailsrun_id
parameter will be provided by the Deploy/Run Test set api which is
mentioned above. Use this to fetch the status of any test set.
run_id_status
represents the overall status of the whole run/deploy
session. It can be one of the three values - Complete,
In-progress, Cancelled. You're advised to make all the
characters lower case if you want to compare the progress string.