Skip to content

Commit 005a22a

Browse files
authored
readme on how to run the test
1 parent b05399c commit 005a22a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

sdk/cosmos/cosmosclient/c_tests/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,42 @@
33
This directory contains tests written in C that utilize the Cosmos Client library. The tests are designed to validate the functionality of the Cosmos Client C API, ensuring that it correctly interacts with the Azure CosmosDB service.
44

55
Building this directory requires CMake, Rust, and a C compiler.
6+
7+
## Running the tests
8+
9+
To run the tests, follow these steps:
10+
11+
1. Create a `build` directory:
12+
13+
```bash
14+
mkdir build
15+
cd build
16+
```
17+
18+
1. Configure the project with CMake:
19+
20+
```bash
21+
cmake ..
22+
```
23+
24+
1. Run the build AND tests:
25+
26+
```bash
27+
make && make test
28+
```
29+
30+
## Test Structure
31+
32+
Each test is a separate C program located in the `c_tests` directory.
33+
The tests are compiled into executables that can be run independently.
34+
Tests must be manually listed in `CMakeLists.txt` to be included in the build process:
35+
36+
```cmake
37+
set(TEST_FILES
38+
./c_tests/version.c
39+
./c_tests/your_test_here.c)
40+
```
41+
42+
Once a test is present in the `TEST_FILES` list, it will be automatically compiled and linked against the Cosmos Client library (either static, or dynamic, depending on the value of `BUILD_SHARED_LIBS` when `cmake` is run, which defaults to `ON`).
43+
44+
Helper code should be added to an include file in the `c_tests` directory, such as `c_tests/test_helpers.h`, and included in the test files as needed.

0 commit comments

Comments
 (0)