In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
I. Background
There are 4 test classes and 15 test cases under test module. Practice to become familiar with the specified set of test cases provided by pytest.
Pytest provides a variety of ways to specify test case sets:
Specify module Specify keyword Specify file Specify expression of tag
II. PRACTICE
The following practices are performed in pycharm.
Designated module
[Run/Debug Configuration]-[Additional Arguments] parameter is empty, run directly.
As you can see from the results, all 15 test cases were executed. specified keyword
At runtime, you can specify some test cases by specifying the-k parameter. Here is help for the-k parameter.
Example 1:
[Run/Debug Configuration]-[Additional Arguments]-[-k "test_20"]. By specifying keywords, 5 test cases matching keywords were executed.
Example 2:
[Run/Debug Configuration]-[Additional Arguments]-[-k "not test_20"], ignoring test_20* test cases by specifying keywords
specified file
[Run/Debug Configuration]-[Working directory], which is set to pytest file, which is equivalent to executing test_xx.py file in dayByDay directory.
Specify the expression of the tag. Add the tag to the class or method, such as @pytest.marker.webtestbr/> Add the tag to the class or method, such as @ pytest.marker.webtest.
III. SUMMARY
Pytest provides a way to sort test cases and select them flexibly. At the same time, when constructing the name of the test case, it is necessary to define keywords that are easy to identify.
IV. References
https://docs.pytest.org/en/latest/example/markers.html#using-k-expr-to-select-tests-based-on-their-name
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.