Skip to content

Commit d73da9a

Browse files
committed
1. Add diagram
2. Add images
1 parent 97db6b0 commit d73da9a

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ This demo project is not cover all test cases for the HTTP operations and all RD
2626

2727
A unit test helps developers to isolate what is broken in their application easier and faster than testing an entire system as a whole. It is the first level of testing done during the development process before integration testing. It is mostly done by the developers automated or manually to verify their code.
2828

29+
![figure-1](images/01_unittest.png "Unit Testing Life Cycle")
30+
2931
You can find more detail about the unit test concept from the following resources:
3032
- [Python Guide: Testing Your Code](https://docs.python-guide.org/writing/tests/) article.
3133
- [How and when to use Unit Testing properly](https://softwareengineering.stackexchange.com/questions/89064/how-and-when-to-use-unit-testing-properly) post.
@@ -90,10 +92,13 @@ RDP APIs give developers seamless and holistic access to all of the Refinitiv co
9092

9193
This example project is focusing on the Request-Response: RESTful web service delivery method only.
9294

95+
![figure-2](images/02_rdp.png "Refinitiv Data Platform")
96+
9397
For more detail regarding the Refinitiv Data Platform, please see the following APIs resources:
9498
- [Quick Start](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis/quick-start) page.
9599
- [Tutorials](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis/tutorials) page.
96100

101+
97102
## <a id="testsuite_detail"></a>Test Suit Development Detail
98103

99104
Please see the full details over the test suite implementation on the [unittest-article.md](unittest-article.md) file.
@@ -129,11 +134,11 @@ The first step is to unzip or download the example project folder into a directo
129134
```
130135
(http_unittest) $>pip install -r requirements.txt
131136
```
132-
5. Once the dependencies installation process success, Go to the project's *tests* folder, then run the following command to run the ```test_rdp_http_controller.py``` test suite.
137+
5. Once the dependencies installation process is success, Go to the project's *tests* folder, then run the following command to run the ```test_rdp_http_controller.py``` test suite.
133138
```
134139
(http_unittest) $>tests\python -m unittest test_rdp_http_controller
135140
```
136-
6. To run all test suites (```test_rdp_http_controller.py`` and ```test_app.py``` files), run the following command in the project's *tests* folder.
141+
6. To run all test suites (```test_rdp_http_controller.py``` and ```test_app.py``` files), run the following command in the project's *tests* folder.
137142
```
138143
(http_unittest) $>tests\python -m unittest discover
139144
```
@@ -178,22 +183,22 @@ OK
178183
```
179184
$> docker rm python_unittest
180185
```
181-
182-
186+
![figure-3](images/03_docker_run_result.gif "Refinitiv Data Platform")
183187
184188
That covers how to run an example test suite.
185189
186190
## <a id="summary"></a>Conclusion and Next Steps
187191
188192
Unit testing is now the mandatory process of a software development lifecycle for both modern and legacy applications. It helps to expose unintentional behaviors of a tiny part of the application quicker than trying to find bugs in a big complex phase. It speeds up the overall feedback loop and improves trust among the project team. Unit testing also helps improves application source code quality, developers have more confidence in refactoring the source code for better performance and cleaner code. As the author of this article, I also have learned a lot from this project. There are a lot of error handlers or code logic that I never think of until I started to write unit test cases.
189193
190-
This example project demonstrates the manual unit testing method. However, developers should run unit test cases automatically every time they made changes to the code (or configurations). The most practical technique is running automated unit tests as part of the developers' Continuous Integration/Continuous Delivery (CI/CD) pipeline. Developers can apply the TDD (Test-driven development) practice that writing and correcting the failed tests before writing new code with their project too.
194+
This example project demonstrates the manual unit testing method. However, developers should run unit test cases automatically every time they made changes to the code (or configurations). The most practical technique is running automated unit tests as part of the developers' Continuous Integration/Continuous Delivery (CI/CD) pipeline. Developers can apply the TDD (Test-driven development) approach that writing and correcting the failed tests before writing new code with their project too.
195+
196+
![figure-4](images/04_tdd.png "TDD Life Cycle")
191197
192198
The [unittest](https://docs.python.org/3.9/library/unittest.html) framework and [Responses](https://github.com/getsentry/responses) mocking library are very good starting points to learn a unit test with [Python](https://www.python.org/) and build a simple test suite to test HTTP operations source code. If developers need more advanced features, they can explore other Python unit test frameworks such as [pytest](https://docs.pytest.org/en/7.1.x/), [nose2](https://github.com/nose-devs/nose2), or [doctest](https://github.com/doctest/doctest).
193199
194200
At the same time, the [Refinitiv Data Platform (RDP) APIs](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis) provide various Refinitiv data and content for developers via an easy-to-use Web-based API. The APIs are easy to integrate into any application and platform that supports the HTTP protocol and JSON message format.
195201
196-
197202
## <a id="references"></a>References
198203
199204
That brings me to the end of my unit test example project. For further details, please check out the following resources:

diagrams/diagram.pptx

40.3 KB
Binary file not shown.

images/01_unittest.png

16.5 KB
Loading

images/02_rdp.png

98.7 KB
Loading

images/03_docker_run_result.gif

326 KB
Loading

images/04_tdd.png

18.8 KB
Loading

0 commit comments

Comments
 (0)