print result.text

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

print result.text

Alan Jackson
Hi,

Can anyone help me write the output of a URL to the out.log file or another log file

Currently I have: -

#       tests[2].POST(searchUrl + sessionCookie,
        result = tests[14].POST('http://cathp60:7002//search-customer.do' + sessionCookie,
          ( NVPair('mpn', '07935139299'),
            NVPair('accountId', ''),
            NVPair('contactType', 'User'), ))
        print result.text
        #WriteToFile(result.text)

The print result.text will output the result on the command line however I need to record this result into the log file.

I tried WriteToFile(result.text) however this just returned an error.

Can someone please advise?


------------------------------------------------------------------------------

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: print result.text

Joan Picanyol i Puig
* Alan Jackson <[hidden email]> [20160901 17:11]:
> Hi,
> Can anyone help me write the output of a URL to the out.log file or another log file
> Currently I have: -
> #       tests[2].POST(searchUrl + sessionCookie,        result = tests[14].POST('http://cathp60:7002//search-customer.do' + sessionCookie,          ( NVPair('mpn', '07935139299'),            NVPair('accountId', ''),            NVPair('contactType', 'User'), ))        print result.text        #WriteToFile(result.text)
> The print result.text will output the result on the command line however I need to record this result into the log file.
> I tried WriteToFile(result.text) however this just returned an error.
> Can someone please advise?

Doesn't logging it do what you want?

    from net.grinder.script.Grinder import grinder
    grinder.logger.info(result.text)

http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py

http://grinder.sourceforge.net/g3/logging.html

qvb
--
pica

------------------------------------------------------------------------------
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: print result.text

Alan Jackson
Unfortunately not maybe I am going about this the wrong way.

The main aim is to get a response back from a URL however currently even if the DB is unavailable the response code comes back 200 OK




From: Joan Picanyol i Puig <[hidden email]>
To: [hidden email]
Sent: Thursday, September 1, 2016 5:32 PM
Subject: Re: [Grinder-use] print result.text

* Alan Jackson <[hidden email]> [20160901 17:11]:

> Hi,
> Can anyone help me write the output of a URL to the out.log file or another log file
> Currently I have: -
> #       tests[2].POST(searchUrl + sessionCookie,        result = tests[14].POST('http://cathp60:7002//search-customer.do' + sessionCookie,          ( NVPair('mpn', '07935139299'),            NVPair('accountId', ''),            NVPair('contactType', 'User'), ))        print result.text        #WriteToFile(result.text)
> The print result.text will output the result on the command line however I need to record this result into the log file.
> I tried WriteToFile(result.text) however this just returned an error.
> Can someone please advise?


Doesn't logging it do what you want?

    from net.grinder.script.Grinder import grinder
    grinder.logger.info(result.text)

http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py

http://grinder.sourceforge.net/g3/logging.html

qvb
--
pica

------------------------------------------------------------------------------
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use


------------------------------------------------------------------------------

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: print result.text

Alan Jackson



----- Forwarded Message -----
From: Alan Jackson <[hidden email]>
To: grinder-use <[hidden email]>
Sent: Friday, September 2, 2016 9:23 AM
Subject: Re: [Grinder-use] print result.text

Unfortunately not maybe I am going about this the wrong way.

The main aim is to get a response back from a URL however currently even if the DB is unavailable the response code comes back 200 OK




From: Joan Picanyol i Puig <[hidden email]>
To: [hidden email]
Sent: Thursday, September 1, 2016 5:32 PM
Subject: Re: [Grinder-use] print result.text

* Alan Jackson <[hidden email]> [20160901 17:11]:

> Hi,
> Can anyone help me write the output of a URL to the out.log file or another log file
> Currently I have: -
> #       tests[2].POST(searchUrl + sessionCookie,        result = tests[14].POST('<a rel="nofollow" shape="rect" target="_blank" onclick="return theMainWindow.showLinkWarning(this)" href="http://cathp60:7002//search-customer.do'">http://cathp60:7002//search-customer.do' + sessionCookie,          ( NVPair('mpn', '07935139299'),            NVPair('accountId', ''),            NVPair('contactType', 'User'), ))        print result.text        #WriteToFile(result.text)
> The print result.text will output the result on the command line however I need to record this result into the log file.
> I tried WriteToFile(result.text) however this just returned an error.
> Can someone please advise?


Doesn't logging it do what you want?

    from net.grinder.script.Grinder import grinder
    grinder.logger.info(result.text)

http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py

http://grinder.sourceforge.net/g3/logging.html

qvb
--
pica

------------------------------------------------------------------------------
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use




------------------------------------------------------------------------------

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: print result.text

Joan Picanyol i Puig
In reply to this post by Alan Jackson
Sorry, but I can't understand the issue you are having :(

If the system under test return HTTP 200 status there's not much grinder
can do about it.

* Alan Jackson <[hidden email]> [20160902 10:10]:

> Unfortunately not maybe I am going about this the wrong way.
> The main aim is to get a response back from a URL however currently even if the DB is unavailable the response code comes back 200 OK
>
>
>       From: Joan Picanyol i Puig <[hidden email]>
>  To: [hidden email]
>  Sent: Thursday, September 1, 2016 5:32 PM
>  Subject: Re: [Grinder-use] print result.text
>    
> * Alan Jackson <[hidden email]> [20160901 17:11]:
> > Hi,
> > Can anyone help me write the output of a URL to the out.log file or another log file
> > Currently I have: -
> > #       tests[2].POST(searchUrl + sessionCookie,        result = tests[14].POST('http://cathp60:7002//search-customer.do' + sessionCookie,          ( NVPair('mpn', '07935139299'),            NVPair('accountId', ''),            NVPair('contactType', 'User'), ))        print result.text        #WriteToFile(result.text)
> > The print result.text will output the result on the command line however I need to record this result into the log file.
> > I tried WriteToFile(result.text) however this just returned an error.
> > Can someone please advise?
>
> Doesn't logging it do what you want?
>
>     from net.grinder.script.Grinder import grinder
>     grinder.logger.info(result.text)
>
> http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py
>
> http://grinder.sourceforge.net/g3/logging.html
>
> qvb
> --
> pica
>
> ------------------------------------------------------------------------------
> _______________________________________________
> grinder-use mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>
>    


--
pica

------------------------------------------------------------------------------
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: print result.text

Jagadish Anandhan
In reply to this post by Joan Picanyol i Puig
did you try the below statement, should work for you - 

grinder.getLogger().info(result.text)

Regards
Jagadish

On Thu, Sep 1, 2016 at 10:02 PM, Joan Picanyol i Puig <[hidden email]> wrote:
* Alan Jackson <[hidden email]> [20160901 17:11]:
> Hi,
> Can anyone help me write the output of a URL to the out.log file or another log file
> Currently I have: -
> #       tests[2].POST(searchUrl + sessionCookie,        result = tests[14].POST('http://cathp60:7002//search-customer.do' + sessionCookie,          ( NVPair('mpn', '07935139299'),            NVPair('accountId', ''),            NVPair('contactType', 'User'), ))        print result.text        #WriteToFile(result.text)
> The print result.text will output the result on the command line however I need to record this result into the log file.
> I tried WriteToFile(result.text) however this just returned an error.
> Can someone please advise?

Doesn't logging it do what you want?

    from net.grinder.script.Grinder import grinder
    grinder.logger.info(result.text)

http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py

http://grinder.sourceforge.net/g3/logging.html

qvb
--
pica

------------------------------------------------------------------------------
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use



--
Regards,
-A J -
Apt No - 508-925-4521
Mobile - 508-981-0870

------------------------------------------------------------------------------

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use