Code Monkey home page Code Monkey logo

Comments (5)

hemantsharma-io avatar hemantsharma-io commented on July 18, 2024

@sakithy2020 can you share the template that you have created?

from mockingbird.

ganeles avatar ganeles commented on July 18, 2024

@sakithy2020 can you share the template that you have created?

i have same problem.
i use template from MockingBird.zip / templates / JMeter Load Test.tpl

from mockingbird.

hemantsharma-io avatar hemantsharma-io commented on July 18, 2024

@sakithy2020 can you share the template that you have created?

i have same problem.
i use template from MockingBird.zip / templates / JMeter Load Test.tpl

@sakithy2020 and @ganeles if you look at {{#SelectedSessions}} in the template it's a for-each loop for each of the session user has selected that is resulting in multiple threads. You can move {{#SelectedSessions}}...{{/SelectedSessions}} from current location to wrap line # 30 to 55 you should get what you are looking for. Please note that the headers are created for each request and in your case should be static, so replace below with something hardcoded.

            {{#RequestHeaders}}
              <elementProp name="" elementType="Header">
                <stringProp name="Header.name">{{Name}}</stringProp>
                <stringProp name="Header.value">{{Value}}</stringProp>
              </elementProp>
            {{/RequestHeaders}}  

from mockingbird.

Aceler8 avatar Aceler8 commented on July 18, 2024

I tried to follow your instructions by moving both SelectedSessions, but i get errors when i load into Fiddler. Log files says "cannot find Header". Can you provide an example of how to get multiple requests into 1 JMeter thread?
Here is the error log from Fiddler:
12:59:40:9114 Mocking Bird - Error generating output. Message: Could not find RequestHeaders
On object: Context , Stack: at Nustache.Core.Part.Accept(PartVisitor visitor)
at Nustache.Compilation.CompilePartVisitor.Visit(Section section)
at Nustache.Compilation.TemplateCompiler.Compile(Template template, CompileContext context)
at Nustache.Compilation.TemplateCompiler.Compile[T](Template template, TemplateLocator templateLocator)
at MockingBird.Core.CodeGenerator.GenerateOutput()
at MockingBird.UI.CodeView.TxtOutput_DragDrop(Object sender, DragEventArgs e)
Screenshot 2021-03-18 192725

from mockingbird.

hemantsharma-io avatar hemantsharma-io commented on July 18, 2024
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="3.2" jmeter="3.2 r1790748">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="MyTestPlan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">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>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
	
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="MyThreadGroup" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">100</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1558208516000</longProp>
        <longProp name="ThreadGroup.end_time">1558208516000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
      {{#SelectedSessions}}
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="My Http Request" enabled="true">
        
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
            <collectionProp name="Arguments.arguments" elementType="Arguments">
              <elementProp name="" elementType="HTTPArgument">
              <boolProp name="HTTPArgument.always_encode">false</boolProp>
              <stringProp name="Argument.value">{{RequestBodyAsHtmlEncode}}</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
              </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain">{{hostname}}</stringProp>
          <stringProp name="HTTPSampler.port">{{^isHTTPS}}{{port}}{{/isHTTPS}}</stringProp>
          <stringProp name="HTTPSampler.protocol">{{#isHTTPS}}https{{/isHTTPS}}</stringProp>
          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
          <stringProp name="HTTPSampler.path">{{PathAndQuery}}</stringProp>
          <stringProp name="HTTPSampler.method">{{RequestMethod}}</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>
          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
          <stringProp name="HTTPSampler.response_timeout"></stringProp>
          <stringProp name="HTTPSampler.implementation">Java</stringProp>
        </HTTPSamplerProxy>
        <hashTree/>
      {{/SelectedSessions}}  
        
          <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Result Tree" 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>
                <threadCounts>true</threadCounts>
                <idleTime>true</idleTime>
                <connectTime>true</connectTime>
              </value>
            </objProp>
            <stringProp name="filename"></stringProp>
          </ResultCollector>
          <hashTree/>
        
      </hashTree>
	
    </hashTree>
    <WorkBench guiclass="WorkBenchGui" testclass="WorkBench" testname="WorkBench" enabled="true">
      <boolProp name="WorkBench.save">true</boolProp>
    </WorkBench>
    <hashTree/>
  </hashTree>
</jmeterTestPlan>

The problem with the modification you made is that it is expecting RequestHeaders on line #60. Please see above example that should suffice your need. PS that i've removed headers and you would either need to adjust above or leave headers if that works for you. I had highlighted the same in my previous comment that you should be hardcoding the headers or replace them all together

if you need more customization i would suggest create a sample Jmeter i.e. jmx file by dragging and dropping expected elements and then edit in Notepad++ or other text editors to examine how Jmeter is constructing those.

from mockingbird.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.