---
name: TestExecutionContext
last_updated: 2026-11-16T22:19:01Z
inherits:
  - Object
type: class
memory_category: Instances
tags:
  - NotCreatable
  - NotReplicated
summary: "Passed to a running test's callback to control how the test runs."
---

# Class: TestExecutionContext

> Passed to a running test's callback to control how the test runs.

## Description

A `TestExecutionContext` is the second argument passed to a test's callback
when [TestService:RunTestsAsync()](/docs/reference/engine/classes/TestService.md) runs it. Use it to skip the test with
[Skip()](/docs/reference/engine/classes/TestExecutionContext.md).

A `TestExecutionContext` isn't an [Instance](/docs/reference/engine/classes/Instance.md) and can't be parented.

## Methods

### Method: TestExecutionContext:Skip

**Signature:** `TestExecutionContext:Skip(reason: string): ()`

Stops the test's callback and records the test as
[TestCaseStatus.Skipped](/docs/reference/engine/enums/TestCaseStatus.md), with `reason` as its
[TestResult.SkipReason](/docs/reference/engine/classes/TestResult.md). A skipped test isn't a failure. Use it when
a test doesn't apply in the current session, such as a touch-input test on
a device without a touch screen.

The test is reported as failed rather than skipped if a
[TestCase:Check()](/docs/reference/engine/classes/TestCase.md) or [TestCase:Require()](/docs/reference/engine/classes/TestCase.md) failed in it, or if
the callback catches the skip with [LuaGlobals.pcall()](/docs/reference/engine/globals/LuaGlobals.md) and then
throws a different error.

```lua
local TestService = game:GetService("TestService")
local UserInputService = game:GetService("UserInputService")

TestService:RegisterTest("tap opens the menu", function(test, context)
	if not UserInputService.TouchEnabled then
		context:Skip("needs a touch screen")
	end
	-- Touch-only checks go here
end)
```

*Security: None · Thread Safety: Unsafe*

**Parameters:**

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `reason` | `string` |  | Optional text explaining why the test was skipped. |

**Returns:** `()`

## Inherited Members

### From [Object](/docs/reference/engine/classes/Object.md)

- **Property `ClassName`** (`string`): A read-only string representing the class this Object belongs to.
- **Property `className`** (`string`):  *(deprecated)*
- **Method `GetPropertyChangedSignal(property: string): RBXScriptSignal`**: Get an event that fires when a given property of the object changes.
- **Method `IsA(className: string): boolean`**: Returns true if an object's class matches or inherits from a given class.
- **Method `isA(className: string): boolean`**:  *(deprecated)*
- **Event `Changed`**: Fires immediately after a property of the object changes, with some