自动生成测试用例_接口测试用例自动生成工具

这篇具有很好参考价值的文章主要介绍了自动生成测试用例_接口测试用例自动生成工具。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

前言

写用例之前,我们应该熟悉API的详细信息。建议使用抓包工具Charles或AnyProxy进行抓包。

har2case

我们先来了解一下另一个项目har2case 他的工作原理就是将当前主流的抓包工具和浏览器都支持将抓取得到的数据包导出为标准通用的 HAR 格式(HTTP Archive),然后 HttpRunner 将 HAR 格式的数据包转换为YAML/JSON格式的测试用例文件。 这里使用charles抓取百度首页进行演示

选中百度请求,右键点击Export Session,导出到/hrun_demo/har下,命名为baidu,格式选择HTTP Archive(.har),点击save

自动生成测试用例_接口测试用例自动生成工具

自动生成测试用例_接口测试用例自动生成工具

此时,har文件夹下会多出baidu.har文件

har2case生成用例

可以使用命令har2case将Har文件转成测试用例,先使用命令har2case -h查看帮助文档

(httprunner_env) ➜  har har2case -h       
usage: har2case har2case [-h] [-2y] [-2j] [--filter FILTER]
                         [--exclude EXCLUDE]
                         [har_source_file]

positional arguments:
  har_source_file       Specify HAR source file

optional arguments:
  -h, --help            show this help message and exit
  -2y, --to-yml, --to-yaml
                        Convert to YAML format, if not specified, convert to
                        pytest format by default.
  -2j, --to-json        Convert to JSON format, if not specified, convert to
                        pytest format by default.
  --filter FILTER       Specify filter keyword, only url include filter string
                        will be converted.
  --exclude EXCLUDE     Specify exclude keyword, url that includes exclude
                        string will be ignored, multiple keywords can be
                        joined with '|'
  • -2y:转换为yaml格式,如果没有指定,默认转换为pytest格式
  • -2j:转换为json格式,如果没有指定,默认转换为pytest格式
  • –filter:指定筛选关键字,仅url包含筛选字符串将被转换。
  • –exclude:指定exclude关键字,包括exclude的url字符串将被忽略,可以选择多个关键字以“|”联接

生成pytest格式的用例

HttpRunner 3.0.7版本开始,har2case将HAR文件默认转换成pytest,强烈建议pytest格式而不是以前的YAML / JSON格式编写和维护测试用例。 这里也是博主从pytest框架转换为httprunner框架的原因之一 运行命令将har文件转换成测试用例:

(httprunner_env) ➜  har har2case baidu.har
2021-02-05 11:27:32.945 | INFO     | httprunner.ext.har2case.core:gen_testcase:356 - Start to generate testcase from /Users/jkc/hrun/hrun_demo/har/baidu.har
2021-02-05 11:27:32.945 | INFO     | httprunner.ext.har2case.core:_make_testcase:347 - Extract info from HAR file and prepare for testcase.
2021-02-05 11:27:32.948 | INFO     | httprunner.compat:ensure_testcase_v3:219 - ensure compatibility with testcase format v2
2021-02-05 11:27:32.948 | INFO     | httprunner.loader:load_dot_env_file:127 - Loading environment variables from /Users/jkc/hrun/hrun_demo/.env
2021-02-05 11:27:32.949 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: USERNAME
2021-02-05 11:27:32.949 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: PASSWORD
2021-02-05 11:27:32.950 | INFO     | httprunner.make:make_testcase:349 - start to make testcase: /Users/jkc/hrun/hrun_demo/har/baidu.har
2021-02-05 11:27:32.951 | INFO     | httprunner.make:make_testcase:442 - generated testcase: /Users/jkc/hrun/hrun_demo/har/baidu_test.py
2021-02-05 11:27:32.952 | INFO     | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
reformatted /Users/songyingkai/hrun/hrun_demo/har/baidu_test.py
All done! ✨ 🍰 ✨
1 file reformatted.
2021-02-05 11:27:33.181 | INFO     | httprunner.ext.har2case.core:gen_testcase:377 - generated testcase: /Users/jkc/hrun/hrun_demo/har/baidu_test.py
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

生成的pytest文件是标准的python文件,如下所示:

# NOTE: Generated By HttpRunner v3.1.4
# FROM: har/baidu.har


from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase


class TestCaseBaidu(HttpRunner):

    config = Config("testcase description").verify(False)

    teststeps = [
        Step(
            RunRequest("/")
            .get("https://www.baidu.com/")
            .with_headers(
                **{
                    "Host": "www.baidu.com",
                    "Connection": "keep-alive",
                    "Cache-Control": "max-age=0",
                    "sec-ch-ua": '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
                    "sec-ch-ua-mobile": "?0",
                    "Upgrade-Insecure-Requests": "1",
                    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36",
                    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
                    "Sec-Fetch-Site": "none",
                    "Sec-Fetch-Mode": "navigate",
                    "Sec-Fetch-User": "?1",
                    "Sec-Fetch-Dest": "document",
                    "Accept-Encoding": "gzip, deflate, br",
                    "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
                    "Cookie": "PSTM=1610459846; BAIDUID=A40AD6AD806FBBED1033903732FFA453:FG=1; BD_UPN=123253; BIDUPSID=898B917A8EF92E036B0F06DC792638A1; __yjs_duid=1_c391922164c20246fd49e4ad821d46c41610613507042; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; H_PS_PSSID=33423_33513_33403_33273_33594_33585_26350_33568; delPer=0; BD_CK_SAM=1; PSINO=5; BAIDUID_BFESS=A40AD6AD806FBBED1033903732FFA453:FG=1; COOKIE_SESSION=86630_1_9_6_41_5_0_0_8_2_1_0_0_0_71_0_1612340974_1611912344_1612427533%7C9%23262013_235_1611912339%7C9; BD_HOME=1; ZD_ENTRY=baidu; BA_HECTOR=20ag2180aga18k21mm1g1pegu0r",
                }
            )
            .with_cookies(
                **{
                    "PSTM": "1610459846",
                    "BAIDUID": "A40AD6AD806FBBED1033903732FFA453:FG=1",
                    "BD_UPN": "123253",
                    "BIDUPSID": "898B917A8EF92E036B0F06DC792638A1",
                    "__yjs_duid": "1_c391922164c20246fd49e4ad821d46c41610613507042",
                    "BDORZ": "B490B5EBF6F3CD402E515D22BCDA1598",
                    "H_PS_PSSID": "33423_33513_33403_33273_33594_33585_26350_33568",
                    "delPer": "0",
                    "BD_CK_SAM": "1",
                    "PSINO": "5",
                    "BAIDUID_BFESS": "A40AD6AD806FBBED1033903732FFA453:FG=1",
                    "COOKIE_SESSION": "86630_1_9_6_41_5_0_0_8_2_1_0_0_0_71_0_1612340974_1611912344_1612427533%7C9%23262013_235_1611912339%7C9",
                    "BD_HOME": "1",
                    "ZD_ENTRY": "baidu",
                    "BA_HECTOR": "20ag2180aga18k21mm1g1pegu0r",
                }
            )
            .validate()
            .assert_equal("status_code", 200)
            .assert_equal('headers."Content-Type"', "text/html;charset=utf-8")
        ),
    ]


if __name__ == "__main__":
    TestCaseBaidu().test_start()

可以使用命令hrunpytest运行,实际上,hrun是pytest的封装,效果基本相同。

(httprunner_env) ➜  har hrun baidu_test.py 
2021-02-05 14:03:39.279 | INFO     | httprunner.make:__make:512 - make path: /Users/jkc/hrun/hrun_demo/har/baidu_test.py
2021-02-05 14:03:39.279 | INFO     | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
No Path provided. Nothing to do 😴
2021-02-05 14:03:39.457 | INFO     | httprunner.cli:main_run:56 - start to run tests with pytest. HttpRunner version: 3.1.4
============================================= test session starts =============================================
platform darwin -- Python 3.7.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/songyingkai/hrun/hrun_demo/har
plugins: metadata-1.11.0, html-2.1.1
collected 1 item                                                                                              

baidu_test.py .                                                                                         [100%]

============================================== 1 passed in 0.25s ==============================================
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
(httprunner_env) ➜  har pytest baidu_test.py 
============================================= test session starts =============================================
platform darwin -- Python 3.7.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/songyingkai/hrun/hrun_demo/har
plugins: metadata-1.11.0, html-2.1.1
collected 1 item                                                                                              

baidu_test.py .                                                                                         [100%]

============================================== warnings summary ===============================================
baidu_test.py::TestCaseBaidu::test_start
  /Users/songyingkai/.virtualenvs/httprunner_env/lib/python3.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.baidu.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    InsecureRequestWarning,

-- Docs: https://docs.pytest.org/en/latest/warnings.html
======================================== 1 passed, 1 warning in 0.47s =========================================

生成测试用例(YAML/JSON)

当然,你也可以生成YAML/JSON测试用例。 只需要在har2case命令后 添加-2y/--to-yml-2j/--to-json

生成YAML格式:

har har2case baidu.har -2y
(httprunner_env) ➜  har har2case baidu.har -2y
2021-02-05 14:23:48.484 | INFO     | httprunner.ext.har2case.core:gen_testcase:356 - Start to generate testcase from /Users/jkc/hrun/hrun_demo/har/baidu.har
2021-02-05 14:23:48.484 | INFO     | httprunner.ext.har2case.core:_make_testcase:347 - Extract info from HAR file and prepare for testcase.
2021-02-05 14:23:48.488 | INFO     | httprunner.ext.har2case.utils:dump_yaml:108 - dump testcase to YAML format.
2021-02-05 14:23:48.492 | INFO     | httprunner.ext.har2case.utils:dump_yaml:115 - Generate YAML testcase successfully: /Users/jkc/hrun/hrun_demo/har/baidu.yml
2021-02-05 14:23:48.493 | INFO     | httprunner.ext.har2case.core:gen_testcase:377 - generated testcase: /Users/jkc/hrun/hrun_demo/har/baidu.yml
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

查看生成的yaml文件

config:
    name: testcase description
    variables: {}
    verify: false
teststeps:
-   name: /
    request:
        cookies:
            BAIDUID: A40AD6AD806FBBED1033903732FFA453:FG=1
            BAIDUID_BFESS: A40AD6AD806FBBED1033903732FFA453:FG=1
            BA_HECTOR: 20ag2180aga18k21mm1g1pegu0r
            BDORZ: B490B5EBF6F3CD402E515D22BCDA1598
            BD_CK_SAM: '1'
            BD_HOME: '1'
            BD_UPN: '123253'
            BIDUPSID: 898B917A8EF92E036B0F06DC792638A1
            COOKIE_SESSION: 86630_1_9_6_41_5_0_0_8_2_1_0_0_0_71_0_1612340974_1611912344_1612427533%7C9%23262013_235_1611912339%7C9
            H_PS_PSSID: '33423_33513_33403_33273_33594_33585_26350_33568'
            PSINO: '5'
            PSTM: '1610459846'
            ZD_ENTRY: baidu
            __yjs_duid: 1_c391922164c20246fd49e4ad821d46c41610613507042
            delPer: '0'
        headers:
            Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
            Accept-Encoding: gzip, deflate, br
            Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
            Cache-Control: max-age=0
            Connection: keep-alive
            Cookie: PSTM=1610459846; BAIDUID=A40AD6AD806FBBED1033903732FFA453:FG=1;
                BD_UPN=123253; BIDUPSID=898B917A8EF92E036B0F06DC792638A1; __yjs_duid=1_c391922164c20246fd49e4ad821d46c41610613507042;
                BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; H_PS_PSSID=33423_33513_33403_33273_33594_33585_26350_33568;
                delPer=0; BD_CK_SAM=1; PSINO=5; BAIDUID_BFESS=A40AD6AD806FBBED1033903732FFA453:FG=1;
                COOKIE_SESSION=86630_1_9_6_41_5_0_0_8_2_1_0_0_0_71_0_1612340974_1611912344_1612427533%7C9%23262013_235_1611912339%7C9;
                BD_HOME=1; ZD_ENTRY=baidu; BA_HECTOR=20ag2180aga18k21mm1g1pegu0r
            Host: www.baidu.com
            Sec-Fetch-Dest: document
            Sec-Fetch-Mode: navigate
            Sec-Fetch-Site: none
            Sec-Fetch-User: ?1
            Upgrade-Insecure-Requests: '1'
            User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36
                (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36
            sec-ch-ua: '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"'
            sec-ch-ua-mobile: ?0
        method: GET
        url: https://www.baidu.com/
    validate:
    -   eq:
        - status_code
        - 200
    -   eq:
        - headers.Content-Type
        - text/html;charset=utf-8

生成JSON格式:

har2case baidu.har -2j
(httprunner_env) ➜  har har2case baidu.har -2j
2021-02-05 14:25:35.729 | INFO     | httprunner.ext.har2case.core:gen_testcase:356 - Start to generate testcase from /Users/jkc/hrun/hrun_demo/har/baidu.har
2021-02-05 14:25:35.730 | INFO     | httprunner.ext.har2case.core:_make_testcase:347 - Extract info from HAR file and prepare for testcase.
2021-02-05 14:25:35.732 | INFO     | httprunner.ext.har2case.utils:dump_json:121 - dump testcase to JSON format.
2021-02-05 14:25:35.733 | INFO     | httprunner.ext.har2case.utils:dump_json:130 - Generate JSON testcase successfully: /Users/jkc/hrun/hrun_demo/har/baidu.json
2021-02-05 14:25:35.733 | INFO     | httprunner.ext.har2case.core:gen_testcase:377 - generated testcase: /Users/jkc/hrun/hrun_demo/har/baidu.json
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

查看生成的json格式

{
    "config": {
        "name": "testcase description",
        "variables": {},
        "verify": false
    },
    "teststeps": [
        {
            "name": "/",
            "request": {
                "url": "https://www.baidu.com/",
                "method": "GET",
                "cookies": {
                    "PSTM": "1610459846",
                    "BAIDUID": "A40AD6AD806FBBED1033903732FFA453:FG=1",
                    "BD_UPN": "123253",
                    "BIDUPSID": "898B917A8EF92E036B0F06DC792638A1",
                    "__yjs_duid": "1_c391922164c20246fd49e4ad821d46c41610613507042",
                    "BDORZ": "B490B5EBF6F3CD402E515D22BCDA1598",
                    "H_PS_PSSID": "33423_33513_33403_33273_33594_33585_26350_33568",
                    "delPer": "0",
                    "BD_CK_SAM": "1",
                    "PSINO": "5",
                    "BAIDUID_BFESS": "A40AD6AD806FBBED1033903732FFA453:FG=1",
                    "COOKIE_SESSION": "86630_1_9_6_41_5_0_0_8_2_1_0_0_0_71_0_1612340974_1611912344_1612427533%7C9%23262013_235_1611912339%7C9",
                    "BD_HOME": "1",
                    "ZD_ENTRY": "baidu",
                    "BA_HECTOR": "20ag2180aga18k21mm1g1pegu0r"
                },
                "headers": {
                    "Host": "www.baidu.com",
                    "Connection": "keep-alive",
                    "Cache-Control": "max-age=0",
                    "sec-ch-ua": "\"Chromium\";v=\"88\", \"Google Chrome\";v=\"88\", \";Not A Brand\";v=\"99\"",
                    "sec-ch-ua-mobile": "?0",
                    "Upgrade-Insecure-Requests": "1",
                    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36",
                    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
                    "Sec-Fetch-Site": "none",
                    "Sec-Fetch-Mode": "navigate",
                    "Sec-Fetch-User": "?1",
                    "Sec-Fetch-Dest": "document",
                    "Accept-Encoding": "gzip, deflate, br",
                    "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
                    "Cookie": "PSTM=1610459846; BAIDUID=A40AD6AD806FBBED1033903732FFA453:FG=1; BD_UPN=123253; BIDUPSID=898B917A8EF92E036B0F06DC792638A1; __yjs_duid=1_c391922164c20246fd49e4ad821d46c41610613507042; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; H_PS_PSSID=33423_33513_33403_33273_33594_33585_26350_33568; delPer=0; BD_CK_SAM=1; PSINO=5; BAIDUID_BFESS=A40AD6AD806FBBED1033903732FFA453:FG=1; COOKIE_SESSION=86630_1_9_6_41_5_0_0_8_2_1_0_0_0_71_0_1612340974_1611912344_1612427533%7C9%23262013_235_1611912339%7C9; BD_HOME=1; ZD_ENTRY=baidu; BA_HECTOR=20ag2180aga18k21mm1g1pegu0r"
                }
            },
            "validate": [
                {
                    "eq": [
                        "status_code",
                        200
                    ]
                },
                {
                    "eq": [
                        "headers.Content-Type",
                        "text/html;charset=utf-8"
                    ]
                }
            ]
        }
    ]
}

YAML/JSON用例和pytest用例文件含有相同的信息,也可以使用hrun运行。文章来源地址https://www.toymoban.com/news/detail-451931.html

(httprunner_env) ➜  har hrun baidu.yml    
2021-02-05 14:28:05.573 | INFO     | httprunner.make:__make:512 - make path: /Users/jkc/hrun/hrun_demo/har/baidu.yml
2021-02-05 14:28:05.582 | INFO     | httprunner.compat:ensure_testcase_v3:219 - ensure compatibility with testcase format v2
2021-02-05 14:28:05.582 | INFO     | httprunner.loader:load_dot_env_file:127 - Loading environment variables from /Users/jkc/hrun/hrun_demo/.env
2021-02-05 14:28:05.582 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: USERNAME
2021-02-05 14:28:05.582 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: PASSWORD
2021-02-05 14:28:05.583 | INFO     | httprunner.make:make_testcase:349 - start to make testcase: /Users/jkc/hrun/hrun_demo/har/baidu.yml
2021-02-05 14:28:05.583 | INFO     | httprunner.make:make_testcase:442 - generated testcase: /Users/jkc/hrun/hrun_demo/har/baidu_test.py
2021-02-05 14:28:05.584 | INFO     | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
reformatted /Users/songyingkai/hrun/hrun_demo/har/baidu_test.py
All done! ✨ 🍰 ✨
1 file reformatted.
2021-02-05 14:28:05.769 | INFO     | httprunner.cli:main_run:56 - start to run tests with pytest. HttpRunner version: 3.1.4
============================================= test session starts =============================================
platform darwin -- Python 3.7.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/songyingkai/hrun/hrun_demo/har
plugins: metadata-1.11.0, html-2.1.1
collected 1 item                                                                                              

baidu_test.py .                                                                                         [100%]

============================================== 1 passed in 0.26s ==============================================
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
(httprunner_env) ➜  har hrun baidu.json 
2021-02-05 14:28:25.793 | INFO     | httprunner.make:__make:512 - make path: /Users/jkc/hrun/hrun_demo/har/baidu.json
2021-02-05 14:28:25.794 | INFO     | httprunner.compat:ensure_testcase_v3:219 - ensure compatibility with testcase format v2
2021-02-05 14:28:25.794 | INFO     | httprunner.loader:load_dot_env_file:127 - Loading environment variables from /Users/jkc/hrun/hrun_demo/.env
2021-02-05 14:28:25.794 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: USERNAME
2021-02-05 14:28:25.794 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: PASSWORD
2021-02-05 14:28:25.795 | INFO     | httprunner.make:make_testcase:349 - start to make testcase: /Users/jkc/hrun/hrun_demo/har/baidu.json
2021-02-05 14:28:25.795 | INFO     | httprunner.make:make_testcase:442 - generated testcase: /Users/jkc/hrun/hrun_demo/har/baidu_test.py
2021-02-05 14:28:25.795 | INFO     | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
reformatted /Users/songyingkai/hrun/hrun_demo/har/baidu_test.py
All done! ✨ 🍰 ✨
1 file reformatted.
2021-02-05 14:28:25.975 | INFO     | httprunner.cli:main_run:56 - start to run tests with pytest. HttpRunner version: 3.1.4
============================================= test session starts =============================================
platform darwin -- Python 3.7.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/songyingkai/hrun/hrun_demo/har
plugins: metadata-1.11.0, html-2.1.1
collected 1 item                                                                                              

baidu_test.py .                                                                                         [100%]

============================================== 1 passed in 0.31s ==============================================
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

到了这里,关于自动生成测试用例_接口测试用例自动生成工具的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Python实现自动生成测试用例

    目录 1、概要... 3 2、正交表法简介... 3 2.1、什么是正交表法... 3 2.2、正交表法优点... 3 2.3、正交表法的缺点... 4 2.4、为什么选择正交表法... 4 3、Python实现... 4 3.1、实现自动化排列组合... 4 3.2、解决元素互斥... 5 3.3、解决流程终止... 6 4、case_generate工具使用方法... 6 4.1、使用流

    2024年02月05日
    浏览(64)
  • 模型生成自动化测试用例

    自动产生的测试用例本就应该由程序自动执行,这其实也就是NModel推荐的模式。先回过头来看看文章中制作的模型,模型里面将登录、注销、用户名以及密码等要素都抽象出来了,而NModel是以这些抽象出来的动作(登录、注销)和状态(用户名、密码)为依据,产生测试用例

    2024年02月09日
    浏览(48)
  • 使用testMe自动生成单元测试用例

    公司对于系统单元测试覆盖率有要求,需要达到50%或80%以上才可以,但是对于之前的老项目或者是前期赶进度未添加单元测试用例的项目来说,手动添加单元测试耗时又费力,这时候我们就需要一款能够提高效率的一款插件来帮助我们提高单元测试覆盖率,经过对比temstMe、

    2024年02月07日
    浏览(62)
  • 软件测试/测试开发丨利用ChatGPT自动生成测试用例思维导图

    公众号搜索:TestingStudio 霍格沃兹测试开发的干货都很硬核 在写测试用例的时候,你是不是经常会遇到以下难题: 缺少边界测试用例: 在编写测试用例时,有时候会忽略某些边界情况,这可能导致无法发现软件中的潜在问题。 无法覆盖所有的场景: 测试用例的数量可能非常

    2024年02月07日
    浏览(55)
  • Selenium+python怎么搭建自动化测试框架、执行自动化测试用例、生成自动化测试报告、发送测试报告邮件

    本人在网上查找了很多做自动化的教程和实例,偶然的一个机会接触到了selenium,觉得非常好用。后来就在网上查阅各种selenium的教程,但是网上的东西真的是太多了,以至于很多东西参考完后无法系统的学习和应用。 以下整理的只是书中自动化项目的知识内容,介绍怎么搭

    2024年02月05日
    浏览(62)
  • 如何使用apifox打包测试用例生成测试套件自动化执行

    1、首先点击自动化测试--创建测试用例--新建分组(整理每个模块对应的测试用例),右键点击对应的分组新建测试用例,开始创建测试用例。 2、创建测试用例:输入对应的名称,以及用例执行的优先级(核心、高、中、低),添加对应的用例备注(说明)  3、编辑测试用

    2024年02月11日
    浏览(51)
  • 【AltWalker】模型驱动:轻松实现自动化测试用例的自动生成和组织执行

    模型驱动的自动化测试(Model-Based Testing, 后文中我们将简称为MBT)是一种软件测试方法,它将系统的行为表示为一个或多个模型,然后从模型中自动生成和执行测试用例。这种方法的核心思想是将测试过程中的重点从手动编写测试用例转移到创建和维护描述系统行为的模型。

    2024年02月15日
    浏览(48)
  • java单元测试自动生成测试用例插件diffblue cover和evosuite

    Diffblue Cover和Evosuite都可以通过IDEA插件安装。两者的区别如下: evosuite安装无需联网。diffblue cover社区版安装无需联网,但需要联网激活。 使用Jacoco或idea的coverage插件获取覆盖率时,Evosuite生成的用例只能显示出覆盖率,不会显示哪块代码没有覆盖。diffblue cover生成的用例可与

    2024年02月11日
    浏览(67)
  • 如何使用GPT-3.5提高渗透测试工作效率以及测试用例自动生成

    部分数据来源: ChatGPT         作为一名渗透测试人员,我们需要分析和发现网络安全漏洞,并开发和测试安全解决方案。这是一个重复性工作的任务,如果我们能够使用GPT-3.5来协助我们完成这个任务,那将会提高我们的效率和减少工作量。 在本文中,我将介绍一些GPT

    2024年02月06日
    浏览(76)
  • 面向高速公路车辆切入场景的自动驾驶测试用例生成方法

    1 前言 自动驾驶汽车为解决“交通事故、交通拥堵、环境污染、能源短缺”等问题提供了新的途径[1]。科学完善的测试验证评价体系对提高自动驾驶汽车的研发效率、健全相关法律法规、推进智能交通发展至关重要[2]。自2009年起,谷歌自动驾驶汽车已经进行了超过560万km公共

    2024年02月10日
    浏览(40)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包