ae86sen / aomaker Goto Github PK
View Code? Open in Web Editor NEW基于pytest的接口自动化测试框架
Home Page: https://aomaker.github.io/
基于pytest的接口自动化测试框架
Home Page: https://aomaker.github.io/
1.用例执行前先去调用了login的方法,这个方法里包含login接口请求;
2.然而请求时会调用cache.get("headers")
,但此时还没有去执行用例导致获取到的为空
3.然而在登录接口中我传递了headers,导致会走到venv/Lib/site-packages/aomaker/base/base_api.py里的183-186行:
if new_headers:
headers = self._headers
headers.update(new_headers)
payload["headers"] = new_headers
4.由于self._headers为None,就会报错:AttributeError: 'NoneType' object has no attribute 'update'
5.所以,我建议在base_api.py的163行获取headers时,给一个默认值:{} 如:self._headers = self.cache.get('headers') if self.cache.get('headers') is not None else {}
从而规避这个问题。
hi,有几个比较疑惑,请教一下
想了解下在这个框架下是怎么处理的
class Instance(BaseApi):
def get_instances(self, testdata, testdata1=None?):
http_data = {
"owner": self.owner,
"action": "DescribeInstances",
"reverse": 1,
"其他参数": testdata / testdata1
"status": ["pending", "running", "stopped", testdata],
}
resp = self.send_http(http_data)
return resp
在214行:从'url': self._host + api_path,
改为 'url': api_path if api_path.startswith("http") else self._host + api_path,
在./aomaker/cache.py155行,get_by_jsonpath方法需要增加expr_index为None时,返回list数字
获取响应结果中list参数时,会引发异常
jsonpath表达式:$..id
响应结果:
{ "code": 0, "msg": "操作成功", "data": [ { "create_user": 6, "body": null, "update_user": 6, "body_type": 0, "name": "用例163625", "directory_id": 332, "id": 281, "request_type": 1, "tag": null, "created_at": "2023-12-04 16:36:25", "url": "https://www.baidu.com", "status": 3, "updated_at": "2023-12-04 16:36:25", "request_method": "GET", "priority": "P0", "deleted_at": 0, "request_headers": "{}", "case_type": 0, "base_path": null }, { "create_user": 6, "body": null, "update_user": 6, "body_type": 0, "name": "用例164214", "directory_id": 332, "id": 282, "request_type": 1, "tag": null, "created_at": "2023-12-04 16:42:14", "url": "https://www.baidu.com", "status": 3, "updated_at": "2023-12-04 16:42:14", "request_method": "GET", "priority": "P0", "deleted_at": 0, "request_headers": "{}", "case_type": 0, "base_path": null } ] }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.