From 42590c3c5c9d6ef9a04c7459aabe947159ab6236 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sun, 5 Nov 2017 11:41:16 +0800 Subject: [PATCH] rename project name to HttpRunner --- README.md | 22 ++++++++++++---------- ate/__init__.py | 2 +- ate/cli.py | 2 +- ate/client.py | 4 ++-- docs/FAQ.md | 8 ++++---- docs/background-CN.md | 2 +- docs/quickstart.md | 12 ++++++------ setup.py | 8 ++++---- 8 files changed, 31 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 1e82bc5f..12f67a84 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ -# ApiTestEngine +# HttpRunner -[![Build Status](https://travis-ci.org/debugtalk/ApiTestEngine.svg?branch=master)](https://travis-ci.org/debugtalk/ApiTestEngine) -[![Coverage Status](https://coveralls.io/repos/github/debugtalk/ApiTestEngine/badge.svg?branch=master)](https://coveralls.io/github/debugtalk/ApiTestEngine?branch=master) +[![Build Status](https://travis-ci.org/debugtalk/HttpRunner.svg?branch=master)](https://travis-ci.org/debugtalk/HttpRunner) +[![Coverage Status](https://coveralls.io/repos/github/debugtalk/HttpRunner/badge.svg?branch=master)](https://coveralls.io/github/debugtalk/HttpRunner?branch=master) + +New name for `ApiTestEngine`. ## Design Philosophy @@ -23,13 +25,13 @@ Take full reuse of Python's existing powerful libraries: [`Requests`][requests], ## Installation/Upgrade ```bash -$ pip install git+https://github.com/debugtalk/ApiTestEngine.git#egg=ApiTestEngine --process-dependency-links +$ pip install git+https://github.com/debugtalk/HttpRunner.git#egg=HttpRunner --process-dependency-links ``` To upgrade all specified packages to the newest available version, you should add the `-U` option. ```bash -$ pip install -U git+https://github.com/debugtalk/ApiTestEngine.git#egg=ApiTestEngine --process-dependency-links +$ pip install -U git+https://github.com/debugtalk/HttpRunner.git#egg=HttpRunner --process-dependency-links ``` If there is a problem with the installation or upgrade, you can check the [`FAQ`](docs/FAQ.md). @@ -38,7 +40,7 @@ To ensure the installation or upgrade is successful, you can execute command `at ```text $ ate -V -ApiTestEngine version: 0.7.7 +HttpRunner version: 0.8.0 ``` Execute the command `ate -h` to view command help. @@ -49,7 +51,7 @@ usage: ate [-h] [-V] [--log-level LOG_LEVEL] [--report-name REPORT_NAME] [--failfast] [--startproject STARTPROJECT] [testset_paths [testset_paths ...]] -ApiTestEngine. +HttpRunner. positional arguments: testset_paths testset file path @@ -125,7 +127,7 @@ For detailed regulations of writing testcases, you can read the [`QuickStart`][q ## Run testcases -`ApiTestEngine` can run testcases in diverse ways. +`HttpRunner` can run testcases in diverse ways. You can run single testset by specifying testset file path. @@ -204,11 +206,11 @@ Enjoy! Python `2.7`, `3.4`, `3.5` and `3.6`. -`ApiTestEngine` has been tested on `macOS`, `Linux` and `Windows` platforms. +`HttpRunner` has been tested on `macOS`, `Linux` and `Windows` platforms. ## Development -To develop or debug `ApiTestEngine`, you can install relevant requirements and use `main-ate.py` or `main-locust.py` as entrances. +To develop or debug `HttpRunner`, you can install relevant requirements and use `main-ate.py` or `main-locust.py` as entrances. ```bash $ pip install -r requirements_dev.txt diff --git a/ate/__init__.py b/ate/__init__.py index b7bef124..707f5d34 100644 --- a/ate/__init__.py +++ b/ate/__init__.py @@ -1 +1 @@ -__version__ = '0.7.8' \ No newline at end of file +__version__ = '0.7.9' \ No newline at end of file diff --git a/ate/cli.py b/ate/cli.py index 74930d8b..decb80f1 100644 --- a/ate/cli.py +++ b/ate/cli.py @@ -38,7 +38,7 @@ def main_ate(): args = parser.parse_args() if args.version: - print("ApiTestEngine version: {}".format(__version__)) + print("HttpRunner version: {}".format(__version__)) exit(0) log_level = getattr(logging, args.log_level.upper()) diff --git a/ate/client.py b/ate/client.py index a94a3ce7..8c1cdca1 100644 --- a/ate/client.py +++ b/ate/client.py @@ -31,7 +31,7 @@ class ApiResponse(Response): class HttpSession(requests.Session): """ Class for performing HTTP requests and holding (session-) cookies between requests (in order - to be able to log in and out of websites). Each request is logged so that ApiTestEngine can + to be able to log in and out of websites). Each request is logged so that HttpRunner can display statistics. This is a slightly extended version of `python-request `_'s @@ -39,7 +39,7 @@ class HttpSession(requests.Session): the methods for making requests (get, post, delete, put, head, options, patch, request) can now take a *url* argument that's only the path part of the URL, in which case the host part of the URL will be prepended with the HttpSession.base_url which is normally inherited - from a ApiTestEngine class' host property. + from a HttpRunner class' host property. """ def __init__(self, base_url=None, *args, **kwargs): super(HttpSession, self).__init__(*args, **kwargs) diff --git a/docs/FAQ.md b/docs/FAQ.md index accdcb90..38583eb8 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -3,8 +3,8 @@ If there is something goes wrong in installation like below. ```text -Downloading/unpacking PyUnitReport (from ApiTestEngine) - Could not find any downloads that satisfy the requirement PyUnitReport (from ApiTestEngine) +Downloading/unpacking PyUnitReport (from HttpRunner) + Could not find any downloads that satisfy the requirement PyUnitReport (from HttpRunner) ``` You could install `PyUnitReport` manully at first. @@ -13,8 +13,8 @@ You could install `PyUnitReport` manully at first. $ pip install git+https://github.com/debugtalk/PyUnitReport.git#egg=PyUnitReport ``` -And then everything will be OK when you reinstall `ApiTestEngine`. +And then everything will be OK when you reinstall `HttpRunner`. ```bash -$ pip install git+https://github.com/debugtalk/ApiTestEngine.git#egg=ApiTestEngine +$ pip install git+https://github.com/debugtalk/HttpRunner.git#egg=HttpRunner ``` diff --git a/docs/background-CN.md b/docs/background-CN.md index f2659b70..87fa5874 100644 --- a/docs/background-CN.md +++ b/docs/background-CN.md @@ -41,4 +41,4 @@ 当然,每位工程师对`最佳工程实践`的理念或多或少都会存在一些差异,也希望大家能多多交流,在思维的碰撞中共同进步。 -[ApiTestEngine]: https://github.com/debugtalk/ApiTestEngine \ No newline at end of file +[ApiTestEngine]: https://github.com/debugtalk/HttpRunner \ No newline at end of file diff --git a/docs/quickstart.md b/docs/quickstart.md index c6b2783b..b258341c 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -2,7 +2,7 @@ ## Introduction to Sample Interface Service -Along with this project, I devised a sample interface service, and you can use it to familiarize how to play with `ApiTestEngine`. +Along with this project, I devised a sample interface service, and you can use it to familiarize how to play with `HttpRunner`. This sample service mainly has two parts: @@ -76,7 +76,7 @@ You may wonder why we use the `json` field other than `data`. That's because the Have you recalled some familiar scenes? -Yes! That's what we did in [`requests.request`](requests.request)! Since `ApiTestEngine` takes full reuse of [`Requests`][requests], it inherits all powerful features of [`Requests`][requests], and we can handle HTTP request as the way we do before. +Yes! That's what we did in [`requests.request`](requests.request)! Since `HttpRunner` takes full reuse of [`Requests`][requests], it inherits all powerful features of [`Requests`][requests], and we can handle HTTP request as the way we do before. ## Run test cases @@ -152,7 +152,7 @@ Let's look back to our test set `quickstart-demo-rev-1.yml`, and we can see the In actual scenarios, each user's `device_sn` is different, so we should parameterize the request parameters, which is also called `parameterization`. In the meanwhile, the `sign` field is calculated with other header fields, thus it may change significantly if any header field changes slightly. -However, the test cases are only `YAML` documents, it is impossible to generate parameters dynamically in such text. Fortunately, we can combine `Python` scripts with `YAML/JSON` test cases in `ApiTestEngine`. +However, the test cases are only `YAML` documents, it is impossible to generate parameters dynamically in such text. Fortunately, we can combine `Python` scripts with `YAML/JSON` test cases in `HttpRunner`. To achieve this goal, we can utilize `debugtalk.py` plugin and `variables` mechanisms. @@ -228,7 +228,7 @@ In this revised test case, `variable reference` and `function invoke` mechanisms To make fields like `device_sn` can be used more than once, we bind values to variables in `variables` block. When we bind variables, we can not only bind exact value to a variable name, but also can call a function and bind the evaluated value to it. -When we want to reference a variable in the test case, we can do this with a escape character `$`. For example, `$user_agent` will not be taken as a normal string, and `ApiTestEngine` will consider it as a variable named `user_agent`, search and return its binding value. +When we want to reference a variable in the test case, we can do this with a escape character `$`. For example, `$user_agent` will not be taken as a normal string, and `HttpRunner` will consider it as a variable named `user_agent`, search and return its binding value. When we want to reference a function, we shall use another escape character `${}`. Any content in `${}` will be considered as function calling, so we should guarantee that we call functions in the right way. At the same time, variables can also be referenced as parameters of function. @@ -238,7 +238,7 @@ There is still one issue unsolved. The `device_sn` field is defined in the first API test case, thus it may be impossible to reference it in other test cases. Context separation is a well-designed mechanism, and we should obey this good practice. -To handle this case, overall `config` block is supported in `ApiTestEngine`. If we define variables or import functions in `config` block, these variables and functions will become global and can be referenced in the whole test set. +To handle this case, overall `config` block is supported in `HttpRunner`. If we define variables or import functions in `config` block, these variables and functions will become global and can be referenced in the whole test set. ```yaml # examples/quickstart-demo-rev-3.yml @@ -311,7 +311,7 @@ OK Generating HTML reports... Template is not specified, load default template instead. -Reports generated: /Users/Leo/MyProjects/ApiTestEngine/reports/quickstart-demo-rev-0/2017-08-01-16-51-51.html +Reports generated: /Users/Leo/MyProjects/HttpRunner/reports/quickstart-demo-rev-0/2017-08-01-16-51-51.html ``` Great! The test case runs successfully and generates a `HTML` test report. diff --git a/setup.py b/setup.py index 1339bae5..fcb49740 100644 --- a/setup.py +++ b/setup.py @@ -8,13 +8,13 @@ with open(os.path.join(os.path.dirname(__file__), 'ate', '__init__.py')) as f: version = re.compile(r"__version__\s+=\s+'(.*)'", re.I).match(f.read()).group(1) setup( - name='ApiTestEngine', + name='HttpRunner', version=version, - description='API test engine.', - long_description="Best practice of API test, including automation test and performance test.", + description='HTTP test runner, not just about api test and load test.', + long_description="HTTP test runner, not just about api test and load test.", author='Leo Lee', author_email='mail@debugtalk.com', - url='https://github.com/debugtalk/ApiTestEngine', + url='https://github.com/debugtalk/HttpRunner', license='MIT', packages=find_packages(exclude=['test.*', 'test']), package_data={