[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grinder-use
Subject:    Re: [Grinder-use] Issue with Marking scenario/test failed
From:       Shankar Ramanathan <shankar.ramanathan () globallogic ! com>
Date:       2013-02-26 6:21:43
Message-ID: CACbcfHozXfZ-O6dyz_+xaCDFb-NZh_arsSy10cZBNthSwVQfpg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thank you so much & makes perfect sense!

I realized the importance for writing the script in Eclipse/grinderstone to
dig into methods exposed & learning from existing script examples which are
detailed enough.

Cheers, Shankar

On Tue, Feb 26, 2013 at 12:42 AM, Philip Aston <philipa@mail.com> wrote:

> Because you're within the instrumented code (the function), you can say
> 
> grinder.statistics.forCurrentTest.success = 0
> 
> grinder.statistics.forLastTest is useful after a test has completed. The
> point at which your script is calling it refers to the test for the
> previous function that was called, and the test results will have been
> dispatched before you set "grinder.statistics.delayReports=1", hence the
> error.
> 
> Does that make sense?
> 
> - Phil
> 
> 
> On 25/02/13 16:07, Shankar Ramanathan wrote:
> 
> Hi,
> 
> I'm trying mark one of my Test as failed so that it appears in BOLD RED
> (in Console under Error) whenever the response i'm expecting is not
> returned. I'm attaching script file & log file. I tried referring to script
> gallery example & post @
> http://permalink.gmane.org/gmane.comp.java.grinder.user/6082 without much
> help
> 
> Below is the code snippet
> 
> def GetTouchPointID1(self):
> 
> """GET / (request 401).Negative testcase"""
> grinder.statistics.delayReports = 1
> 
> self.token_touchPointId = \
> 'tamp'
> result = request.GET('/ibms/provisioning/v1/touchpoint/' +
> '?touchPointId=' + self.token_touchPointId, None, )
> 
> print "JSON: " + result.getText()
> 
> if ( 200 != result.getStatusCode() ):
> grinder.statistics.forLastTest.success = 0                <== For
> reasons beyond me the Jython is throwing error as mentioned below for 404
> Returned
> print " \n GET on TouchPoint Id FAILED \n"
> #return False
> else:
> print " \n GET On TouchPoint Id Successfull \n"
> 
> return result
> 
> 
> ERROR
> 
> 2013-02-25 19:28:49,775 INFO  shankar-HP-ProBook-6450b-31 thread-0 [
> run-0, test-200 ]:
> http://172.17.158.26/ibms/provisioning/v1/touchpoint/?touchPointId=@ ->
> 404 NOT FOUND, 5295 bytes
> 2013-02-25 19:28:49,796 ERROR shankar-HP-ProBook-6450b-31 thread-0 [ run-0
> ]: aborted run - Java exception calling TestRunner
> net.grinder.scriptengine.jython.JythonScriptExecutionException: Java
> exception calling TestRunner
> grinder.statistics.forLastTest.success = 0
> File
> "/home/shankar/./shankar-HP-ProBook-6450b-file-store/current/Demo1.py",
> line 123, in GetTouchPointID1
> self.GetTouchPointID1()      # GET (requests 201)
> File
> "/home/shankar/./shankar-HP-ProBook-6450b-file-store/current/Demo1.py",
> line 237, in __call__
> net.grinder.script.InvalidContextException: Statistics for test invocation
> have been reported and cannot be updated. Perhaps you should have called
> setDelayReports(true)?
> at
> net.grinder.engine.process.StatisticsForTestImplementation.getStatisticsChecked(StatisticsForTestImplementation.java:80)
>  ~[lib/:na]
> at
> net.grinder.engine.process.StatisticsForTestImplementation.setSuccess(StatisticsForTestImplementation.java:135)
>  ~[lib/:na]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[na:1.6.0_38]
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> ~[na:1.6.0_38]
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  ~[na:1.6.0_38]
> at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_38]
> at org.python.core.PyBeanProperty._doset(PyBeanProperty.java:66)
> ~[jython-standalone-2.5.3.jar:na]
> 
> THANKS IN ADVANCE FOR YOUR REPLY & SUGGESTIONS
> 
> Cheers,
> Shankar
> 
> 
> 


[Attachment #5 (text/html)]

Thank you so much &amp; makes perfect sense! <div><br></div><div>I realized the \
importance for writing the script in Eclipse/grinderstone to dig into methods exposed \
&amp; learning from existing script examples which are detailed enough.<div> \
<br></div><div>Cheers, Shankar</div><div><br><div class="gmail_quote">On Tue, Feb 26, \
2013 at 12:42 AM, Philip Aston <span dir="ltr">&lt;<a href="mailto:philipa@mail.com" \
target="_blank">philipa@mail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Because you&#39;re within the instrumented
      code (the function), you can say<br>
      <br>
           grinder.statistics.forCurrentTest.success = 0<br>
      <br>
      grinder.statistics.forLastTest is useful after a test has
      completed. The point at which your script is calling it refers to
      the test for the previous function that was called, and the test
      results will have been dispatched before you set
      &quot;grinder.statistics.delayReports=1&quot;, hence the error.<br>
      <br>
      Does that make sense?<br>
      <br>
      - Phil<div><div class="h5"><br>
      <br>
      On 25/02/13 16:07, Shankar Ramanathan wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">Hi,
      <div><br>
      </div>
      <div>I&#39;m trying mark one of my Test as failed so that it appears
        in BOLD RED (in Console under Error) whenever the response i&#39;m
        expecting is not returned. I&#39;m attaching script file &amp; log
        file. I tried referring to script gallery example &amp; post @ <a \
href="http://permalink.gmane.org/gmane.comp.java.grinder.user/6082" \
target="_blank">http://permalink.gmane.org/gmane.comp.java.grinder.user/6082</a>  \
without much help</div>  <div><br>
      </div>
      <div>Below is the code snippet</div>
      <div><br>
      </div>
      <div>
        <div>def GetTouchPointID1(self):</div>
        <div>  <span style="white-space:pre-wrap"> </span>
           </div>
        <div>    &quot;&quot;&quot;GET / (request 401).Negative \
testcase&quot;&quot;&quot;</div>  <div>    grinder.statistics.delayReports = 1</div>
        <div>    </div>
        <div>    self.token_touchPointId = \</div>
        <div>      &#39;tamp&#39;</div>
        <div>    result =
          request.GET(&#39;/ibms/provisioning/v1/touchpoint/&#39; +</div>
        <div>
                &#39;?touchPointId=&#39; + self.token_touchPointId, None, )</div>
        <div>    </div>
        <div>    print &quot;JSON: &quot; + result.getText()</div>
        <div>    </div>
        <div>    if ( 200 != result.getStatusCode() ):</div>
        <div>    <span style="white-space:pre-wrap">
          </span> grinder.statistics.forLastTest.success = 0            
             &lt;== For reasons beyond me the Jython is throwing error
          as mentioned below for 404 Returned</div>
        <div>    <span style="white-space:pre-wrap">
          </span> print &quot; \n GET on TouchPoint Id FAILED \n&quot;</div>
        <div>    <span style="white-space:pre-wrap">
          </span> #return False</div>
        <div>
              else:</div>
        <div>    <span style="white-space:pre-wrap">
          </span> print &quot; \n GET On TouchPoint Id Successfull \n&quot;    </div>
        <div>         </div>
        <div>    return result</div>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>ERROR</div>
      <div><br>
      </div>
      <div>
        <div>2013-02-25 19:28:49,775 INFO  shankar-HP-ProBook-6450b-31
          thread-0 [ run-0, test-200 ]: <a \
href="http://172.17.158.26/ibms/provisioning/v1/touchpoint/?touchPointId=@" \
target="_blank">http://172.17.158.26/ibms/provisioning/v1/touchpoint/?touchPointId=@</a>
                
          -&gt; 404 NOT FOUND, 5295 bytes</div>
        <div>2013-02-25 19:28:49,796 ERROR shankar-HP-ProBook-6450b-31
          thread-0 [ run-0 ]: aborted run - Java exception calling
          TestRunner</div>
        <div>net.grinder.scriptengine.jython.JythonScriptExecutionException:
          Java exception calling TestRunner</div>
        <div>        grinder.statistics.forLastTest.success = 0</div>
        <div>        File
          &quot;/home/shankar/./shankar-HP-ProBook-6450b-file-store/current/Demo1.py&quot;,
  line 123, in GetTouchPointID1</div>
        <div>        self.GetTouchPointID1()      # GET (requests 201)</div>
        <div>        File
          &quot;/home/shankar/./shankar-HP-ProBook-6450b-file-store/current/Demo1.py&quot;,
  line 237, in __call__</div>
        <div>net.grinder.script.InvalidContextException: Statistics for
          test invocation have been reported and cannot be updated.
          Perhaps you should have called setDelayReports(true)?</div>
        <div>        at
          net.grinder.engine.process.StatisticsForTestImplementation.getStatisticsChecked(StatisticsForTestImplementation.java:80)
  ~[lib/:na]</div>
        <div>        at
          net.grinder.engine.process.StatisticsForTestImplementation.setSuccess(StatisticsForTestImplementation.java:135)
  ~[lib/:na]</div>
        <div>        at
          sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          ~[na:1.6.0_38]</div>
        <div>        at
          sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  ~[na:1.6.0_38]</div>
        <div>        at
          sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  ~[na:1.6.0_38]</div>
        <div>        at java.lang.reflect.Method.invoke(Method.java:597)
          ~[na:1.6.0_38]</div>
        <div>        at
          org.python.core.PyBeanProperty._doset(PyBeanProperty.java:66)
          ~[jython-standalone-2.5.3.jar:na]</div>
      </div>
      <div><br>
      </div>
      <div>THANKS IN ADVANCE FOR YOUR REPLY &amp; SUGGESTIONS</div>
      <div><br>
      </div>
      <div>Cheers,</div>
      <div>Shankar</div>
      <br>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div></div>



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

_______________________________________________
grinder-use mailing list
grinder-use@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/grinder-use


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic