如何使用Karate框架动态创建在URL之间具有路径的URL [英] How to dynamically create URL having path in between URL using Karate framework

查看:45
本文介绍了如何使用Karate框架动态创建在URL之间具有路径的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用空手道框架创建动态网址.假设我要创建的URL是:

  https://www.mars.com/mars/profile/{profileID}/line 

在上面的URL中, {profileID} 是路径.

目前,我已经在下面的功能文件中编写了该文件,该文件能够创建url,但是由于使用path关键字,它会对该url进行编码,并在配置文件ID后添加%0A .

  https://www.mars.com/mars/profile/264%0A/line 

功能文件:

  @smoke方案:在现有配置文件中创建线分数和def urlname = marsuri +'/mars/profile/'给定网址urlname给定路径ID +'/行' 

请让我知道如何创建一个URL,并且该URL之间的路径不进行编码.

解决方案

您没有正确使用 path 语法.请阅读文档: https://github.com/intuit/karate#path

进行此更改:

 给出路径ID,行" 

也请参见以下答案: https://stackoverflow.com/a/54477346/143475

I want to create a dynamic url using karate framework. lets assume URL I want to create is :

https://www.mars.com/mars/profile/{profileID}/line

In above URL {profileID} is path.

Currently I have written below feature file which is able to create the url however due using path keyword it encodes the url and add %0A after profile id.

https://www.mars.com/mars/profile/264%0A/line

Feature File:

@smoke
Scenario: Create  a line score in existing  profile
And def urlname = marsuri+ '/mars/profile/'

Given url urlname
Given path id + '/line'

Please let me know how can I create a URL with path in between URL without encoding it.

解决方案

You are not using the path syntax correctly. Please read the documentation: https://github.com/intuit/karate#path

Make this change:

Given path id, 'line'

EDIT: please also see this answer: https://stackoverflow.com/a/54477346/143475

这篇关于如何使用Karate框架动态创建在URL之间具有路径的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆