Import code for unit test¶
Import code
(1)Use GUI to imort code¶
Menu code->Import code
(2)Manually mody config.cfg to import code¶
To setup project path and testcode path
编辑config.cfg
Name |
Description |
---|---|
source_code |
soucecode path |
test_code |
testcode path |
Example1(demo)¶
setup project path for c_demo
[PATH]
#To set the source code path of a project
source_code =c_demo
#To set the test code path, if not set, test_code will be autoly created.
test_code =
Example2 setup project path and testcode path.( testcode path could be in a diference dir)
[PATH]
#To set the source code path of a project
source_code =/mnt/d/mycode
#To set the test code path, if not set, test_code will be autoly created.
.```
## (3)Use Command line to import source code
{**config**}
config the source code
arguments :
-s arg specified the source code dir
-t arg specified the test code dir
### Command line example
### **Example1**(demo)
setup the example path
```shell
ctestcode config -s c_demo
Example 2 The first time create unit test¶
Source code is /mnt/d/mycode
For the first time, it will create a folder named testcode to store test code
/mnt/d/mycode/ctestcode
ctestcode config -s /mnt/d/mycode -t /mnt/d/mycode/unittest
Example 3 Specify the source with testcode¶
Source code is at /home/mycode
test code is at /home/testcode
ctestcode config -s /home/mycode -t /home/testcode
(4)ctestcode unit test project folder stucture¶
project main folder
├──testcode [1]
│ ├── mirror of project sub folder [2]
│ └── config.ut [3]
└── project sub folder [4]