• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)
2
3The **AbilityDelegatorRegistry** module provides APIs for storing the global registers of the registered **AbilityDelegator** and **AbilityDelegatorArgs** objects. You can use the APIs to obtain the **AbilityDelegator** and **AbilityDelegatorArgs** objects of an application. The APIs can be used only in the test framework.
4
5> **NOTE**
6>
7> The APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Modules to Import
10
11```ts
12import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
13```
14
15## AbilityLifecycleState
16
17Enumerates the ability lifecycle states.
18
19**System capability**: SystemCapability.Ability.AbilityRuntime.Core
20
21| Name         | Value  | Description                       |
22| ------------- | ---- | --------------------------- |
23| UNINITIALIZED | 0    | The ability is in an invalid state.             |
24| CREATE        | 1    | The ability is created.|
25| FOREGROUND    | 2    | The ability is running in the foreground.  |
26| BACKGROUND    | 3    | The ability is running in the background.  |
27| DESTROY       | 4    | The ability is destroyed.|
28
29## AbilityDelegatorRegistry.getAbilityDelegator
30
31getAbilityDelegator(): AbilityDelegator
32
33Obtains the **AbilityDelegator** object of the application.
34
35**System capability**: SystemCapability.Ability.AbilityRuntime.Core
36
37**Return value**
38
39| Type                                                        | Description                                                        |
40| ------------------------------------------------------------ | ------------------------------------------------------------ |
41| [AbilityDelegator](js-apis-inner-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-inner-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework.|
42
43**Example**
44
45```ts
46let abilityDelegator;
47
48abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
49```
50
51## AbilityDelegatorRegistry.getArguments
52
53getArguments(): AbilityDelegatorArgs
54
55Obtains the **AbilityDelegatorArgs** object of the application.
56
57**System capability**: SystemCapability.Ability.AbilityRuntime.Core
58
59**Return value**
60
61| Type                                                        | Description                                                        |
62| ------------------------------------------------------------ | ------------------------------------------------------------ |
63| [AbilityDelegatorArgs](js-apis-inner-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-inner-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters.|
64
65**Example**
66
67```ts
68let args = AbilityDelegatorRegistry.getArguments();
69console.info('getArguments bundleName:' + args.bundleName);
70console.info('getArguments testCaseNames:' + args.testCaseNames);
71console.info('getArguments testRunnerClassName:' + args.testRunnerClassName);
72```
73