PerformanceBudgetContext Class#
Ambient performance budget for the current async test flow. Test framework adapters push the resolved budget (from PerformanceBudgetAttribute) at test setup and clear it at teardown. The assertion reads it via Motus.PerformanceBudgetContext.Current. Uses System.Threading.AsyncLocal<> so parallel tests remain isolated.
public static class PerformanceBudgetContext
Inheritance System.Object → PerformanceBudgetContext
Methods#
Clear() Method#
Clears the active budget.
public static void Clear();
ClearBudget(IPage) Method#
Clears the budget from a page. Call this in test teardown alongside Clear().
public static void ClearBudget(Motus.Abstractions.IPage page);
Parameters#
page IPage
Push(PerformanceBudget) Method#
Sets the active budget for the current async flow.
public static void Push(Motus.Abstractions.PerformanceBudget? budget);
Parameters#
budget PerformanceBudget
SetBudget(IPage, PerformanceBudget) Method#
Sets the active budget directly on a page. This avoids System.Threading.AsyncLocal<> limitations where writes inside async test initializers don't flow to the test method.
public static void SetBudget(Motus.Abstractions.IPage page, Motus.Abstractions.PerformanceBudget? budget);
Parameters#
page IPage
budget PerformanceBudget