You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.RDP APIs: Search Explore request failure: 400 Bad Request
155
+
Text: {"error": {"id": "00000000-0000-0000-0000-000000000000", "code": "400", "message": "Validation error", "status": "Bad Request", "errors": [{"key": "json", "reason": "json.View in body should be one of [CatalogItems Entities]"}]}}
### <a id="docker_example_run"></a>Run example test suite in Docker
142
167
@@ -153,13 +178,25 @@ The first step is to unzip or download the example project folder into a directo
153
178
```
154
179
$> docker rm python_unittest
155
180
```
181
+
182
+
183
+
184
+
That covers how to run an example test suite.
185
+
156
186
## <a id="summary"></a>Conclusion and Next Steps
157
187
158
-
**To Add Conclusion and Next Steps here.**
188
+
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.
189
+
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.
191
+
192
+
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).
193
+
194
+
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.
195
+
159
196
160
197
## <a id="references"></a>References
161
198
162
-
For further details, please check out the following resources:
199
+
That brings me to the end of my unit test example project. For further details, please check out the following resources:
163
200
* [Refinitiv Data Platform APIs page](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis) on the [Refinitiv Developer Community](https://developers.refinitiv.com/) website.
164
201
* [Refinitiv Data Platform APIs Playground page](https://api.refinitiv.com).
165
202
* [Refinitiv Data Platform APIs: Introduction to the Request-Response API](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis/tutorials#introduction-to-the-request-response-api).
Copy file name to clipboardExpand all lines: unittest-article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -313,7 +313,7 @@ A mock is a fake object that is constructed to look and act like real data withi
313
313
314
314
The purpose of mocking is to isolate and focus on the code being tested and not on the behavior or state of external dependencies. By mocking out external dependencies, developers can run tests as often without being affected by any unexpected changes or irregularities of those dependencies. Mocking also helps developers save time and computing resources if they have to test HTTP requests that fetch a lot of data.
315
315
316
-
This example project uses the [Responses](https://github.com/getsentry/responses) library for mocking the Requests library.
316
+
This example project uses the [Responses](https://github.com/getsentry/responses) library which is built specifically for mocking the Requests library.
317
317
318
318
### <aid="add_mock_test"></a>Adding a mock Object to the test case
0 commit comments