• Home
Name Date Size #Lines LOC

..--

expected/22-Oct-2025-2,0012,001

testcases/22-Oct-2025-1,5201,422

README.mdD22-Oct-20251.9 KiB6656

cases.tsD22-Oct-20258.5 KiB141118

prepare.ps1D22-Oct-20253.4 KiB11172

prepare.shD22-Oct-20251.3 KiB4319

run_tests.tsD22-Oct-202512.1 KiB388316

tsconfig.jsonD22-Oct-2025316 2121

README.md

1### How to run bindings test?
2
3```Bash
4cd /path/to/bindings
5
6### check environment
7# if you are using Linux shell
8bash test/prepare.sh
9# or if you are using Windows shell
10powershell -f test/prepare.ps1
11
12### run test
13npm install
14npm run test
15
16### restore the path to the original state
17bash test/prepare.sh --restore
18# or
19powershell -f test/prepare.ps1 --restore
20```
21
22#### tips
231. If you want to update a lot of expected results, you can use `node dist-test/test/run_tests.js ./test --update`
24
25### testcase directory structure
26.
27├── cases.ts
28├── run_tests.ts
29├── expected
30│   ├── exampleFuncName.json
31└── testcases
32    ├── .idea
33    │   └── .deveco
34    │       ├── exampleFuncName
35    │       │   └── arktsconfig.json
36    │       ├── lsp_build_config.json
37    │       └── lsp_compileFileInfos.json
38    ├── cases.json
39    └── exampleFuncName
40        └── exampleFuncName1.ets
41
42case.ts:
43```typescript
44{
45   testName: {
46      "expectedFilePath": "/path/to/expected.json",
47      "1": [ "param1", "param2" ], // lsp will call lsp.testName(param1, param2)
48      "2": [ "param1", "param2" ]
49   }
50}
51```
52
53#### How to add a new test case?
541. add exampleFuncName2.ets file in `testcases/exampleFuncName` directory
552. add parameters in `cases.ts` file
563. add expected result in `expected/exampleFuncName.json` file
57
58#### How to add a new test function?
591. add exampleFuncName2 directory in `testcases` directory
602. add exampleFuncName2 field in `cases.ts` file
613. add exampleFuncName2.json in `expected` directory
624. add a new test case according to the above steps
63
64⚠️⚠️⚠️
65Before push your code, please make sure that the path formats in all JSON files under the testcases directory are correct.
66Incorrect path formats will render the function of prepare.sh ineffective, and manually handling the paths can be quite annoying.