首页 > 解决方案 > 无法从空手道的 csv 文件中读取“@”符号

问题描述

我正在使用一个 csv 文件,它有一个列电子邮件,它的值包含 @ 当我尝试在我的功能中读取该值时,我遇到了异常。Feature 文件和 csv 都在项目目录中的相同位置。

CSV:

用户名,密码 sample@yopmail.com,abc123 sample2@yopmail.com,abc123

我的功能如下所示:

请注意,为了使其正常工作,我已附加 @yopmail.com 但如果我的电子邮件 ID 是 @gmail.com 或 @mailinator.com 或任何其他电子邮件,则无法完成此操作。

功能:登录功能

背景

场景大纲:使用有效凭据登录

给定路径 '/oauth/token'
当 header Authorization = applicationToken
和 header Content-Type = 'application/x-www-form-urlencoded'
并且表单字段grant_type = 'password'
并且表单字段username = '<用户名>@yopmail。 com'
and form field password = '< password >'
and method post
then status 200
def accessToken = "Bearer"+response.access_token
print accessToken

标签: karateweb-api-testingfeature-file

解决方案


推荐阅读