Skip to content

Property TimeoutMs ​

Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll

TimeoutMs ​

Gets or sets the timeout for setup method execution in milliseconds. Setup methods may need longer timeouts for hardware initialization.

csharp
public int TimeoutMs { get; set; }

Property Value ​

int

Examples ​

[Setup(TimeoutMs = 30000)] // 30 second timeout for WiFi connection
private async Task ConnectToWiFiAsync()
{
    await ExecuteAsync(@"
        import network
        import time

        wifi = network.WLAN(network.STA_IF)
        wifi.active(True)
        wifi.connect('MyNetwork', 'password')

        # Wait for connection
        timeout = 25  # Leave some buffer
        while not wifi.isconnected() and timeout > 0:
            time.sleep(1)
            timeout -= 1

        if not wifi.isconnected():
            raise Exception('WiFi connection failed')
    ");
}

Remarks ​

Hardware initialization often takes longer than normal operations, so setup methods may require extended timeouts. Consider the time needed for sensor stabilization, network connections, or file system operations.

Exceptions ​

ArgumentOutOfRangeException

Thrown when setting a timeout value that is less than or equal to zero.

Released under the Apache License 2.0.