How to: Log data from your tests#

Logging information is critical to the development and maintenance of your tests. AltWalker collects stdout and returned data from your tests.

Stdout#

AltWalker captures stdout data from each test and outputs it to the stdout of altwalker cli, or to a file if --report-file option is used.

class Simple:
    def vertex_a(self, *args):
        print("Simple.vertex_a")
[2020-04-27 14:26:20.731201] Simple.vertex_a Status: PASSED
Output:
Simple.vertex_a
public class WalletModel
{
    public void vertex_a()
    {
        Trace.WriteLine("Simple.vertex_a");
    }
}
[2020-04-27 14:26:20.731201] Simple.vertex_a Status: PASSED
Output:
Simple.vertex_a

Execute Step response:

{
    "payload": {
        "output": "Simple.vertex_a"
    }
}
[2020-04-27 14:26:20.731201] Simple.vertex_a Status: PASSED
Output:
Simple.vertex_a

Returned data from tests#

AltWalker captures return value from each test and outputs it to the stdout of altwalker cli, or to a file if --report-file option is used.

Return any json serializable object

class Simple:
    def vertex_a(self, *args):
        return { "key" : "value" }
[2020-04-27 14:26:20.731201] Simple.vertex_a Status: PASSED
Result:
{
    "key": "value"
}

Return any json serializable object

public class WalletModel
{
    public object vertex_a()
    {
        return new Dictionary<string, string> () { {"key", "value" } };
    }
}
[2020-04-27 14:26:20.731201] Simple.vertex_a Status: PASSED
Result:
{
    "key": "value"
}

Execute Step response:

{
    "payload": {
        "result": {"key" : "value"}
    }
}
[2020-04-27 14:26:20.731201] Simple.vertex_a Status: PASSED
Result:
{
    "key": "value"
}