Q: How can I avoid interactive terminal input when running tests?
https://feditest.org/reference/howtos/avoid-terminal-input/
In Getting a taste of FediTest, you had to enter the hostname of the Node where your to-be-tested App runs, and the user handles of an account and a non-existing account. That works fine for a one-time evaluation, but is cumbersome when one needs to do it frequently.
Fortunately, you can set this up once and don’t need to do it again. Do this:
Copy the
nodes/saas-any.node.json
(say tomynode.json
) and run FediTest with that file as theserver
Node instead ofnodes/saas-any.node.json
.Every time FediTest asks you for something, it will also tell you how it internally refers to the value it asks for. Write that down, and after the test run is finished, enter those values into your
mynode.json
. Then you will never have to enter them at the command-line instead.
For example, your mynode.json
initially looks like this:
{
"nodedriver" : "FediverseSaasNodeDriver"
}
Then FediTest might ask you a question such as:
TESTER ACTION REQUIRED: Enter the hostname for the Node of constellation role “server” (node parameter “hostname”)
Note it says the “node parameter” is called “hostname”. This tells you that you can add the
value to your mynode.json
as a parameter. It is similar for the other questions.
Your file, at the end, may look like this:
{
"nodedriver" : "FediverseSaasNodeDriver",
"parameters" : {
"hostname" : "mastodon.example",
"app" : "Mastodon"
},
"accounts" : [
{
"role" : null,
"account_userid" : "joe"
}
],
"non_existing_accounts" : [
{
"role" : null,
"not_existing_account_userid" : "does-not-exist"
}
]
}
Which parameters can be specified, and how to specify accounts and non-existing accounts depends on the Node Driver for the Node. To determin which you can use with your particular Node Driver, run:
% feditest info --nodedriver FediverseSaasNodeDriver