Skip to content

Commit

Permalink
fix:修复试用反馈问题
Browse files Browse the repository at this point in the history
1.path路径中的变量没有 $ 符号,没有变量化
2.method 更改为 纯大写 字母才可以生效,比如 get 需要更改为 GET
  • Loading branch information
Pactortester committed Jul 22, 2020
1 parent 6a843ad commit 25726d4
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 14 deletions.
10 changes: 5 additions & 5 deletions build/lib/swaggerjmx/to_jmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def jmeter_test_plan(root_xml):
JmeterTestPlan = root_xml
JmeterTestPlan.set('version', '1.2')
JmeterTestPlan.set('properties', '2.3')
JmeterTestPlan.set('properties', '5.0')
JmeterTestPlan.set('jmeter', '5.1.1 r1855137')
return etree.SubElement(JmeterTestPlan, 'hashTree')

Expand Down Expand Up @@ -95,7 +95,7 @@ def controller(parent_xml, result):
HTTPSamplerProxy = etree.SubElement(shashTree, "HTTPSamplerProxy")
common_api(HTTPSamplerProxy,
{"guiclass": "HttpTestSampleGui", "testclass": "HTTPSamplerProxy",
"testname": sample.get('path'),
"testname": str(sample.get('path')).replace('//', '/'),
"enabled": "true"})
if sample.get("params").__len__() < 1:
elementProp = etree.SubElement(HTTPSamplerProxy, "elementProp")
Expand Down Expand Up @@ -143,17 +143,17 @@ def controller(parent_xml, result):
# encoding
stringProp = etree.SubElement(HTTPSamplerProxy, "stringProp")
stringProp.set("name", "HTTPSampler.contentEncoding")
stringProp.text = "utf8"
stringProp.text = "UTF-8"

# path
stringProp = etree.SubElement(HTTPSamplerProxy, "stringProp")
stringProp.set("name", "HTTPSampler.path")
stringProp.text = sample.get("path")
stringProp.text = str(sample.get("path")).replace('//', '/').replace('/{', '/${')

# method
stringProp = etree.SubElement(HTTPSamplerProxy, "stringProp")
stringProp.set("name", "HTTPSampler.method")
stringProp.text = sample.get("method")
stringProp.text = sample.get("method").upper()

# follow redirects
boolProp = etree.SubElement(HTTPSamplerProxy, "boolProp")
Expand Down
2 changes: 1 addition & 1 deletion build/lib/swaggerjmx/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__version__ = "1.0.5"
__version__ = "1.0.6"

import os
import sys
Expand Down
Binary file removed dist/swaggerjmx-1.0.5-py3-none-any.whl
Binary file not shown.
Binary file removed dist/swaggerjmx-1.0.5.tar.gz
Binary file not shown.
Binary file added dist/swaggerjmx-1.0.6-py3-none-any.whl
Binary file not shown.
Binary file added dist/swaggerjmx-1.0.6.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="swaggerjmx",
version="1.0.5",
version="1.0.6",
keywords=["pip", "swagger", "jmx", "swagger convert jmx"],
description="swagger convert jmx",
long_description=long_description,
Expand Down
2 changes: 1 addition & 1 deletion swaggerjmx.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: swaggerjmx
Version: 1.0.5
Version: 1.0.6
Summary: swagger convert jmx
Home-page: https://github.com/Pactortester/swaggerjmx
Author: lijiawei
Expand Down
10 changes: 5 additions & 5 deletions swaggerjmx/to_jmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def jmeter_test_plan(root_xml):
JmeterTestPlan = root_xml
JmeterTestPlan.set('version', '1.2')
JmeterTestPlan.set('properties', '2.3')
JmeterTestPlan.set('properties', '5.0')
JmeterTestPlan.set('jmeter', '5.1.1 r1855137')
return etree.SubElement(JmeterTestPlan, 'hashTree')

Expand Down Expand Up @@ -95,7 +95,7 @@ def controller(parent_xml, result):
HTTPSamplerProxy = etree.SubElement(shashTree, "HTTPSamplerProxy")
common_api(HTTPSamplerProxy,
{"guiclass": "HttpTestSampleGui", "testclass": "HTTPSamplerProxy",
"testname": sample.get('path'),
"testname": str(sample.get('path')).replace('//', '/'),
"enabled": "true"})
if sample.get("params").__len__() < 1:
elementProp = etree.SubElement(HTTPSamplerProxy, "elementProp")
Expand Down Expand Up @@ -143,17 +143,17 @@ def controller(parent_xml, result):
# encoding
stringProp = etree.SubElement(HTTPSamplerProxy, "stringProp")
stringProp.set("name", "HTTPSampler.contentEncoding")
stringProp.text = "utf8"
stringProp.text = "UTF-8"

# path
stringProp = etree.SubElement(HTTPSamplerProxy, "stringProp")
stringProp.set("name", "HTTPSampler.path")
stringProp.text = sample.get("path")
stringProp.text = str(sample.get("path")).replace('//', '/').replace('/{', '/${')

# method
stringProp = etree.SubElement(HTTPSamplerProxy, "stringProp")
stringProp.set("name", "HTTPSampler.method")
stringProp.text = sample.get("method")
stringProp.text = sample.get("method").upper()

# follow redirects
boolProp = etree.SubElement(HTTPSamplerProxy, "boolProp")
Expand Down
2 changes: 1 addition & 1 deletion swaggerjmx/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__version__ = "1.0.5"
__version__ = "1.0.6"

import os
import sys
Expand Down
2 changes: 2 additions & 0 deletions tests/test_swagger_jmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@

path = os.path.join(os.getcwd(), 'test.json')
ST.swagger_url_json_path = '/home/travis/build/Pactortester/swaggerjmx/tests/test.json'
# ST.swagger_url_json_path = 'test.json'
# ST.swagger_url = 'http://00000:6003/v2/api-docs'
ST.report_path = 'jmx'
conversion()

0 comments on commit 25726d4

Please sign in to comment.