• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16import { FileTemp } from "../../gen/datatype";
17
18export let testFirstGenTemplate:FileTemp = {
19  name: '[fileName]Ability.test.ets',
20  content: `import hilog from '@ohos.hilog';
21  import testNapi from 'libentry.so';
22  import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
23
24  export default function [fileName]abilityTest() {
25    describe('[fileName]ActsAbilityTest', () => {
26      // Defines a test suite. Two parameters are supported: test suite name and test suite function.
27      beforeAll(() => {
28        // Presets an action, which is performed only once before all test cases of the test suite start.
29        // This API supports only one parameter: preset action function.
30      })
31      beforeEach(() => {
32        // Presets an action, which is performed before each unit test case starts.
33        // The number of execution times is the same as the number of test cases defined by **it**.
34        // This API supports only one parameter: preset action function.
35      })
36      afterEach(() => {
37        // Presets a clear action, which is performed after each unit test case ends.
38        // The number of execution times is the same as the number of test cases defined by **it**.
39        // This API supports only one parameter: clear action function.
40      })
41      afterAll(() => {
42        // Presets a clear action, which is performed after all test cases of the test suite end.
43        // This API supports only one parameter: clear action function.
44      })
45
46      [testAbilityFunctions]
47    })
48  }
49  `
50}