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

推荐订阅源

博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
G
Google Developers Blog
B
Blog
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
The Cloudflare Blog
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
A
About on SuperTechFans
量子位
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
H
Help Net Security
Help Net Security
Help Net Security
P
Palo Alto Networks Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Troy Hunt's Blog
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
Know Your Adversary
Know Your Adversary
Apple Machine Learning Research
Apple Machine Learning Research
Scott Helme
Scott Helme
N
News | PayPal Newsroom
AWS News Blog
AWS News Blog
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
腾讯CDC
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
GbyAI
GbyAI
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
Docker

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

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

解决办法:

 暂时就这么多