# TestingOptions.CompareText Class

> Use this class to configure options for comparing documents with the [CompareText](https://docs.uipath.com/activities/other/latest/workflow/uipath-testing-activities-api-comparetext) coded automation API.

Use this class to configure options for comparing documents with the [CompareText](https://docs.uipath.com/activities/other/latest/workflow/uipath-testing-activities-api-comparetext) coded automation API.

## Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

## Syntax

```
public class TestingOptions : CompareText
```

## Constructors

```
public TestingOptions.CompareText()
```

`TestingOptions.CompareText` : Initializes a new instance of the `TestingOptions.CompareText` class.

## Properties

`AdditionalOutputFilePath` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : Path to the additional output file. Needs to be set if `OutputDiffType` is PDF.

`ContinueOnError` [Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0) : Specifies if the automation should continue even when the method throws an error.

`GenerateSemanticResult` [Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0) : Perform the verification using the AI capabilities that Autopilot offers to obtain a semantic interpretation of the differences. This generates an additional result with the semantic differences.

:::note
Depending on licensing plan you enrolled in, the **Semantic** result type consumes one of the following for each coded automation API execution:
* For the Flex licensing plan, the **Semantic** result type consumes one AI unit.
* For the Unified Pricing licensing plan, the **Semantic** result type consumes one Platform unit. For more information on consumption, visit [About the Testing activity package](https://docs.uipath.com/activities/other/latest/workflow/about-the-testing-activities-pack).
:::

`OutputDiffType` `DocumentOutputDiffType` : The format in which you want to show the differences between texts.

`OutputFilePath` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The path to the output file that shows the differences between texts.

`Rules` `List<ComparisonRule>` : List of rules to be applied. They can be of type `RegexRule` or `WildcardRule`.

`WordSeparators` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The characters that should be considered as word separators in the comparison process. For example, if the texts you are comparing commonly use a period `.` or backslashes `/` for separating words, then you can define these as word separators. By default, the separators are period `.`, comma `,` , exclamation mark, `!`, question mark `?`, colon `:`, backslash n `\n`.

## Methods

These are the methods you can use to configure the text comparison options.

### WithContinueOnError

Configure if the automation should continue even when the method throws an error.

#### Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

#### `WithContinueOnError(bool)`

```
WithIgnoreRegexRule(
    bool continueOnError
)
```

`continueOnError` [Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0) : Specifies if the automation should continue even when the method throws an error. This parameter only supports Boolean values (`true`, `false`). The default value is `false`. As a result, if the parameter is blank and an error is thrown, the execution of the project stops. If the value is set to `true`, the execution of the project continues regardless of any error.

### WithGenerateHtml

Generates an HTML file with the highlighted differences identified between the two documents or texts.

#### Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

#### `WithGenerateHtml(string)`

```
WithGenerateHtml(
    string filePath
)
```

`filePath` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The path of the HTML file that stores the differences identified when comparing the documents or texts.

### WithGenerateSemanticResult

Perform the verification using the AI capabilities that Autopilot offers to obtain a semantic interpretation of the differences. This generates an additional result with the semantic differences.

:::note
Depending on licensing plan you enrolled in, the **Semantic** result type consumes one of the following for each coded automation API execution:
* For the Flex licensing plan, the **Semantic** result type consumes one AI unit.
* For the Unified Pricing licensing plan, the **Semantic** result type consumes one Platform unit. For more information on consumption, visit [About the Testing activity package](https://docs.uipath.com/activities/other/latest/workflow/about-the-testing-activities-pack).
:::

#### Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

#### `WithGenerateSemanticResult(bool)`

```
WithGenerateSemanticResult(
    bool generateSemanticResult = false
)
```

`generateSemanticResult` [Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0) : If set to `true`, performs the verification using AI capabilities. By default, this is set to `false`.

#### Return value

`SemanticDifferences`

The result of the verification process, performed using AI capabilities.

### WithIgnoreRegexRule

If set to `True`, ignores any Regex rule that you configured for the `Rules` parameter. This allows you to exclude certain parts of the texts or documents that you are comparing.

#### Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

#### `WithIgnoreRegexRule(string, string, [bool])`

```
WithIgnoreRegexRule(
    string ruleName,
    string regexPattern,
    [bool usePlaceholders = true]
)
```

`ruleName` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The name of the rule, as you configured it in the list of `Rules`, that you want to ignore in the comparison process.

`regexPattern` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The actual regex that represents the `ruleName` previously entered.

`usePlaceholder` [Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0) (Optional) : If set to `True` it replaces the ignored part of a document or text with a placeholder value. The placeholder value is the `ruleName`. By default, this parameter is set to `true`.

### WithIgnoreWildcardRule

If set to `True`, ignores any wild card rule that you configured for the `Rules` parameter. This allows you to exclude certain parts of the texts or documents that you are comparing.

#### Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

#### `WithIgnoreWildcardRule(string, string, bool)`

```
WithIgnoreWildcardRule(
    string ruleName,
    string wildcardPattern,
    [bool usePlaceholder = true]
)
```

`ruleName` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The name of the rule, as you configured it in the list of `Rules`, that you want to ignore in the comparison process.

`wildcardPattern` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The actual wildcard that represents the `ruleName` previously entered.

`usePlaceholder` [Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0) (Optional) : If set to `True` it replaces the ignored part of a document or text with a placeholder value. The placeholder value is the `ruleName`. By default, this parameter is set to `true`.

### WithWordSeparators

Specify the characters that you want to define as word separators. The characters must be stored in a string.

#### Definition

**Namespace**: UiPath.Testing.API.Models

**Assembly**: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

#### `WithWordSeparators(string)`

```
WithWordSeparators(
    string wordSeparators
)
```

`wordSeparators` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) : The string containing the characters that you want to consider as word separators.
