---
schema_version: "1"
id: de119d140c19bb9c42200ccd54d86a48cfaa81fa591facd374593366453077e8
title: Work with the Test Harness
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforce-slack-sdk/apex-slack-sdk/guides/apex_ref/apex_ref_testharness.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_testharness.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 34221cd7a2ed108f776c37e90a1efd84674c7e33ce2d5114dc98498d320e3710
products:
  - Apex SDK for Slack (Beta)
---
# Work with the Test Harness

Use the `TestHarness` class to test your Apex SDK for Slack apps.

## TestHarness Class

Represents a test with a Slack state and user session.

**Usage**

The `TestHarness` class enables you to mock the Apex SDK for Slack elements for running in a test environment, allowing the creation of a Slack state and user session as needed.

See [Test Slack Apps](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/test/test.md).

### TestHarness Methods

The following are methods for `TestHarness`.

#### getNewSlackState()

**Signature**

```java
public Slack.TestHarness.State getNewSlackState()
```

**Return Value**

Type: [Slack.TestHarness.State](#testharnessstate-class)

## TestHarness.Actions Class

Represents an [actions layout component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#actions) in a view for the test harness.

**Usage**

Use `TestHarness.Actions` to work with actions, such as testing a button or querying an external select component.

```java
Slack.TestHarness.Actions actions = (Slack.TestHarness.Actions)modal.getComponentByName('my_action_name', Slack.TestHarness.Actions.class);
Slack.TestHarness.ExternalSelect externalSelect = (Slack.TestHarness.ExternalSelect)actions.getComponentByName('my_component_name', Slack.TestHarness.ExternalSelect.class);
externalSelect.query('Lookup');
```

The `Slack.TestHarness.Actions` object is returned as a window object, which is then cast back into a `Slack.TestHarness.Actions` object. Get the component by name by casting it back to a `Slack.TestHarness.Actions` object. See [Classes and Casting](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_casting.htm).

### TestHarness.Actions Methods

The following are methods for `TestHarness.Actions`.

#### getComponent(idx, clazz)

Gets a child component in the given index on the actions layout component.

**Signature**

```java
public Object getComponent(Integer idx, System.Type clazz)
```

**Parameters**

_idx_

Type: Integer

The index of the component

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

The Apex type of the component

**Return Value**

Type: Object

#### getComponentByName(name, clazz)

Gets a child component on the actions layout component by name.

**Signature**

```java
public Object getComponentByName(String name, System.Type clazz)
```

**Parameters**

_name_

Type: String

The name of the actions component

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

The Apex type of the component

#### getComponentCount()

Gets the number of child components for the actions component.

**Signature**

```java
public Integer getComponentCount()
```

**Return Value**

Type: Integer

#### getName()

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

## TestHarness.Button Class

Represents a [button component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#button) in a view for the test harness.

### TestHarness.Button Methods

The following are methods for `TestHarness.Button`.

#### click()

Simulates clicking a button.

**Signature**

```java
public void click()
```

**Return Value**

Type: void

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the button.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getLabel()

Gets the label for the button.

**Signature**

```java
public String getLabel()
```

**Return Value**

Type: String

#### getName()

Gets the name for the button.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getStyle()

Gets the style for the button.

**Signature**

```java
public String getStyle()
```

**Return Value**

Type: String

#### getUrl()

Gets the URL for the button.

**Signature**

```java
public String getUrl()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the button.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

## TestHarness.Channel Class

Represents a channel for the test harness.

### TestHarness.Channel Methods

The following are methods for `TestHarness.Channel`.

#### addUser(user)

Adds a user to the channel.

**Signature**

```java
public void addUser(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: Slack.TestHarness.User

Adds the specified user to the channel. Returns an exception if the user doesn't belong to the channel.

**Return Value**

Type: void

#### canBeOpenedByUser(user)

Gets if the specified user is able to open the channel.

**Signature**

```java
public Boolean canBeOpenedByUser(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: Slack.TestHarness.User

#### getId()

Gets the channel ID.

**Signature**

```java
public String getId()
```

**Return Value**

Type: String

#### getLocale()

**Signature**

```java
public String getLocale()
```

**Return Value**

Type: String

#### getMessageCount(user)

Gets the message count on the channel for the specified user.

**Signature**

```java
public Integer getMessageCount(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: Slack.TestHarness.User

**Return Value**

Type: Integer

#### getMessages(user)

Gets the list of messages for the channel for the specified user.

**Signature**

```java
public List<Slack.TestHarness.Message> getMessages(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: Slack.TestHarness.User

**Return Value**

Type: List<Slack.TestHarness.Message>

#### getName()

Gets the name for the channel.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getTeam()

Gets the team for the channel.

**Signature**

```java
public Slack.TestHarness.Team getTeam()
```

**Return Value**

Type: Slack.TestHarness.Team

#### isPrivate()

Returns true if the channel is private, or false otherwise.

**Signature**

```java
public Boolean isPrivate()
```

**Return Value**

Type: Boolean

#### removeUser(user)

Removes the specified user from the channel.

**Signature**

```java
public void removeUser(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: Slack.TestHarness.User

**Return Value**

Type: void

#### sendMessage(userSession, text)

Simulates sending a message to the channel from the user's session.

**Signature**

```java
public Slack.TestHarness.Message sendMessage(Slack.TestHarness.UserSession userSession, String text)
```

**Parameters**

_userSession_

Type: Slack.TestHarness.UserSession

_text_

Type: String

## TestHarness.Checkbox Class

Represents a [checkbox component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#checkbox) in a view for the test harness.

### TestHarness.Checkbox Methods

The following are methods for `TestHarness.Checkbox`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the checkbox.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getDescription()

Gets the description for the checkbox.

**Signature**

```java
public String getDescription()
```

**Return Value**

Type: String

#### getInitialValue()

Gets the initial value for the checkbox.

**Signature**

```java
public Boolean getInitialValue()
```

**Return Value**

Type: Boolean

#### getLabel()

Gets the label for the checkbox.

**Signature**

```java
public String getLabel()
```

#### getName()

Gets the name of the checkbox.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getValue()

Gets the value of the checkbox.

**Signature**

```java
public Boolean getValue()
```

**Return Value**

Type: Boolean

#### setValue(value)

Sets the value of the checkbox. If the checkbox contains an `onchange` event, an action is fired.

**Signature**

```java
public void setValue(Boolean value)
```

**Parameters**

_value_

Type: Boolean

**Return Value**

Type: void

#### toggleValue()

Toggles the value of the checkbox. If the checkbox contains an `onchange` event, an action is fired.

**Signature**

```java
public void toggleValue()
```

**Return Value**

Type: void

## TestHarness.CheckboxGroup Class

Represents a [checkbox group component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#checkbox-group) in a view for the test harness.

### TestHarness.CheckboxGroup Methods

The following are methods for `TestHarness.CheckboxGroup`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the checkbox group.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getDescription()

**Signature**

```java
public String getDescription()
```

**Return Value**

Type: String

#### getInitialValue()

Gets the initial value for the checkbox group.

**Signature**

```java
public List<String> getInitialValue()
```

**Return Value**

Type: List\<String\>

#### getLabel()

**Signature**

```java
public String getLabel()
```

**Return Value**

Type: String

#### getName()

Gets the name of the checkbox group.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getValue()

Gets the value of the checkbox group.

**Signature**

```java
public List<String> getValue()
```

**Return Value**

Type: List\<String\>

#### setValue(listOfIdentifiers)

Sets the value of the checkbox group. If the checkbox group contains an `onchange` event, an action is fired.

**Signature**

```java
public void setValue(List<String> listOfIdentifiers)
```

**Parameters**

_listOfIdentifiers_

Type: List\<String\>

**Return Value**

Type: void

#### toggleValue(option)

**Signature**

```java
public void toggleValue(Slack.TestHarness.Option option)
```

**Parameters**

_option_

Type: Slack.TestHarness.Option

**Return Value**

Type: void

#### toggleValue(identifier)

Toggles the value of an individual option for the checkbox group. If the checkbox group contains an `onchange` event, an action is fired.

**Signature**

```java
public void toggleValue(String identifier)
```

**Parameters**

_identifier_

Type: String

**Return Value**

Type: void

## TestHarness.Confirm Class

Represents a [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) in a view for the test harness.

### TestHarness.Confirm Methods

The following are methods for `TestHarness.Confirm`.

#### getConfirm()

Gets the confirm button text.

**Signature**

```java
public String getConfirm()
```

**Return Value**

Type: String

#### getDeny()

Gets the deny button text.

**Signature**

```java
public String getDeny()
```

**Return Value**

Type: String

#### getStyle()

Gets the confirmation style.

**Signature**

```java
public String getStyle()
```

**Return Value**

Type: String

#### getText()

Gets the confirmation dialog text.

**Signature**

```java
public String getText()
```

**Return Value**

Type: String

#### getTitle()

Gets the confirmation dialog title.

**Signature**

```java
public String getTitle()
```

**Return Value**

Type: String

## TestHarness.Context Class

Represents the [context layout component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#context) in a view for the test harness.

### TestHarness.Context Methods

The following are methods for `TestHarness.Context`.

#### getComponent(idx, clazz)

Gets a child component in a given index on the context component.

**Signature**

```java
public Object getComponent(Integer idx, System.Type clazz)
```

**Parameters**

_idx_

Type: Integer

The index of the component

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

The Apex type of the component

**Return Value**

Type: Object

#### getComponentCount()

Gets the number of child components on the context component.

**Signature**

```java
public Integer getComponentCount()
```

**Return Value**

Type: Integer

#### getName()

Gets the name of the context component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

## TestHarness.ConversationsSelect Class

Represents a [conversations select component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#conversations-select) in a view for the test harness.

### TestHarness.ConversationsSelect Methods

The following are methods for `TestHarness.ConversationsSelect`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the component.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getFilter()

Gets the [filter composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#filter) for the conversations select.

**Signature**

```java
public Slack.TestHarness.Filter getFilter()
```

**Return Value**

Type: Slack.TestHarness.Filter

#### getInitialMultiselectValue()

Gets the initial value for the conversations select. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getInitialMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getInitialValue()

Gets the initial value for the conversations select. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getMaxSelection()

Gets the max selection for the conversations select. Returns 1 if the component isn’t a multi-select.

**Signature**

```java
public Integer getMaxSelection()
```

**Return Value**

Type: Integer

#### getMultiselectValue()

Gets the value for the conversations select. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getName()

Gets the name for the conversations select.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getOptions()

Gets the list of options for the conversations select.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<Slack.TestHarness.Option>

#### getPlaceholder()

Gets the placeholder for the conversations select.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the component. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### isMultiselect()

Returns true if the conversations select is a multi-select.

**Signature**

```java
public Boolean isMultiselect()
```

**Return Value**

Type: Boolean

#### setMultiselectValue(listOfIdentifiers)

Sets the value of the conversations select. If the conversations select contains an `onchange` event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public void setMultiselectValue(List<String> listOfIdentifiers)
```

**Parameters**

_listOfIdentifiers_

Type: List\<String\>

**Return Value**

Type: void

#### setValue(identifier)

Sets the value of the conversations select. If the conversations select contains an `onchange` event, an action is fired. If the conversations select is a multi-select, an exception is thrown.

**Signature**

```java
public void setValue(String identifier)
```

**Parameters**

_identifier_

Type: String

## TestHarness.Datasource Class

Represents a [datasource composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#datasource) for the test harness.

### TestHarness.Datasource Methods

The following are methods for `TestHarness.Datasource`.

#### getDefinition()

**Signature**

```java
public String getDefinition()
```

**Return Value**

Type: String

#### getProperties()

**Signature**

```java
public Map<String,Object> getProperties()
```

**Return Value**

Type: Map<String,Object>

## TestHarness.DatePicker Class

Represents a [date picker component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#date-picker) in a view for the test harness.

### TestHarness.DatePicker Methods

The following are methods for `TestHarness.DatePicker`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the date picker.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: Slack.TestHarness.Confirm

#### getInitialValue()

Gets the initial value for the date picker.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getName()

Gets the name for the date picker.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getPlaceholder()

Gets the placeholder for the date picker.

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the date picker.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### setValue(value)

Sets the value for the date picker.

**Signature**

```java
public void setValue(String value)
```

**Parameters**

_value_

Type: String

## TestHarness.DateTimePicker Class

Represents a [date time picker component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/uisf.md#date-time-picker) in a view for the test harness.

### TestHarness.DateTimePicker Methods

The following are methods for `TestHarness.DateTimePicker`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the date time picker.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getDateLabel()

Gets the label for the date input.

**Signature**

```java
public String getDateLabel()
```

**Return Value**

Type: String

#### getInitialValue()

Gets the initial value for the date time picker.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getName()

Gets the name for the date time picker.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getPlaceholder()

Gets the placeholder for the date time picker.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getRequired()

Gets the `required` value for the date time picker.

**Signature**

```java
public Boolean getRequired()
```

**Return Value**

Type: Boolean

#### getSubmissionName()

Gets the submission name for the date time picker.

**Signature**

```java
public String getSubmissionName()
```

**Return Value**

Type: String

#### getTimeLabel()

Gets the label for the time input.

**Signature**

```java
public String getTimeLabel()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the date time picker.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### setDateValue(value)

Sets the date value on the component.

**Signature**

```java
public void setDateValue(String value)
```

**Parameters**

_value_

Type: String

**Return Value**

Type: void

#### setTimeValue(value)

Sets the time value on the component.

**Signature**

```java
public void setTimeValue(String value)
```

**Parameters**

_value_

Type: String

**Return Value**

Type: void

#### setValue(value)

Sets the value for the date time picker.

**Signature**

```java
public void setValue(String value)
```

**Parameters**

_value_

Type: String

**Return Value**

Type: void

## TestHarness.Divider Class

Represents a [divider component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#divider) in a view for the test harness.

### TestHarness.Divider Methods

The following are methods for `TestHarness.Divider`.

#### getName()

Gets the name for the divider.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

## TestHarness.Enterprise Class

Represents a Slack Enterprise for the test harness.

### TestHarness.Enterprise Methods

The following are methods for `TestHarness.Enterprise`.

#### getId()

Gets the ID for the enterprise

**Signature**

```java
public String getId()
```

**Return Value**

Type: String

#### getName()

Gets the name for the enterprise.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

## TestHarness.ExternalSelect Class

Represents an [external select component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#external-select) in a view for the test harness.

### TestHarness.ExternalSelect Methods

The following are methods for `TestHarness.ExternalSelect`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the external select.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: Slack.TestHarness.Confirm

#### getDatasource()

Gets the [datasource composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#datasource) for the external select.

**Signature**

```java
public Slack.TestHarness.Datasource getDatasource()
```

**Return Value**

Type: Slack.TestHarness.Datasource

#### getInitialMultiselectValue()

Gets the initial value for the external select. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getInitialMultiselectValue()
```

**Return Value**

#### getInitialOptions()

Gets the initial list of resolved options for the component.

**Signature**

```java
public List<Slack.TestHarness.Option> getInitialOptions()
```

**Return Value**

Type: List<Slack.TestHarness.Option>

#### getInitialValue()

Gets the initial value for the external select. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getMaxSelection()

Gets the max selection for the external select. Returns 1 if the component isn’t a multi-select.

**Signature**

```java
public Integer getMaxSelection()
```

**Return Value**

Type: Integer

#### getMinQueryLength()

Gets the min query length for the external select.

**Signature**

```java
public Integer getMinQueryLength()
```

**Return Value**

Type: Integer

#### getMultiselectValue()

Gets the value for the external select. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getName()

Gets the name for the external select.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getOptionGroups()

**Signature**

```java
public List<Slack.TestHarness.OptionGroup> getOptionGroups()
```

**Return Value**

Type: List<Slack.TestHarness.OptionGroup>

#### getOptions()

Gets the list of options for the external select.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<Slack.TestHarness.Option>

#### getPlaceholder()

Gets the placeholder for the external select.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the external select. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### isMultiselect()

Returns true if the external select is a multi-select.

**Signature**

```java
public Boolean isMultiselect()
```

**Return Value**

Type: Boolean

#### query(query)

Simulates a query on the external select. If the min query length isn’t met, an exception is thrown.

**Signature**

```java
public void query(String query)
```

**Parameters**

_query_

Type: String

**Return Value**

Type: void

#### setMultiselectValue(listOfIdentifiers)

Sets the value of the external select. If the external select contains an `onchange` event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public void setMultiselectValue(List<String> listOfIdentifiers)
```

**Parameters**

_listOfIdentifiers_

Type: List\<String\>

**Return Value**

Type: void

#### setValue(identifier)

Sets the value of the external select. If the external select contains an `onchange` event, an action is fired. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public void setValue(String identifier)
```

**Parameters**

_identifier_

Type: String

**Return Value**

Type: void

## TestHarness.File Class

### TestHarness.File Methods

The following are methods for `TestHarness.File '.

#### clone()

**Signature**

```java
public Object clone()
```

**Return Value**

Type: Object

#### getExternalId()

**Signature**

```java
public String getExternalId()
```

**Return Value**

Type: String

#### getName()

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getSource()

**Signature**

```java
public String getSource()
```

**Return Value**

Type: String

#### toString()

**Signature**

```java
public String toString()
```

**Return Value**

Type: String

## TestHarness.Filter Class

Represents a [filter composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#filter) in a view for the test harness.

### TestHarness.Filter Methods

The following are methods for `TestHarness.Filter`.

#### getExcludeBotUsers()

Gets the `excludeBotUsers` value for the filter object.

**Signature**

```java
public Boolean getExcludeBotUsers()
```

**Return Value**

Type: Boolean

#### getExcludeExternalShared()

Gets the resolved exclude external shared value for the filter object.

**Signature**

```java
public Boolean getExcludeExternalShared()
```

**Return Value**

Type: Boolean

#### getInclude()

Gets the `include` list for the filter object.

**Signature**

```java
public List<String> getInclude()
```

**Return Value**

Type: List\<String\>

## TestHarness.Header Class

Represents a [header component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#header) in a view for the test harness.

### TestHarness.Header Methods

The following are methods for `TestHarness.Header`.

#### getName()

Gets the name for the header.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getText()

Gets the text for the header.

**Signature**

```java
public String getText()
```

**Return Value**

Type: String

## TestHarness.Home Class

Represents a [home surface component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/surface.md#home) in a view for the test harness.

### TestHarness.Home Methods

The following are methods for `TestHarness.Home`.

#### getButtonByLabel(label)

Gets a button component by its label value.

**Signature**

```java
public Slack.TestHarness.Button getButtonByLabel(String label)
```

**Return Value**

Type: Slack.TestHarness.Button

#### getComponent(idx, clazz)

Gets a child component on the home component.

**Signature**

```java
public Object getComponent(Integer idx, System.Type clazz)
```

**Parameters**

_idx_

Type: Integer

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getComponentByName(name, clazz)

**Signature**

```java
public Object getComponentByName(String name, System.Type clazz)
```

**Return Value**

_name_

Type: String

_clazz_

Type: System.Type

**Return Value**

Type: Object

#### getComponentCount()

Gets the number of child components on the home component.

**Signature**

```java
public Integer getComponentCount()
```

**Return Value**

Type: Integer

#### getInputByLabel(label)

**Signature**

```java
public Slack.TestHarness.Input getInputByLabel(String label)
```

**Parameters**

_label_

Type: String

**Return Value**

Type: [Slack.TestHarness.Input](#testharnessinput-class)

## TestHarness.Image Class

Represents an [image component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#image) in a view for the test harness.

### TestHarness.Image Methods

The following are methods for `TestHarness.Image`.

#### getAltText()

Gets the alternative text for the image.

**Signature**

```java
public String getAltText()
```

**Return Value**

Type: String

#### getImageUrl()

Gets the URL for the image.

**Signature**

```java
public String getImageUrl()
```

**Return Value**

Type: String

#### getName()

Gets the name for the image.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getTitle()

Gets the title for the image.

**Signature**

```java
public String getTitle()
```

**Return Value**

Type: String

## TestHarness.InlineImage Class

Represents an [inline image component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#inline-image) in a view for the test harness.

### TestHarness.InlineImage Methods

The following are methods for `TestHarness.InlineImage`.

#### getAltText()

Gets the alternative text for the inline image.

**Signature**

```java
public String getAltText()
```

**Return Value**

Type: String

#### getImageUrl()

Gets the URL for the inline image.

**Signature**

```java
public String getImageUrl()
```

**Return Value**

Type: String

#### getName()

Gets the name for the inline image.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

## TestHarness.Input Class

Represents an [input layout component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#input) in a view for a test harness.

### TestHarness.Input Methods

The following are methods for `TestHarness.Input`.

#### getComponent(clazz)

Gets a child component on the input component.

**Signature**

```java
public Object getComponent(System.Type clazz)
```

**Parameters**

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getComponentByName(name, clazz)

Gets a child component on the input component by name.

**Signature**

```java
public Object getComponentByName(String name, System.Type clazz)
```

**Parameters**

_name_

Type: String

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getHint()

Gets the hint for the input component.

**Signature**

```java
public String getHint()
```

**Return Value**

Type: String

#### getLabel()

Gets the label for the input component.

**Signature**

```java
public String getLabel()
```

**Return Value**

Type: String

#### getName()

Gets the name for the input component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### isRequired()

Returns true if the input component is required.

**Signature**

```java
public Boolean isRequired()
```

**Return Value**

Type: Boolean

## TestHarness.Message Class

Represents a [message surface component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/surface.md#message) in a view for the test harness.

### TestHarness.Message Methods

The following are methods for `TestHarness.Message`.

#### canBySeenByUser(user)

Returns true if the message can be seen by the specified user.

**Signature**

```java
public Boolean canBySeenByUser(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: Slack.TestHarness.User

**Return Value**

Type: Boolean

#### getButtonByLabel(label)

Gets a button component by its label value.

**Signature**

```java
public Slack.TestHarness.Button getButtonByLabel(String label)
```

**Parameters**

_label_

Type: String

**Return Value**

Type: [Slack.TestHarness.Button](#testharnessbutton-class)

#### getChannel()

Gets the channel value for the message.

**Signature**

```java
public Slack.TestHarness.Channel getChannel()
```

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### getComponent(idx, clazz)

Gets a child component in a given index on the message component.

**Signature**

```java
public Object getComponent(Integer idx, System.Type clazz)
```

**Parameters**

_idx_

Type: Integer

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getComponentByName(name, clazz)

Gets a child component on the message component by name.

**Signature**

```java
public Object getComponentByName(String name, System.Type clazz)
```

**Return Value**

Type: String

#### getComponentCount()

Gets the number of child components for the message component.

**Signature**

```java
public Integer getComponentCount()
```

**Return Value**

Type: Integer

#### getInputByLabel(label)

Gets the input component by label for the message component.

**Signature**

```java
public Slack.TestHarness.Input getInputByLabel(String label)
```

**Parameters**

_label_

Type: String

**Return Value**

Type: [Slack.TestHarness.Input](#testharnessinput-class)

#### getMessageTs()

Gets the timestamp for the message.

**Signature**

```java
public String getMessageTs()
```

**Return Value**

Type: String

#### getText()

Gets the text for the message.

**Signature**

```java
public String getText()
```

**Return Value**

Type: String

#### isEphemeralMessage()

Returns true if the message is ephemeral.

**Signature**

```java
public Boolean isEphemeralMessage()
```

**Return Value**

Type: Boolean

## TestHarness.Modal Class

Represents a [modal surface component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/surface.md#modal) in a view for the test harness.

### TestHarness.Modal Methods

The following are methods for `TestHarness.Modal`.

#### close()

Simulates closing a modal, which returns the `view_closed` payload.

**Signature**

```java
public void close()
```

**Return Value**

Type: void

#### getButtonByLabel(label)

Gets a button component by its label value.

**Signature**

```java
public Slack.TestHarness.Button getButtonByLabel(String label)
```

**Parameters**

_label_

Type: String

**Return Value**

Type: [Slack.TestHarness.Button](#testharnessbutton-class)

#### getCloseLabel()

Gets the close label for the modal.

**Signature**

```java
public String getCloseLabel()
```

**Return Value**

Type: String

#### getComponent(idx, clazz)

Gets a child component in the given index on the modal component.

**Signature**

```java
public Object getComponent(Integer idx, System.Type clazz)
```

**Parameters**

_idx_

Type: Integer

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getComponentByName(name, clazz)

Gets a child component on the modal component by name.

**Signature**

```java
public Object getComponentByName(String name, System.Type clazz)
```

**Parameters**

_name_

Type: String

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getComponentCount()

Gets the number of child components for the modal component.

**Signature**

```java
public Integer getComponentCount()
```

**Return Value**

Type: Integer

#### getInputByLabel(label)

Gets an input block component by its label value.

**Signature**

```java
public Slack.TestHarness.Input getInputByLabel(String label)
```

**Parameters**

_label_

Type: String

**Return Value**

Type: [Slack.TestHarness.Input](#testharnessinput-class)

#### getInputError(inputBlockName)

Gets any input error for a given input block by name.

**Signature**

```java
public String getInputError(String inputBlockName)
```

**Parameters**

_inputBlockName_

Type: String

**Return Value**

Type: String

#### getInputErrorBlocks()

**Signature**

```java
public List<String> getInputErrorBlocks()
```

**Return Value**

Type: List<String>

#### getSubmitLabel()

**Signature**

```java
public String getSubmitLabel()
```

**Return Value**

Type: String

#### getTitle()

**Signature**

```java
public String getTitle()
```

**Return Value**

Type: String

#### hasInputErrors()

**Signature**

```java
public Boolean hasInputErrors()
```

**Return Value**

Type: Boolean

#### submit()

**Signature**

```java
public void submit()
```

**Return Value**

Type: void

## TestHarness.Option Class

Represents an [option component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#options) in a view for a test harness.

### TestHarness.Option Methods

The following are methods for `TestHarness.Option`.

#### getDescription()

Gets the description for the option.

**Signature**

```java
public String getDescription()
```

**Return Value**

Type: String

#### getIdentifier()

Gets the identifier for the option.

**Signature**

```java
public String getIdentifier()
```

**Return Value**

Type: String

#### getLabel()

Gets the label for the option.

**Signature**

```java
public String getLabel()
```

**Return Value**

Type: String

#### getUrl()

Gets the url for the option.

**Signature**

```java
public String getUrl()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the option.

**Signature**

```java
public Boolean getValue()
```

**Return Value**

Type: Boolean

## TestHarness.OptionGroup Class

Represents an [option group component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#option-grouos) in a view for the test harness.

### TestHarness.OptionGroup Methods

The following are methods for `TestHarness.OptionGroup`.

#### getLabel()

Gets the label for the option group.

**Signature**

```java
public String getLabel()
```

**Return Value**

Type: String

#### getOptions()

Gets the list of options for the option group.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<[Slack.TestHarness.Option](#testharnessoption-class)>

## TestHarness.Overflow Class

Represents an [overflow menu](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#overflow) within a section or an actions component in a view for the test harness.

### TestHarness.Overflow Methods

The following are methods for `TestHarness.Overflow`.

#### clickOption(idx)

Simulates clicking the component with the specified option index. If the component contains an `onclick` event, an action is fired.

**Signature**

```java
public void clickOption(Integer idx)
```

**Parameters**

_idx_

Type: Integer

**Return Value**

Type: void

#### clickOption(option)

Simulates clicking the component with the specified option. If the component contains an `onclick` event, an action is fired.

**Signature**

```java
public void clickOption(Slack.TestHarness.Option option)
```

**Parameters**

_option_

Type: [Slack.TestHarness.Option](#testharnessoption-class)

**Return Value**

Type: void

#### clickOption(identifier)

Simulates clicking the component with the specified option identifier. If the component contains an `onclick` event, an action is fired.

**Signature**

```java
public void clickOption(String identifier)
```

**Parameters**

_identifier_

Type: String

**Return Value**

Type: void

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the overflow menu.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getName()

Gets the name for the overflow menu.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getOptions()

Gets the list of options for the overflow menu.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<[Slack.TestHarness.Option](#testharnessoption-class)>

## TestHarness.RadioGroup Class

Represents a [radio group component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#radio-group)

### TestHarness.RadioGroup Methods

The following are methods for `TestHarness.RadioGroup`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the radio group.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getInitialValue()

Gets the initial value for the radio group.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getName()

Gets the name for the radio group.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getOptions()

Gets the list of options for the radio group.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<Slack.TestHarness.Option>

#### getValue()

Gets the value for the radio group.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### setValue(identifier)

Sets the value for the radio group. If the radio group contains an `onchange` event, an action is fired.

**Signature**

```java
public void setValue(String identifier)
```

**Return Value**

Type: void

## TestHarness.Section Class

Represents a [section component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/layout.md#section) in a view for the test harness.

### TestHarness.Section Methods

The following are methods for `TestHarness.Section`.

#### getComponent(idx, clazz)

Gets a child component in the given index on the section component.

**Signature**

```java
public Object getComponent(Integer idx, System.Type clazz)
```

**Parameters**

_idx_

Type: Integer

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

#### getComponent(clazz)

Gets a child component on the section component.

**Signature**

```java
public Object getComponent(System.Type clazz)
```

**Parameters**

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getComponentByName(name, clazz)

Gets a child component on the section component by name.

**Signature**

```java
public Object getComponentByName(String name, System.Type clazz)
```

**Parameters**

_name_

Type: String

_clazz_

Type: [System.Type](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm)

**Return Value**

Type: Object

#### getFieldCount()

Gets the field count for the section component.

**Signature**

```java
public Integer getFieldCount()
```

**Return Value**

Type: Integer

#### getFieldText(idx)

Gets the field text for the section component at the specified index.

**Signature**

```java
public String getFieldText(Integer idx)
```

**Parameters**

_idx_

Type: Integer

**Return Value**

Type: String

#### getName()

Gets the name for the section component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getText()

Gets the text for the component.

**Signature**

```java
public String getText()
```

**Return Value**

Type: String

## TestHarness.SelectInput Class

Represents a [select component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#select) in a view for the test harness.

### TestHarness.SelectInput Methods

The following are methods for `TestHarness.SelectInput`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the component.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: Slack.TestHarness.Confirm

#### getInitialMultiselectValue()

Gets the initial value for the select component. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getInitialMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getInitialValue()

Gets the initial value for the select component. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getMaxSelection()

Gets the `maxSelection` value, which shows the maximum number of options that can be selected. Returns 1 if the component isn’t a multi-select.

**Signature**

```java
public Integer getMaxSelection()
```

**Return Value**

Type: Integer

#### getMultiselectValue()

Gets the value for the select component. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getName()

Gets the name of the select component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getOptions()

Gets the list of options for the select component.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<Slack.TestHarness.Option>

#### getOptionsGroups()

Gets the list of option groups for the select component.

**Signature**

```java
public List<Slack.TestHarness.OptionGroup> getOptionsGroups()
```

**Return Value**

Type: List<Slack.TestHarness.OptionGroup>

#### getPlaceholder()

Gets the placeholder for the select component.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the select component.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### isMultiselect()

Returns true if the select component is a multi-select.

**Signature**

```java
public Boolean isMultiselect()
```

**Return Value**

Type: Boolean

#### setMultiselectValue(listOfIdentifiers)

Sets the value of the select component. If the component contains an `onchange` event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public void setMultiselectValue(List<String> listOfIdentifiers)
```

**Parameters**

_listOfIdentifiers_

Type: List\<String\>

**Return Value**

Type: void

#### setValue(identifier)

Sets the value of the select component. If the component contains an `onchange` event, an action is fired. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public void setValue(String identifier)
```

Parameters

_identifier_

Type: String

**Return Value**

Type: void

## TestHarness.State Class

Represents a Slack State that sets up your test harness.

### TestHarness.State Methods

The following are methods for `TestHarness.State`.

#### clearAllClientMocks()

**Signature**

```java
public void clearAllClientMocks()
```

**Return Value**

Type: void

#### clearAppClientMock()

**Signature**

```java
public void clearAppClientMock()
```

**Return Value**

Type: void

#### clearBotClientMock()

**Signature**

```java
public void clearBotClientMock()
```

**Return Value**

Type: void

#### clearUserClientMock()

**Signature**

```java
public void clearUserClientMock()
```

**Return Value**

Type: void

#### createDirectChannel(user)

Creates a direct channel for the given user.

**Signature**

```java
public Slack.TestHarness.Channel createDirectChannel(Slack.TestHarness.User user)
```

**Parameters**

_user_

Type: [Slack.TestHarness.User](#testharnessuser-class)

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### createEnterprise(enterpriseId, enterpriseName)

Creates an enterprise for the test harness.

**Signature**

```java
public Slack.TestHarness.Enterprise createEnterprise(String enterpriseId, String enterpriseName)
```

**Parameters**

_enterpriseId_

Type: String

_enterpriseName_

Type: String

**Return Value**

Type: [Slack.TestHarness.Enterprise](#testharnessenterprise-class)

#### createEnterprise(enterpriseName)

**Signature**

```java
public Slack.TestHarness.Enterprise createEnterprise(String enterpriseName)
```

**Return Value**

Type: Slack.TestHarness.Enterprise

#### createPrivateChannel(team, channelName, locale)

**Signature**

```java
public Slack.TestHarness.Channel createPrivateChannel(Slack.TestHarness.Team team, String channelName, String locale)
```

**Parameters**

_team_

Type: Slack.TestHarness.Team

_channelName_

Type: String

_locale_

Type: String

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### createPrivateChannel(channelName)

Creates a private channel with the specified name.

**Signature**

```java
public Slack.TestHarness.Channel createPrivateChannel(String channelName)
```

**Parameters**

_channelName_

Type: String

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### createPrivateChannel(team, channelName)

Creates a private channel for the default team.

**Signature**

```java
public Slack.TestHarness.Channel createPrivateChannel(Slack.TestHarness.Team team, String channelName)
```

**Parameters**

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

_channelName_

Type: String

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### createPublicChannel(channelName)

Creates a public channel with the specified name.

**Signature**

```java
public Slack.TestHarness.Channel createPublicChannel(String channelName)
```

**Parameters**

_channelName_

Type: String

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### createPublicChannel(team, channelName)

Creates a public channel for the specified team.

**Signature**

```java
public Slack.TestHarness.Channel createPublicChannel(Slack.TestHarness.Team team, String channelName)
```

**Parameters**

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

_channelName_

Type: String

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### createTeam(teamDomain)

Creates a team for the default enterprise.

**Signature**

```java
public Slack.TestHarness.Team createTeam(String teamDomain)
```

**Parameters**

_teamDomain_

Type: String

**Return Value**

Type: [Slack.TestHarness.Team](#testharnessteam-class)

#### createTeam(teamDomain, enterprise)

Creates a team using the specified enterprise name.

**Signature**

```java
public Slack.TestHarness.Team createTeam(String teamDomain, Slack.TestHarness.Enterprise enterprise)
```

**Parameters**

_teamDomain_

Type: String

_enterprise_

Type: [Slack.TestHarness.Enterprise](#testharnessenterprise-class)

**Return Value**

Type: [Slack.TestHarness.Team](#testharnessteam-class)

#### createUser(username, name)

Creates a user on the default team.

**Signature**

```java
public Slack.TestHarness.User createUser(String username, String name)
```

**Parameters**

_username_

Type: String

_name_

Type: String

**Return Value**

Type: [Slack.TestHarness.User](#testharnessuser-class)

#### createUser(username, name, team)

Creates a user on the specified team.

**Signature**

```java
public Slack.TestHarness.User createUser(String username, String name, Slack.TestHarness.Team team)
```

**Parameters**

_username_

Type: String

_name_

Type: String

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

**Return Value**

Type:

#### createUserSession()

Creates a user session using the default user and default channel.

**Signature**

```java
public Slack.TestHarness.UserSession createUserSession()
```

**Return Value**

Type: [Slack.TestHarness.UserSession](#testharnessusersession-class)

#### createUserSession(user, defaultChannel)

**Signature**

```java
public Slack.TestHarness.UserSession createUserSession(Slack.TestHarness.User user, Slack.TestHarness.Channel defaultChannel)
```

**Parameters**

_user_

Type: [Slack.TestHarness.User](#testharnessuser-class)

_defaultChannel_

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

**Return Value**

Type: [Slack.TestHarness.UserSession](#testharnessusersession-class)

#### getChannel(team, channelId)

Gets a channel based on its ID for the specified team.

**Signature**

```java
public Slack.TestHarness.Channel getChannel(Slack.TestHarness.Team team, String channelId)
```

**Parameters**

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### getChannels(team)

Gets the list of channels for the specified team.

**Signature**

```java
public List<Slack.TestHarness.Channel> getChannels(Slack.TestHarness.Team team)
```

**Parameters**

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

**Return Value**

Type: List<[Slack.TestHarness.Channel](#testharnesschannel-class)>

#### getDefaultChannel()

Gets the default channel for the test harness.

**Signature**

```java
public Slack.TestHarness.Channel getDefaultChannel()
```

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### getDefaultEnterprise()

Gets the default enterprise for the test harness.

**Signature**

```java
public Slack.TestHarness.Enterprise getDefaultEnterprise()
```

**Return Value**

Type: [Slack.TestHarness.Enterprise](#testharnessenterprise-class)

#### getDefaultTeam()

Gets the default team for the test harness.

**Signature**

```java
public Slack.TestHarness.Team getDefaultTeam()
```

**Return Value**

Type: [Slack.TestHarness.Team](#testharnessteam-class)

#### getDefaultUser()

Gets the default user for the test harness.

**Signature**

```java
public Slack.TestHarness.User getDefaultUser()
```

**Return Value**

Type: [Slack.TestHarness.User](#testharnessuser-class)

#### getLocale()

**Signature**

```java
public String getLocale()
```

**Return Value**

Type: String

#### getUser(team, username)

Gets a user for the test harness.

**Signature**

```java
public Slack.TestHarness.User getUser(Slack.TestHarness.Team team, String username)
```

**Parameters**

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

_username_

Type: String

**Return Value**

Type: [Slack.TestHarness.User](#testharnessuser-class)

#### getUserByUsername(team, username)

**Signature**

```java
public Slack.TestHarness.User getUserByUsername(Slack.TestHarness.Team team, String username)
```

**Parameters**

_team_

Type: Slack.TestHarness.Team

_username_

Type: String

**Return Value**

Type: [Slack.TestHarness.User](#testharnessuser-class)

#### getUsers(team)

**Signature**

```java
public List<Slack.TestHarness.User> getUsers(Slack.TestHarness.Team team)
```

**Parameters**

_team_

Type: [Slack.TestHarness.Team](#testharnessteam-class)

**Return Value**

Type: List<[Slack.TestHarness.User](#testharnessuser-class)>

#### setAppClientMock(appClientMock)

**Signature**

```java
public void setAppClientMock(Slack.AppClientMock appClientMock)
```

**Parameters**

_appClientMock_

Type: Slack.AppClientMock

**Return Value**

Type: void

#### setBotClientMock(botClientMock)

**Signature**

```java
public void setBotClientMock(Slack.BotClientMock botClientMock)
```

**Parameters**

_botClientMock_

Type: Slack.BotClientMock

**Return Value**

Type: void

#### setLocale(locale)

**Signature**

```java
public void setLocale(String locale)
```

**Parameters**

_locale_

Type: String

**Return Value**

Type: void

#### setUserClientMock(userClientMock)

**Signature**

```java
public void setUserClientMock(Slack.UserClientMock userClientMock)
```

**Parameters**

_userClientMock_

Type: Slack.UserClientMock

**Return Value**

Type: void

## TestHarness.Team Class

Represents a team or workspace for the test harness.

### TestHarness.Team Methods

The following are methods for `TestHarness.Team`.

#### getChannels()

Gets the list of channels for the team.

**Signature**

```java
public List<Slack.TestHarness.Channel> getChannels()
```

Type: List<[Slack.TestHarness.Channel](#testharnesschannel-class)>

#### getEnterprise()

Gets the enterprise for the team.

**Signature**

```java
public Slack.TestHarness.Enterprise getEnterprise()
```

**Return Value**

Type: [Slack.TestHarness.Enterprise](#testharnessenterprise-class)

#### getId()

Gets the ID for the team.

**Signature**

```java
public String getId()
```

**Return Value**

Type: String

#### getTeamDomain()

Gets the domain for the team.

**Signature**

```java
public String getTeamDomain()
```

**Return Value**

Type: String

## TestHarness.Text Class

Represents a [text component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#text) in a view for a test harness.

### TestHarness.Text Methods

The following are methods for `TestHarness.Text`.

#### getText()

Gets the text for the component.

**Signature**

```java
public String getText()
```

**Return Value**

Type: String

## TestHarness.TextInput Class

Represents the [text input component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#text-input) in a view for the test harness.

### TestHarness.TextInput Methods

The following are methods for `TestHarness.TextInput`.

#### getInitialValue()

Gets the initial value for the text input component.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getMaxLength()

Gets the maximum length for the text input component.

**Signature**

```java
public Integer getMaxLength()
```

**Return Value**

Type: Integer

#### getMinLength()

Gets the minimum length for the text input component.

**Signature**

```java
public Integer getMinLength()
```

**Return Value**

Type: Integer

#### getName()

Gets the name for the text input component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getPlaceholder()

Gets the placeholder for the text input component.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the text input component.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### isMultiline()

Gets the `multiline` value for the text input component.

**Signature**

```java
public Boolean isMultiline()
```

**Return Value**

Type: Boolean

#### setValue(value)

Sets the value for the text input component.

**Signature**

```java
public void setValue(String value)
```

**Return Value**

Type: String

## TestHarness.TimePicker Class

Represents the [time picker component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#time-picker) in a view for the test harness.

### TestHarness.TimePicker Methods

The following are methods for `TestHarness.TimePicker`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the time picker component.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getInitialValue()

Gets the initial value for the time picker component.

**Signature**

```java
public String getInitialValue()
```

**Return Value**

Type: String

#### getName()

Gets the name for the time picker component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getPlaceholder()

Gets the placeholder for the time picker component.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the time picker component.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### setValue(value)

Sets the value for the time picker component.

**Signature**

```java
public void setValue(String value)
```

**Return Value**

Type: void

## TestHarness.User Class

Represents a Slack user for the test harness.

### TestHarness.User Methods

The following are methods for `TestHarness.User`.

#### getId()

Gets the ID for the user.

**Signature**

```java
public String getId()
```

**Return Value**

Type: String

#### getLocale()

**Signature**

```java
public String getLocale()
```

**Return Value**

Type: String

#### getName()

Gets the name for the user.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getTeam()

Gets the team for the user.

**Signature**

```java
public Slack.TestHarness.Team getTeam()
```

**Return Value**

Type: [Slack.TestHarness.Team](#testharnessteam-class)

#### getUsername()

Gets the username for the user.

**Signature**

```java
public String getUsername()
```

**Return Value**

Type: String

## TestHarness.UserSession Class

Represents a user session that denotes a user interacting with Slack using a client, maintaining session-specific state such as an open channel or modal.

### TestHarness.UserSession Methods

The following are methods for `TestHarness.UserSession`.

#### closeAllModals()

Simulates closing all modals in the modal stack for the user session.

**Signature**

```java
public void closeAllModals()
```

**Return Value**

Type: void

#### closeModal()

Simulates closing the currently visible modal on top of the modal stack for the user session.

**Signature**

```java
public void closeModal()
```

**Return Value**

Type: void

#### executeEvent(event, slackApp)

Executes an event in the context of an existing user session. The session is used to retrieve the user, team, and enterprise
to set on the request. The session is also used for any relevant input or output context for the specific event.

**Signature**

```java
public void executeEvent(Slack.Event event, Slack.App slackApp)
```

**Parameters**

_event_

Type: Slack.Event

_slackApp_

Type: [Slack.App](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_client_access.md#app-class)

**Return Value**

Type: void

#### executeGlobalShortcut(globalShortcut, slackApp)

Simulates executing a global shortcut for the user session.

**Signature**

```java
public void executeGlobalShortcut(String globalShortcut, Slack.App slackApp)
```

**Parameters**

_globalShortcut_

Type: String

_slackApp_

Type: [Slack.App](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_client_access.md#app-class)

**Return Value**

Type: void

#### executeMessageShortcut(messageShortcut, message, slackApp)

Simulates executing a message shortcut for a given message for the user session.

**Signature**

```java
public void executeMessageShortcut(String messageShortcut, Slack.TestHarness.Message message, Slack.App slackApp)
```

**Parameters**

_messageShortcut_

Type: String

_message_

Type: [Slack.TestHarness.Message](#testharnessmessage-class)

_slackApp_

Type: [Slack.App](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_client_access.md#app-class)

**Return Value**

Type: void

#### executeSlashCommand(command, slackApp)

Simulates executing a slash command on the given Slack app ID for the user session.

**Signature**

```java
public void executeSlashCommand(String command, Slack.App slackApp)
```

**Parameters**

_command_

Type: String

_slackApp_

Type: [Slack.App](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_client_access.md#app-class)

**Return Value**

Type: void

#### executeSlashCommand(command, text, slackApp)

Simulates executing a slash command with a text payload for the user session.

**Signature**

```java
public void executeSlashCommand(String command, String text, Slack.App slackApp)
```

**Parameters**

_command_

Type: String

_text_

Type: String

_slackApp_

Type: [Slack.App](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_client_access.md#app-class)

**Return Value**

Type: void

#### getAppHome()

Gets the open app home for the user session.

**Signature**

```java
public Slack.TestHarness.Home getAppHome()
```

**Return Value**

Type: [Slack.TestHarness.Home](#testharnesshome-class)

#### getMessageCount()

Gets the message count for the user session.

**Signature**

```java
public Integer getMessageCount()
```

**Return Value**

Type: Integer

#### getMessages()

Gets the list of messages for the user session.

**Signature**

```java
public List<Slack.TestHarness.Message> getMessages()
```

**Return Value**

Type: List<[Slack.TestHarness.Message](#testharnessmessage-class)>

#### getModalStack()

Gets the list of modals in stack order for the user session.

**Signature**

```java
public List<Slack.TestHarness.Modal> getModalStack()
```

**Return Value**

Type: List<[Slack.TestHarness.Modal](#testharnessmodal-class)>

#### getOpenChannel()

Gets the open channel for the user session.

**Signature**

```java
public Slack.TestHarness.Channel getOpenChannel()
```

**Return Value**

Type: [Slack.TestHarness.Channel](#testharnesschannel-class)

#### getState()

Gets the Slack state.

**Signature**

```java
public Slack.TestHarness.State getState()
```

**Return Value**

Type: [Slack.TestHarness.State](#testharnessstate-class)

#### getTopModal()

Gets the open modal on top of the modal stack for the user session.

**Signature**

```java
public Slack.TestHarness.Modal getTopModal()
```

**Return Value**

Type: Slack.TestHarness.Modal

#### getUser()

Gets the user for the user session.

**Signature**

```java
public Slack.TestHarness.User getUser()
```

**Return Value**

Type: [Slack.TestHarness.User](#testharnessuser-class)

#### openAppHome(slackApp)

Simulates opening the app home for a given app ID for the user session.

**Signature**

```java
public Slack.TestHarness.Home openAppHome(Slack.App slackApp)
```

**Parameters**

_slackApp_

Type: [Slack.App](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/guide/apex_ref_client_access.md#app-class)

**Return Value**

Type: Slack.TestHarness.Home

#### openChannel(channelId)

Simulates opening a channel for the given channel ID for the user session.

**Signature**

```java
public Slack.TestHarness.Channel openChannel(String channelId)
```

**Parameters**

_channelId_

Type: String

**Return Value**

Type: Slack.TestHarness.Channel

#### postMessage(message)

Simulates posting a message to the open channel for the user session.

**Signature**

```java
public Slack.TestHarness.Message postMessage(String message)
```

**Parameters**

_message_

Type: String

**Return Value**

Type: [Slack.TestHarness.Message](#testharnessmessage-class)

## TestHarness.UsersSelect Class

Represents a [users select component](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/elements.md#users-select) in a view for the test harness.

### TestHarness.UsersSelect Methods

The following are methods for `TestHarness.UsersSelect`.

#### getConfirm()

Gets the [confirm composition object](https://developer.salesforce.com/docs/platform/salesforce-slack-sdk/components/composition.md#confirm) for the users select component.

**Signature**

```java
public Slack.TestHarness.Confirm getConfirm()
```

**Return Value**

Type: [Slack.TestHarness.Confirm](#testharnessconfirm-class)

#### getInitialMultiselectValue()

Gets the initial value for the users select component. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getInitialMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getInitialValue()

Gets the initial value for the users select component. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public void getInitialValue()
```

**Return Value**

Type: void

#### getMaxSelection()

Gets the resolved max selection for the users select component. Returns 1 if the component isn’t a multi-select.

**Signature**

```java
public Integer getMaxSelection()
```

**Return Value**

Type: Integer

#### getMultiselectValue()

Gets the value for the users select component. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public List<String> getMultiselectValue()
```

**Return Value**

Type: List\<String\>

#### getName()

Gets the name for the users select component.

**Signature**

```java
public String getName()
```

**Return Value**

Type: String

#### getOptions()

Gets the list of options for the users select component.

**Signature**

```java
public List<Slack.TestHarness.Option> getOptions()
```

**Return Value**

Type: List<[Slack.TestHarness.Option](#testharnessoption-class)>

#### getPlaceholder()

Gets the placeholder for the users select component.

**Signature**

```java
public String getPlaceholder()
```

**Return Value**

Type: String

#### getValue()

Gets the value for the users select component.

**Signature**

```java
public String getValue()
```

**Return Value**

Type: String

#### isMultiselect()

Gets the value for the users select component. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public Boolean isMultiselect()
```

**Return Value**

Type: Boolean

#### setMultiselectValue(listOfIdentifiers)

Sets the value of the users select component. If the component contains an `onchange` event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

**Signature**

```java
public void setMultiselectValue(List<String> listOfIdentifiers)
```

**Parameters**

_listOfIdentifiers_

Type: List\<String\>

**Return Value**

Type: void

#### setValue(identifier)

Sets the value of the users select component. If the component contains an `onchange` event, an action is fired. If the component is a multi-select, an exception is thrown.

**Signature**

```java
public void setValue(String identifier)
```

**Parameters**

_identifier_

Type: String

**Return Value**

Type: void
