hyb
2025-05-26 78ef0f8705a48464a0a39b9d1e5ec4f018045f1f
新增江南考试压测脚本模版
新增批量获取token脚本
14 files added
827 ■■■■■ changed files
测试组/脚本/江南-新增200个用户.jmx 246 ●●●●● patch | view | raw | blame | history
测试组/脚本/江南考试.jmx 417 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/.idea/.gitignore 8 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/.idea/WuXi.iml 10 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/.idea/inspectionProfiles/profiles_settings.xml 6 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/.idea/misc.xml 4 ●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/.idea/modules.xml 8 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/TestData/userinfo.xlsx patch | view | raw | blame | history
测试组/脚本/登录获取token/__pycache__/conftest.cpython-311.pyc patch | view | raw | blame | history
测试组/脚本/登录获取token/__pycache__/conftest.cpython-312.pyc patch | view | raw | blame | history
测试组/脚本/登录获取token/__pycache__/解密.cpython-311.pyc patch | view | raw | blame | history
测试组/脚本/登录获取token/conftest.py 60 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/获取用户token.py 43 ●●●●● patch | view | raw | blame | history
测试组/脚本/登录获取token/解密.py 25 ●●●●● patch | view | raw | blame | history
测试组/脚本/江南-新增200个用户.jmx
New file
@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.2">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.tearDown_on_shutdown">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="线程组" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true">
          <stringProp name="LoopController.loops">1</stringProp>
          <boolProp name="LoopController.continue_forever">false</boolProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">200</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.delayedStart">false</boolProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
      </ThreadGroup>
      <hashTree>
        <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP信息头管理器" enabled="true">
          <collectionProp name="HeaderManager.headers">
            <elementProp name="Host" elementType="Header">
              <stringProp name="Header.name">Host</stringProp>
              <stringProp name="Header.value">192.168.7.127:3001</stringProp>
            </elementProp>
            <elementProp name="Connection" elementType="Header">
              <stringProp name="Header.name">Connection</stringProp>
              <stringProp name="Header.value">keep-alive</stringProp>
            </elementProp>
            <elementProp name="Content-Length" elementType="Header">
              <stringProp name="Header.name">Content-Length</stringProp>
              <stringProp name="Header.value">1239</stringProp>
            </elementProp>
            <elementProp name="arrayFormat" elementType="Header">
              <stringProp name="Header.name">arrayFormat</stringProp>
              <stringProp name="Header.value">repeat</stringProp>
            </elementProp>
            <elementProp name="User-Agent" elementType="Header">
              <stringProp name="Header.name">User-Agent</stringProp>
              <stringProp name="Header.value">Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.97 Safari/537.36 Core/1.116.489.400 QQBrowser/13.7.6350.400</stringProp>
            </elementProp>
            <elementProp name="token" elementType="Header">
              <stringProp name="Header.name">token</stringProp>
              <stringProp name="Header.value">eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDgxMzgwMTIsInVzZXJuYW1lIjoiYWRtaW4ifQ.mt6RbaNsIlH7tlxjFVwpHN1VSFgpVxTCKZqJL0_j2GY</stringProp>
            </elementProp>
            <elementProp name="Content-Type" elementType="Header">
              <stringProp name="Header.name">Content-Type</stringProp>
              <stringProp name="Header.value">application/json; charset=UTF-8</stringProp>
            </elementProp>
            <elementProp name="Accept" elementType="Header">
              <stringProp name="Header.name">Accept</stringProp>
              <stringProp name="Header.value">*/*</stringProp>
            </elementProp>
            <elementProp name="Origin" elementType="Header">
              <stringProp name="Header.name">Origin</stringProp>
              <stringProp name="Header.value">http://jiangnan.baoyizn.com:9932</stringProp>
            </elementProp>
            <elementProp name="Referer" elementType="Header">
              <stringProp name="Header.name">Referer</stringProp>
              <stringProp name="Header.value">http://jiangnan.baoyizn.com:9932/</stringProp>
            </elementProp>
            <elementProp name="Accept-Encoding" elementType="Header">
              <stringProp name="Header.name">Accept-Encoding</stringProp>
              <stringProp name="Header.value">gzip, deflate</stringProp>
            </elementProp>
            <elementProp name="Accept-Language" elementType="Header">
              <stringProp name="Header.name">Accept-Language</stringProp>
              <stringProp name="Header.value">zh-CN,zh;q=0.9</stringProp>
            </elementProp>
            <elementProp name="Cookie" elementType="Header">
              <stringProp name="Header.name">Cookie</stringProp>
              <stringProp name="Header.value">token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDgxMzgwMTIsInVzZXJuYW1lIjoiYWRtaW4ifQ.mt6RbaNsIlH7tlxjFVwpHN1VSFgpVxTCKZqJL0_j2GY</stringProp>
            </elementProp>
          </collectionProp>
        </HeaderManager>
        <hashTree/>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="江南-新增200个用户" enabled="false">
          <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
            <collectionProp name="Arguments.arguments">
              <elementProp name="" elementType="HTTPArgument">
                <boolProp name="HTTPArgument.always_encode">false</boolProp>
                <stringProp name="Argument.value">{&#xd;
    &quot;id&quot;: &quot;&quot;, &#xd;
    &quot;studentGroup&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;newLeaderGroupName&quot;: &quot;&quot;, &#xd;
    &quot;leaderGroup&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;officeDTO&quot;: {&#xd;
        &quot;id&quot;: &quot;1681208272093286402&quot;, &#xd;
        &quot;name&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;currentRole&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;researchGroup&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;isAdmin&quot;: false, &#xd;
    &quot;researchGroupIdList&quot;: [ ], &#xd;
    &quot;roleIdList&quot;: [ ], &#xd;
    &quot;postIdList&quot;: [ ], &#xd;
    &quot;loginName&quot;: &quot;0522xs${num}&quot;, &#xd;
    &quot;no&quot;: &quot;&quot;, &#xd;
    &quot;userCardNo&quot;: &quot;&quot;, &#xd;
    &quot;qualificationCode&quot;: &quot;&quot;, &#xd;
    &quot;cardId&quot;: &quot;&quot;, &#xd;
    &quot;name&quot;: &quot;0522xs${num}&quot;, &#xd;
    &quot;sex&quot;: &quot;1&quot;, &#xd;
    &quot;email&quot;: &quot;0522xs${num}@qq.com&quot;, &#xd;
    &quot;phone&quot;: &quot;&quot;, &#xd;
    &quot;mobile&quot;: &quot;10000000000&quot;, &#xd;
    &quot;loginFlag&quot;: &quot;1&quot;, &#xd;
    &quot;photo&quot;: &quot;&quot;, &#xd;
    &quot;qrCode&quot;: &quot;&quot;, &#xd;
    &quot;oldLoginName&quot;: &quot;&quot;, &#xd;
    &quot;newPassword&quot;: &quot;fZbWOQuTT/HW6JOLQOz44w==&quot;, &#xd;
    &quot;confirmNewPassword&quot;: &quot;fZbWOQuTT/HW6JOLQOz44w==&quot;, &#xd;
    &quot;sign&quot;: &quot;&quot;, &#xd;
    &quot;timeDate&quot;: [ ], &#xd;
    &quot;startDate&quot;: &quot;&quot;, &#xd;
    &quot;endDate&quot;: &quot;&quot;, &#xd;
    &quot;remarks&quot;: &quot;&quot;, &#xd;
    &quot;status&quot;: &quot;&quot;, &#xd;
    &quot;userType&quot;: &quot;&quot;, &#xd;
    &quot;certificateNo&quot;: &quot;&quot;, &#xd;
    &quot;businessUserRoleDepList&quot;: [ ], &#xd;
    &quot;businessRole&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;businessDep&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;currentRoleGroup&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;newGroup&quot;: &quot;0&quot;, &#xd;
    &quot;officeRoom&quot;: &quot;&quot;, &#xd;
    &quot;professional&quot;: &quot;&quot;, &#xd;
    &quot;otherOfficeName&quot;: &quot;&quot;, &#xd;
    &quot;officeScopeType&quot;: &quot;0&quot;, &#xd;
    &quot;roleList&quot;: [&#xd;
        {&#xd;
            &quot;keyValue&quot;: &quot;NRb3_6vkGUNd6TKkFK1z2&quot;, &#xd;
            &quot;id&quot;: &quot;1418249891355848705&quot;, &#xd;
            &quot;enName&quot;: &quot;student&quot;, &#xd;
            &quot;researchGroups&quot;: {&#xd;
                &quot;id&quot;: &quot;&quot;&#xd;
            }, &#xd;
            &quot;delFlag&quot;: &quot;0&quot;&#xd;
        }&#xd;
    ], &#xd;
    &quot;platform&quot;: {&#xd;
        &quot;id&quot;: &quot;&quot;&#xd;
    }, &#xd;
    &quot;userCategory&quot;: &quot;&quot;, &#xd;
    &quot;certificateFileUrl&quot;: &quot;&quot;, &#xd;
    &quot;certificateStartTime&quot;: &quot;&quot;, &#xd;
    &quot;certificateEndTime&quot;: &quot;&quot;, &#xd;
    &quot;mentor&quot;: &quot;0522da&quot;, &#xd;
    &quot;mentorMobile&quot;: &quot;12340000000&quot;, &#xd;
    &quot;mentorEmail&quot;: &quot;0522da@qq.com&quot;, &#xd;
    &quot;oldLoinName&quot;: &quot;&quot;&#xd;
}</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain">192.168.7.127</stringProp>
          <stringProp name="HTTPSampler.port">3001</stringProp>
          <stringProp name="HTTPSampler.protocol">http</stringProp>
          <stringProp name="HTTPSampler.path">/api/sys/user/save</stringProp>
          <stringProp name="HTTPSampler.method">POST</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp>
          <boolProp name="HTTPSampler.image_parser">false</boolProp>
          <boolProp name="HTTPSampler.concurrentDwn">false</boolProp>
          <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
          <boolProp name="HTTPSampler.md5">false</boolProp>
          <intProp name="HTTPSampler.ipSourceType">0</intProp>
        </HTTPSamplerProxy>
        <hashTree/>
        <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="计数器" enabled="true">
          <stringProp name="CounterConfig.start">1</stringProp>
          <stringProp name="CounterConfig.end">200</stringProp>
          <stringProp name="CounterConfig.incr">1</stringProp>
          <stringProp name="CounterConfig.name">num</stringProp>
          <stringProp name="CounterConfig.format">0</stringProp>
          <boolProp name="CounterConfig.per_user">false</boolProp>
        </CounterConfig>
        <hashTree/>
        <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="查看结果树" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>true</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
              <sentBytes>true</sentBytes>
              <url>true</url>
              <threadCounts>true</threadCounts>
              <idleTime>true</idleTime>
              <connectTime>true</connectTime>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
        </ResultCollector>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>
测试组/脚本/江南考试.jmx
New file
@@ -0,0 +1,417 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.2">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="测试计划" enabled="true">
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="token" elementType="Argument">
            <stringProp name="Argument.name">token</stringProp>
            <stringProp name="Argument.value">eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDgwNTUwODAsInVzZXJuYW1lIjoiYWRtaW4ifQ._IoIb4HXLaPceShNGKnSfuJ4w7xq7IWVfKBQ0EjpoJw</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
        </collectionProp>
      </elementProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <boolProp name="TestPlan.tearDown_on_shutdown">false</boolProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="200个用户同时考试" enabled="true">
        <stringProp name="ThreadGroup.num_threads">200</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true">
          <stringProp name="LoopController.loops">1</stringProp>
          <boolProp name="LoopController.continue_forever">false</boolProp>
        </elementProp>
        <boolProp name="ThreadGroup.delayedStart">false</boolProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="识别二维码获取试卷id" enabled="true">
          <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
            <collectionProp name="Arguments.arguments">
              <elementProp name="" elementType="HTTPArgument">
                <boolProp name="HTTPArgument.always_encode">false</boolProp>
                <stringProp name="Argument.value">{&quot;paperId&quot;: &quot;1925520684889407488&quot;}</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain">192.168.7.127</stringProp>
          <stringProp name="HTTPSampler.port">8083</stringProp>
          <stringProp name="HTTPSampler.protocol">http</stringProp>
          <stringProp name="HTTPSampler.path">/exam/paper/tExamPaper/buildExam</stringProp>
          <stringProp name="HTTPSampler.method">POST</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp>
          <boolProp name="HTTPSampler.image_parser">false</boolProp>
          <boolProp name="HTTPSampler.concurrentDwn">false</boolProp>
          <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
          <boolProp name="HTTPSampler.md5">false</boolProp>
          <intProp name="HTTPSampler.ipSourceType">0</intProp>
        </HTTPSamplerProxy>
        <hashTree>
          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP信息头管理器" enabled="true">
            <collectionProp name="HeaderManager.headers">
              <elementProp name="Host" elementType="Header">
                <stringProp name="Header.name">Host</stringProp>
                <stringProp name="Header.value">192.168.7.127:8083</stringProp>
              </elementProp>
              <elementProp name="User-Agent" elementType="Header">
                <stringProp name="Header.name">User-Agent</stringProp>
                <stringProp name="Header.value">Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36</stringProp>
              </elementProp>
              <elementProp name="token" elementType="Header">
                <stringProp name="Header.name">token</stringProp>
                <stringProp name="Header.value">${__CSVRead(C:\Users\cc\Desktop\userinfo.txt,0)}</stringProp>
              </elementProp>
              <elementProp name="Accept" elementType="Header">
                <stringProp name="Header.name">Accept</stringProp>
                <stringProp name="Header.value">*/*</stringProp>
              </elementProp>
              <elementProp name="Referer" elementType="Header">
                <stringProp name="Header.name">Referer</stringProp>
                <stringProp name="Header.value">http://192.168.7.127:8083/</stringProp>
              </elementProp>
              <elementProp name="Accept-Language" elementType="Header">
                <stringProp name="Header.name">Accept-Language</stringProp>
                <stringProp name="Header.value">zh-CN,zh;q=0.9</stringProp>
              </elementProp>
              <elementProp name="Cookie" elementType="Header">
                <stringProp name="Header.name">Cookie</stringProp>
                <stringProp name="Header.value">token=${__CSVRead(C:\Users\cc\Desktop\userinfo.txt,0)}; thisSystem=1; JSESSIONID=8F333DFB725DDDC2ED2860157F9329AC</stringProp>
              </elementProp>
              <elementProp name="Connection" elementType="Header">
                <stringProp name="Header.name">Connection</stringProp>
                <stringProp name="Header.value">close</stringProp>
              </elementProp>
              <elementProp name="" elementType="Header">
                <stringProp name="Header.name">Content-Type</stringProp>
                <stringProp name="Header.value">application/json; charset=UTF-8</stringProp>
              </elementProp>
            </collectionProp>
          </HeaderManager>
          <hashTree/>
          <JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="JSON提取器" enabled="true">
            <stringProp name="JSONPostProcessor.referenceNames">id</stringProp>
            <stringProp name="JSONPostProcessor.jsonPathExprs">$.id</stringProp>
            <stringProp name="JSONPostProcessor.match_numbers">1</stringProp>
          </JSONPostProcessor>
          <hashTree/>
        </hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="获取题目" enabled="true">
          <boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
            <collectionProp name="Arguments.arguments"/>
          </elementProp>
          <stringProp name="HTTPSampler.domain">192.168.7.127</stringProp>
          <stringProp name="HTTPSampler.port">3001</stringProp>
          <stringProp name="HTTPSampler.protocol">http</stringProp>
          <stringProp name="HTTPSampler.path">/api/exam/paper/tExamPaper/select/${id}</stringProp>
          <stringProp name="HTTPSampler.method">POST</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp>
          <boolProp name="HTTPSampler.image_parser">false</boolProp>
          <boolProp name="HTTPSampler.concurrentDwn">false</boolProp>
          <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
          <boolProp name="HTTPSampler.md5">false</boolProp>
          <intProp name="HTTPSampler.ipSourceType">0</intProp>
        </HTTPSamplerProxy>
        <hashTree>
          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP信息头管理器" enabled="true">
            <collectionProp name="HeaderManager.headers">
              <elementProp name="Accept" elementType="Header">
                <stringProp name="Header.name">Accept</stringProp>
                <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7</stringProp>
              </elementProp>
              <elementProp name="Accept-Encoding" elementType="Header">
                <stringProp name="Header.name">Accept-Encoding</stringProp>
                <stringProp name="Header.value">gzip, deflate</stringProp>
              </elementProp>
              <elementProp name="Accept-Language" elementType="Header">
                <stringProp name="Header.name">Accept-Language</stringProp>
                <stringProp name="Header.value">zh-CN,zh;q=0.9</stringProp>
              </elementProp>
              <elementProp name="Cache-Control" elementType="Header">
                <stringProp name="Header.name">Cache-Control</stringProp>
                <stringProp name="Header.value">max-age=0</stringProp>
              </elementProp>
              <elementProp name="Connection" elementType="Header">
                <stringProp name="Header.name">Connection</stringProp>
                <stringProp name="Header.value">keep-alive</stringProp>
              </elementProp>
              <elementProp name="Cookie" elementType="Header">
                <stringProp name="Header.name">Cookie</stringProp>
                <stringProp name="Header.value">token=${__CSVRead(C:\Users\cc\Desktop\userinfo.txt,0)}; thisSystem=1; JSESSIONID=8F333DFB725DDDC2ED2860157F9329AC</stringProp>
              </elementProp>
              <elementProp name="Host" elementType="Header">
                <stringProp name="Header.name">Host</stringProp>
                <stringProp name="Header.value">192.168.7.127:3001</stringProp>
              </elementProp>
              <elementProp name="If-None-Match" elementType="Header">
                <stringProp name="Header.name">If-None-Match</stringProp>
                <stringProp name="Header.value">W/&quot;20ec-jb9sJPs1o+izrwK+EHa6OGCHHRk&quot;</stringProp>
              </elementProp>
              <elementProp name="Upgrade-Insecure-Requests" elementType="Header">
                <stringProp name="Header.name">Upgrade-Insecure-Requests</stringProp>
                <stringProp name="Header.value">1</stringProp>
              </elementProp>
              <elementProp name="User-Agent" elementType="Header">
                <stringProp name="Header.name">User-Agent</stringProp>
                <stringProp name="Header.value">Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.97 Safari/537.36 Core/1.116.489.400 QQBrowser/13.7.6350.400</stringProp>
              </elementProp>
              <elementProp name="Content-Length" elementType="Header">
                <stringProp name="Header.name">Content-Length</stringProp>
                <stringProp name="Header.value">91</stringProp>
              </elementProp>
            </collectionProp>
          </HeaderManager>
          <hashTree/>
        </hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="提交试卷" enabled="true">
          <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
            <collectionProp name="Arguments.arguments">
              <elementProp name="" elementType="HTTPArgument">
                <boolProp name="HTTPArgument.always_encode">false</boolProp>
                <stringProp name="Argument.value">{&#xd;
    &quot;questionId&quot;: null, &#xd;
    &quot;doTime&quot;: 8, &#xd;
    &quot;answerItems&quot;: [&#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1796435908272652289&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 1&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468602554249218&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 2&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468610888331266&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 3&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468608417886210&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 4&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468608896036865&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 5&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468615850192898&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 6&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468617624383490&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 7&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468616873603073&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 8&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468619616677889&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 9&#xd;
        }, &#xd;
        {&#xd;
            &quot;questionId&quot;: &quot;1739468617418862593&quot;, &#xd;
            &quot;content&quot;: null, &#xd;
            &quot;contentArray&quot;: [ ], &#xd;
            &quot;completed&quot;: false, &#xd;
            &quot;itemOrder&quot;: 10&#xd;
        }&#xd;
    ], &#xd;
    &quot;id&quot;: &quot;${id}&quot;&#xd;
}</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain">192.168.7.127</stringProp>
          <stringProp name="HTTPSampler.port">3001</stringProp>
          <stringProp name="HTTPSampler.protocol">http</stringProp>
          <stringProp name="HTTPSampler.path">/api/train/exam/jnExaminationApply/answerSubmit</stringProp>
          <stringProp name="HTTPSampler.method">POST</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp>
          <boolProp name="HTTPSampler.image_parser">false</boolProp>
          <boolProp name="HTTPSampler.concurrentDwn">false</boolProp>
          <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
          <boolProp name="HTTPSampler.md5">false</boolProp>
          <intProp name="HTTPSampler.ipSourceType">0</intProp>
        </HTTPSamplerProxy>
        <hashTree>
          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP信息头管理器" enabled="true">
            <collectionProp name="HeaderManager.headers">
              <elementProp name="Accept" elementType="Header">
                <stringProp name="Header.name">Accept</stringProp>
                <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7</stringProp>
              </elementProp>
              <elementProp name="Accept-Encoding" elementType="Header">
                <stringProp name="Header.name">Accept-Encoding</stringProp>
                <stringProp name="Header.value">gzip, deflate</stringProp>
              </elementProp>
              <elementProp name="Accept-Language" elementType="Header">
                <stringProp name="Header.name">Accept-Language</stringProp>
                <stringProp name="Header.value">zh-CN,zh;q=0.9</stringProp>
              </elementProp>
              <elementProp name="Cache-Control" elementType="Header">
                <stringProp name="Header.name">Cache-Control</stringProp>
                <stringProp name="Header.value">max-age=0</stringProp>
              </elementProp>
              <elementProp name="Connection" elementType="Header">
                <stringProp name="Header.name">Connection</stringProp>
                <stringProp name="Header.value">keep-alive</stringProp>
              </elementProp>
              <elementProp name="Cookie" elementType="Header">
                <stringProp name="Header.name">Cookie</stringProp>
                <stringProp name="Header.value">token=${__CSVRead(C:\Users\cc\Desktop\userinfo.txt,0)}; thisSystem=1; JSESSIONID=8F333DFB725DDDC2ED2860157F9329AC</stringProp>
              </elementProp>
              <elementProp name="Host" elementType="Header">
                <stringProp name="Header.name">Host</stringProp>
                <stringProp name="Header.value">192.168.7.127:3001</stringProp>
              </elementProp>
              <elementProp name="If-None-Match" elementType="Header">
                <stringProp name="Header.name">If-None-Match</stringProp>
                <stringProp name="Header.value">W/&quot;20ec-jb9sJPs1o+izrwK+EHa6OGCHHRk&quot;</stringProp>
              </elementProp>
              <elementProp name="Upgrade-Insecure-Requests" elementType="Header">
                <stringProp name="Header.name">Upgrade-Insecure-Requests</stringProp>
                <stringProp name="Header.value">1</stringProp>
              </elementProp>
              <elementProp name="User-Agent" elementType="Header">
                <stringProp name="Header.name">User-Agent</stringProp>
                <stringProp name="Header.value">Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.97 Safari/537.36 Core/1.116.489.400 QQBrowser/13.7.6350.400</stringProp>
              </elementProp>
              <elementProp name="Content-Length" elementType="Header">
                <stringProp name="Header.name">Content-Length</stringProp>
                <stringProp name="Header.value">91</stringProp>
              </elementProp>
              <elementProp name="" elementType="Header">
                <stringProp name="Header.name">Content-Type</stringProp>
                <stringProp name="Header.value">application/json; charset=UTF-8</stringProp>
              </elementProp>
            </collectionProp>
          </HeaderManager>
          <hashTree/>
        </hashTree>
        <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="查看结果树" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>true</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
              <sentBytes>true</sentBytes>
              <url>true</url>
              <threadCounts>true</threadCounts>
              <idleTime>true</idleTime>
              <connectTime>true</connectTime>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
        </ResultCollector>
        <hashTree/>
        <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="聚合报告" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>true</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
              <sentBytes>true</sentBytes>
              <url>true</url>
              <threadCounts>true</threadCounts>
              <idleTime>true</idleTime>
              <connectTime>true</connectTime>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
        </ResultCollector>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>
测试组/脚本/登录获取token/.idea/.gitignore
New file
@@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
测试组/脚本/登录获取token/.idea/WuXi.iml
New file
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
  <component name="NewModuleRootManager">
    <content url="file://$MODULE_DIR$">
      <excludeFolder url="file://$MODULE_DIR$/venv" />
    </content>
    <orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
</module>
测试组/脚本/登录获取token/.idea/inspectionProfiles/profiles_settings.xml
New file
@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
  <settings>
    <option name="USE_PROJECT_PROFILE" value="false" />
    <version value="1.0" />
  </settings>
</component>
测试组/脚本/登录获取token/.idea/misc.xml
New file
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
</project>
测试组/脚本/登录获取token/.idea/modules.xml
New file
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/WuXi.iml" filepath="$PROJECT_DIR$/.idea/WuXi.iml" />
    </modules>
  </component>
</project>
测试组/脚本/登录获取token/TestData/userinfo.xlsx
Binary files differ
测试组/脚本/登录获取token/__pycache__/conftest.cpython-311.pyc
Binary files differ
测试组/脚本/登录获取token/__pycache__/conftest.cpython-312.pyc
Binary files differ
测试组/脚本/登录获取token/__pycache__/解密.cpython-311.pyc
Binary files differ
测试组/脚本/登录获取token/conftest.py
New file
@@ -0,0 +1,60 @@
import base64
from Crypto.Cipher import AES
import pandas as pd
#  明文aes加密
def triple_aes_encrypt(text):
    key = 'abcdefgh12345678'  # 16字节密钥
    iv = '12345678abcdefgh'  # 16字节初始向量
    cipher = AES.new(key.encode(), AES.MODE_CBC, iv.encode())
    pad_text = text.encode('utf-8')
    padded_text = pad_text + (16 - len(pad_text) % 16) * chr(16 - len(pad_text) % 16).encode('utf-8')
    encrypted = cipher.encrypt(padded_text)
    return base64.b64encode(encrypted).decode()
# 读取到的数据转换为字典列表
def get_list(df,Keylist):
    DataList = []
    for index, row in df.iterrows():
        DataDict = {}
        for key in Keylist:
            DataDict[key] = str(row[key])
        DataList.append(DataDict)
    return DataList
# 读取Excel文件
def read_excel(filename):
    try:
        # 读取Excel文件
        df = pd.read_excel(filename)
        return df
    except Exception as e:
        print(f"读取发生错误:{e}")
# 写入Excel文件
def write_excel(filename,raw,column,content):
    try:
        # 读取Excel文件
        df = pd.read_excel(filename)
        # 确保列为字符串类型
        df[column] = df[column].astype(str)
        # 可以按条件更新其他行,比如按索引更新
        df.at[raw, column] = content
        # 将修改后的 DataFrame 保存回 Excel 文件
        df.to_excel(filename, index=False)
        print("成功写入Excel")
    except Exception as e:
        print(f"发生错误:{e}")
if __name__ == '__main__':
    print(triple_aes_encrypt("Baoyi@1341"))
测试组/脚本/登录获取token/获取用户token.py
New file
@@ -0,0 +1,43 @@
import requests
import conftest
from 解密 import aes_encrypt
proxy = {
    'http': '127.0.0.1:8080',
    'https': '127.0.0.1:8080',
}
def get_Token():
    url = "http://192.168.7.127:8083/sys/login"
    headers = {
        "content-type":"application/json; charset=UTF-8"
    }
    # 获取用户账号密码
    df = conftest.read_excel("TestData/userinfo.xlsx")
    # 封装为字典列表
    UserList = conftest.get_list(df,["username","password"])
    # 遍历用户字典列表的索引和值
    for index, user in enumerate(UserList):
        # 账号密码加密
        username = aes_encrypt(user["username"], "abcdefgh12345678", "12345678abcdefgh")
        password = aes_encrypt(user["password"], "abcdefgh12345678", "12345678abcdefgh")
        # 构造请求体
        params = {"code": "1234","username": username, "password": password }
        try:
            response = requests.post(url=url, headers=headers, json=params, verify=False)
            if response.status_code == 200:
                data = response.json()
                token = data["token"]
                if token:
                    # Token写入Excel文件
                    conftest.write_excel("TestData/userinfo.xlsx",index,"token",token)
                else:
                    print(f"用户 {username} token为空")
            else:
                print(f"错误信息:{response.text} ")
        except Exception as e:
            print(f"用户 {username} 发生错误:{e}")
            return None
if __name__ == '__main__':
    get_Token()
测试组/脚本/登录获取token/解密.py
New file
@@ -0,0 +1,25 @@
import base64
from Crypto.Cipher import AES
def aes_encrypt(word: str, key_str: str, iv_str: str) -> str:
    # 将密钥和IV转换为UTF-8编码的字节
    key = key_str.encode('utf-8')
    iv = iv_str.encode('utf-8')
    # 将明文转换为UTF-8编码的字节
    data = word.encode('utf-8')
    # 计算ZeroPadding填充
    block_size = AES.block_size
    padded_len = (len(data) + block_size - 1) // block_size * block_size
    padding = padded_len - len(data)
    padded_data = data + bytes([0] * padding)
    # 创建AES-CBC加密器
    cipher = AES.new(key, AES.MODE_CBC, iv)
    # 执行加密
    encrypted_data = cipher.encrypt(padded_data)
    # 返回Base64编码的密文
    return base64.b64encode(encrypted_data).decode('utf-8')