惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
F
Fortinet All Blogs
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
爱范儿
爱范儿
博客园_首页
S
Security @ Cisco Blogs
H
Heimdal Security Blog
Cyberwarzone
Cyberwarzone
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
T
Threatpost
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
S
Security Affairs
AWS News Blog
AWS News Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cisco Talos Blog
Cisco Talos Blog
博客园 - 聂微东
P
Privacy & Cybersecurity Law Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
NISL@THU
NISL@THU
G
GRAHAM CLULEY
人人都是产品经理
人人都是产品经理
L
LangChain Blog
The Register - Security
The Register - Security
L
LINUX DO - 最新话题
博客园 - 【当耐特】
P
Proofpoint News Feed
Schneier on Security
Schneier on Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
IT之家
IT之家
云风的 BLOG
云风的 BLOG
量子位
D
Darknet – Hacking Tools, Hacker News & Cyber Security
PCI Perspectives
PCI Perspectives
腾讯CDC
大猫的无限游戏
大猫的无限游戏
美团技术团队
N
News | PayPal Newsroom
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Docker
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Cloudbric
Cloudbric

博客园 - 朕也就是个普通人

毕业快11年了,我仍是程序猿 平凡的生活~ 反思亲子相处~ cxf RESTful service client Python + sqlalchemy + Pandas + Mysql 实现自动创建表,插入数据 加油 重新学习python爬虫 python 网址 《高兴》 贾平凹 摘抄 funny python ML 算法 tensorflow 机器学习(Machine Learning) Eureka 注册中心 和 Config中心 配置 最近的日子-2019/8/12 工作上的态度 保持运动 对心情很重要 读《Linux命令行与shell脚本编程大全.第3版》 我的老妈挺可爱 看看书
cucumber
朕也就是个普通人 · 2020-01-15 · via 博客园 - 朕也就是个普通人

最近老大需要一个cucumber的测试项目,为不熟悉代码可以写测试用例的同事使用。所以被迫接触学习了一段时间。

cucumber 用Given When Then 关键字写feature,所以用cucumber的时候,需要先设计好feature的逻辑结构:eg

 call api可以用 rest-assured jar来实现,支持jsonpath(rest-assured自带的jsonpath,也可以用

<!--<dependency>-->
<!--<groupId>com.jayway.jsonpath</groupId>-->
<!--<artifactId>json-path</artifactId>-->
<!--<version>2.4.0</version>-->
<!--</dependency>-->

)。并且cucumber内嵌Gson, 也支持多线程fyi。但是对于很复杂的json结构,写起来比较麻烦,很难实现。所以我在项目中具体实现的时候,是将json转为对象去处理,灵活度不够,但是处理起来简单省事。

在项目中遇到几个典型的问题,分享记录一下:

1 json转对象时,date转化出错

解决办法1 将对象中的date类型的属性转为String

         2 去掉json中的date数据

String json1 = str.replaceAll(".*\"([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\",","\n");
String json2 = json1.replaceAll(",\n.*\"([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\"","\n");
String json3 = json2.replaceAll(".*\"([0-9]{4})-([0-9]{2})-([0-9]{2})\",","\n");
String json = json3.replaceAll(",\n.*\"([0-9]{4})-([0-9]{2})-([0-9]{2})\"","\n");
在处理时,需注意json中的逗号问题,比如在处理
"date1": "2015-05-05T00:00:00",

"date2": "2015-05-05T00:00:00"
时,第一个是尾部有逗号需要去掉,第二个是尾部没有逗号,但是需要去掉前面的逗号。

2 java.lang.SecurityException: Invalid signature file digest for Manifest main exception when run jar package;

解决办法:

 3 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path exception when call api.

解决办法:

 暂时就这么多