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

推荐订阅源

月光博客
月光博客
Martin Fowler
Martin Fowler
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
O
OpenAI News
云风的 BLOG
云风的 BLOG
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LangChain Blog
V
Vulnerabilities – Threatpost
P
Privacy & Cybersecurity Law Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
博客园 - 三生石上(FineUI控件)
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News | PayPal Newsroom
The Register - Security
The Register - Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cisco Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
S
Security Affairs
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
T
Tor Project blog
大猫的无限游戏
大猫的无限游戏
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 【当耐特】
V
V2EX
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 最新话题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
小众软件
小众软件
PCI Perspectives
PCI Perspectives

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

毕业快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.

解决办法:

 暂时就这么多