IdeTestManager: Builder SDK Reference

## IdeTestManager IdeTestManager — Unit test discover and execution manager |

## Functions

IdeTestManager * | ide_test_manager_from_context ()
gboolean | ide_test_manager_get_loading ()
VtePty * | ide_test_manager_get_pty ()
gint | ide_test_manager_open_pty ()
void | ide_test_manager_run_async ()
gboolean | ide_test_manager_run_finish ()
void | ide_test_manager_run_all_async ()
gboolean | ide_test_manager_run_all_finish ()
GPtrArray * | ide_test_manager_get_tests ()
gchar ** | ide_test_manager_get_folders ()
GCancellable * | ide_test_manager_get_cancellable ()
void | ide_test_manager_ensure_loaded_async ()
gboolean | ide_test_manager_ensure_loaded_finish ()

## Properties

gboolean | loading | Read

## Types and Values

#define | IDE_TYPE_TEST_MANAGER
| IdeTestManager

## Object Hierarchy

        GObject
        ╰── IdeObject
            ╰── IdeTestManager

## Implemented Interfaces

IdeTestManager implements GInitable and GActionGroup.

## Description

The IdeTestManager is responsible for loading unit test provider plugins (via the IdeTestProvider interface) and running those unit tests on behalf of the user.

You can access the test manager using `ide_context_get_text_manager()` using the IdeContext for the loaded project.

## Functions

### ide_test_manager_from_context ()

    IdeTestManager *
    ide_test_manager_from_context (IdeContext *context);

#### Parameters

context | a IdeContext |

#### Returns

an IdeTestManager.

[transfer none]

Since: 3.32

### ide_test_manager_get_loading ()

    gboolean
    ide_test_manager_get_loading (IdeTestManager *self);

### ide_test_manager_get_pty ()

    VtePty *
    ide_test_manager_get_pty (IdeTestManager *self);

Gets the VtePty to use for running unit tests.

#### Parameters

self | a IdeTestManager |

#### Returns

a VtePty.

[transfer none]

Since: 3.32

### ide_test_manager_open_pty ()

    gint
    ide_test_manager_open_pty (IdeTestManager *self);

Gets a FD that maps to the child side of the PTY device.

#### Parameters

self | a IdeTestManager |

#### Returns

a new FD or -1 on failure

Since: 3.34

### ide_test_manager_run_async ()

    void
    ide_test_manager_run_async (IdeTestManager *self,
                                IdeTest *test,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Executes a single unit test, asynchronously.

The caller can access the result of the operation from `callback` by calling `ide_test_manager_run_finish()` with the provided result.

#### Parameters

self | An IdeTestManager |
test | An IdeTest |
cancellable | a GCancellable, or `NULL`. | [nullable]
callback | a callback to execute upon completion |
user_data | user data for `callback` |

Since: 3.32

### ide_test_manager_run_finish ()

    gboolean
    ide_test_manager_run_finish (IdeTestManager *self,
                                 GAsyncResult *result,
                                 GError **error);

Completes a request to `ide_test_manager_run_finish()`.

When this function returns `TRUE`, it does not indicate that the test succeeded; only that the test was executed. Thest IdeTest instance itself will contain information about the success of the test.

#### Parameters

self | An IdeTestManager |
result | The GAsyncResult provided to callback |
error | A location for a GError, or `NULL` |

#### Returns

`TRUE` if the test was executed; otherwise `FALSE` and `error` is set.

Since: 3.32

### ide_test_manager_run_all_async ()

    void
    ide_test_manager_run_all_async (IdeTestManager *self,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Executes all tests in an undefined order.

Upon completion, `callback` will be executed which must call `ide_test_manager_run_all_finish()` to get the result.

Note that the individual test result information will be attached to the specific IdeTest instances.

#### Parameters

self | An IdeTestManager |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion |
user_data | user data for `callback` |

Since: 3.32

### ide_test_manager_run_all_finish ()

    gboolean
    ide_test_manager_run_all_finish (IdeTestManager *self,
                                     GAsyncResult *result,
                                     GError **error);

Completes an asynchronous request to execute all unit tests.

A return value of `TRUE` does not indicate that all tests succeeded, only that all tests were executed. Individual test failures will be attached to the IdeTest instances.

#### Parameters

self | An IdeTestManager |
result | a GAsyncResult |
error | a location for a GError, or `NULL` |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

Since: 3.32

### ide_test_manager_get_tests ()

    GPtrArray *
    ide_test_manager_get_tests (IdeTestManager *self,
                                const gchar *path);

Locates and returns any IdeTest that is found as a direct child of `path` .

#### Parameters

self | a IdeTestManager |
path | the path to the test or `NULL` for the root path. | [nullable]

#### Returns

an array of IdeTest.

[transfer full][element-type IdeTest]

Since: 3.32

### ide_test_manager_get_folders ()

    gchar **
    ide_test_manager_get_folders (IdeTestManager *self,
                                  const gchar *path);

Gets the sub-paths of `path` that are not individual tests.

#### Parameters

self | a IdeTestManager |
path | the path to the test or `NULL` for the root path. | [nullable]

#### Returns

an array of strings describing available sub-paths to `path` .

[transfer full][array zero-terminated=1]

Since: 3.32

### ide_test_manager_get_cancellable ()

    GCancellable *
    ide_test_manager_get_cancellable (IdeTestManager *self);

Gets the cancellable for the test manager which will be cancelled when the cancel action is called.

#### Parameters

self | a IdeTestManager |

#### Returns

a GCancellable.

[transfer none]

Since: 3.34

### ide_test_manager_ensure_loaded_async ()

    void
    ide_test_manager_ensure_loaded_async (IdeTestManager *self,
                                          GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data);

Calls `callback` after the test manager has loaded tests.

If the test manager has already loaded tests, then `callback` will be called after returning to the main loop.

#### Parameters

self | a IdeTestManager |

Since: 3.32

### ide_test_manager_ensure_loaded_finish ()

    gboolean
    ide_test_manager_ensure_loaded_finish (IdeTestManager *self,
                                           GAsyncResult *result,
                                           GError **error);

## Types and Values

### IDE_TYPE_TEST_MANAGER

    #define IDE_TYPE_TEST_MANAGER (ide_test_manager_get_type())

### IdeTestManager

    typedef struct _IdeTestManager IdeTestManager;

## Property Details

### The `“loading”` property

      “loading”                  gboolean

The "loading" property denotes if a test provider is busy loading tests in the background.

Owner: IdeTestManager

Flags: Read

Default value: FALSE

Since: 3.32