Quantcast

Grinder - Authentication not working for me

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Grinder - Authentication not working for me

Ravi Kumar Maddi
Hi ,


I am new to Grinder, I am trying to write login test case in Jython. I am just using sample templates provided by Grinder. I am getting errors.

Please need help, what I am doing wrong

Same url, username and password I am able to login in browser.

I tried IP address and port instead of mycomapny.com also

My Code is

auth.properties

grinder.script = auth.py
grinder.runs = 10
grinder.useConsole = false
grinder.logDirectory = log

auth.py

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest

from net.grinder.plugin.http import HTTPPluginControl
from HTTPClient import AuthorizationInfo

# Enable HTTPClient's authorisation module.
HTTPPluginControl.getConnectionDefaults().useAuthorizationModule = 1

test1 = Test(1, "Request resource")
request1 = HTTPRequest()
test1.record(request1)

class TestRunner:
    def __call__(self):
        threadContextObject = HTTPPluginControl.getThreadHTTPClientContext()

        # Set the authorisation details for this worker thread.
        AuthorizationInfo.addDigestAuthorization("myapp.com", 80, "My User", "myuser1", "mypassword", threadContextObject)
        result = request1.GET('http://myapp.com/page1')

I am running as:

java -cp C:\grinder\lib\grinder.jar net.grinder.Grinder src\auth.properties

The output:

2014-07-22 15:17:23,878 INFO -0 : registered plug-in net.grinder.plugin.http.HTTPPlugin
2014-07-22 15:17:23,947 INFO -0 : running "src\auth.py" using Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]
2014-07-22 15:17:23,993 INFO -0 thread-0: starting, will do 10 runs
2014-07-22 15:17:23,994 INFO -0 : start time is 1406022443994 ms since Epoch
2014-07-22 15:17:24,337 INFO -0 thread-0 [ run-0, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:24,572 INFO -0 thread-0 [ run-1, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:24,801 INFO -0 thread-0 [ run-2, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,030 INFO -0 thread-0 [ run-3, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,308 INFO -0 thread-0 [ run-4, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,576 INFO -0 thread-0 [ run-5, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,804 INFO -0 thread-0 [ run-6, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,033 INFO -0 thread-0 [ run-7, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,267 INFO -0 thread-0 [ run-8, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,494 INFO -0 thread-0 [ run-9, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,495 INFO -0 thread-0: finished 10 runs
2014-07-22 15:17:26,497 INFO -0 : elapsed time is 2503 ms
2014-07-22 15:17:26,498 INFO -0 : Final statistics for this process:
2014-07-22 15:17:26,523 INFO -0 : 
 TestsErrorsMean TestTest TimeTPS Mean Response Response Mean time to Mean time to Mean time to 
Time (ms)Standard response bytes pererrorsresolve host establishfirst byte
Deviation lengthsecond connection
(ms)

Test 1100247.4034.604.00 18680.00 74630.44 100.10 3.20 230.20"Request resource"

Totals100247.4034.604.00 18680.00 74630.44 100.10 3.20 230.20

 Tests resulting in error only contribute to the Errors column. 
 Statistics for individual tests can be found in the data file, including
 (possibly incomplete) statistics for erroneous tests. Composite tests
 are marked with () and not included in the totals. 
Thanks and regards,
Ravikumar Maddi,
[hidden email],
+ 91 - 8884638999



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grinder - Authentication not working for me

Ouray Viney
What have you done so far to troubleshoot your problem?

Where do you think your problem lies?  Do you think it is your code or a bug in the Grinder?

On Jul 22, 2014, at 7:13 AM, Ravi Kumar Maddi <[hidden email]> wrote:

Hi ,


I am new to Grinder, I am trying to write login test case in Jython. I am just using sample templates provided by Grinder. I am getting errors.

Please need help, what I am doing wrong

Same url, username and password I am able to login in browser.

I tried IP address and port instead of mycomapny.com also

My Code is

auth.properties

grinder.script = auth.py
grinder.runs = 10
grinder.useConsole = false
grinder.logDirectory = log

auth.py

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest

from net.grinder.plugin.http import HTTPPluginControl
from HTTPClient import AuthorizationInfo

# Enable HTTPClient's authorisation module.
HTTPPluginControl.getConnectionDefaults().useAuthorizationModule = 1

test1 = Test(1, "Request resource")
request1 = HTTPRequest()
test1.record(request1)

class TestRunner:
    def __call__(self):
        threadContextObject = HTTPPluginControl.getThreadHTTPClientContext()

        # Set the authorisation details for this worker thread.
        AuthorizationInfo.addDigestAuthorization("myapp.com", 80, "My User", "myuser1", "mypassword", threadContextObject)
        result = request1.GET('http://myapp.com/page1')

I am running as:

java -cp C:\grinder\lib\grinder.jar net.grinder.Grinder src\auth.properties

The output:

2014-07-22 15:17:23,878 INFO -0 : registered plug-in net.grinder.plugin.http.HTTPPlugin
2014-07-22 15:17:23,947 INFO -0 : running "src\auth.py" using Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]
2014-07-22 15:17:23,993 INFO -0 thread-0: starting, will do 10 runs
2014-07-22 15:17:23,994 INFO -0 : start time is 1406022443994 ms since Epoch
2014-07-22 15:17:24,337 INFO -0 thread-0 [ run-0, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:24,572 INFO -0 thread-0 [ run-1, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:24,801 INFO -0 thread-0 [ run-2, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,030 INFO -0 thread-0 [ run-3, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,308 INFO -0 thread-0 [ run-4, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,576 INFO -0 thread-0 [ run-5, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,804 INFO -0 thread-0 [ run-6, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,033 INFO -0 thread-0 [ run-7, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,267 INFO -0 thread-0 [ run-8, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,494 INFO -0 thread-0 [ run-9, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,495 INFO -0 thread-0: finished 10 runs
2014-07-22 15:17:26,497 INFO -0 : elapsed time is 2503 ms
2014-07-22 15:17:26,498 INFO -0 : Final statistics for this process:
2014-07-22 15:17:26,523 INFO -0 : 
 TestsErrorsMean TestTest TimeTPS Mean Response Response Mean time to Mean time to Mean time to 
Time (ms)Standard response bytes pererrorsresolve host establishfirst byte
Deviation lengthsecond connection
(ms)

Test 1100247.4034.604.00 18680.00 74630.44 100.10 3.20 230.20"Request resource"

Totals100247.4034.604.00 18680.00 74630.44 100.10 3.20 230.20

 Tests resulting in error only contribute to the Errors column. 
 Statistics for individual tests can be found in the data file, including
 (possibly incomplete) statistics for erroneous tests. Composite tests
 are marked with () and not included in the totals. 
Thanks and regards,
Ravikumar Maddi,
[hidden email],
+ 91 - 8884638999


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grinder - Authentication not working for me

Ravi Kumar Maddi
I am feeling problem in my code. I think, i miss some of the settings in .propeties file or in .ps file. I am not very clear because i don't know much about Grinder. So I posted all my code. I hope you can understand. 
And I am using 
Grinder 3.11
Jython 2.5.3

My goal is I have to test all my application urls to do that first i have to login to application and have to carry that login state(authentication state) to all the other requests.


Thanks,
Ravi


On Tue, Jul 22, 2014 at 5:46 PM, Ouray Viney <[hidden email]> wrote:
What have you done so far to troubleshoot your problem?

Where do you think your problem lies?  Do you think it is your code or a bug in the Grinder?

On Jul 22, 2014, at 7:13 AM, Ravi Kumar Maddi <[hidden email]> wrote:

Hi ,


I am new to Grinder, I am trying to write login test case in Jython. I am just using sample templates provided by Grinder. I am getting errors.

Please need help, what I am doing wrong

Same url, username and password I am able to login in browser.

I tried IP address and port instead of mycomapny.com also

My Code is

auth.properties

grinder.script = auth.py
grinder.runs = 10
grinder.useConsole = false
grinder.logDirectory = log

auth.py

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest

from net.grinder.plugin.http import HTTPPluginControl
from HTTPClient import AuthorizationInfo

# Enable HTTPClient's authorisation module.
HTTPPluginControl.getConnectionDefaults().useAuthorizationModule = 1

test1 = Test(1, "Request resource")
request1 = HTTPRequest()
test1.record(request1)

class TestRunner:
    def __call__(self):
        threadContextObject = HTTPPluginControl.getThreadHTTPClientContext()

        # Set the authorisation details for this worker thread.
        AuthorizationInfo.addDigestAuthorization("myapp.com", 80, "My User", "myuser1", "mypassword", threadContextObject)
        result = request1.GET('http://myapp.com/page1')

I am running as:

java -cp C:\grinder\lib\grinder.jar net.grinder.Grinder src\auth.properties

The output:

2014-07-22 15:17:23,878 INFO -0 : registered plug-in net.grinder.plugin.http.HTTPPlugin
2014-07-22 15:17:23,947 INFO -0 : running "src\auth.py" using Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]
2014-07-22 15:17:23,993 INFO -0 thread-0: starting, will do 10 runs
2014-07-22 15:17:23,994 INFO -0 : start time is 1406022443994 ms since Epoch
2014-07-22 15:17:24,337 INFO -0 thread-0 [ run-0, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:24,572 INFO -0 thread-0 [ run-1, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:24,801 INFO -0 thread-0 [ run-2, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,030 INFO -0 thread-0 [ run-3, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,308 INFO -0 thread-0 [ run-4, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,576 INFO -0 thread-0 [ run-5, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:25,804 INFO -0 thread-0 [ run-6, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,033 INFO -0 thread-0 [ run-7, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,267 INFO -0 thread-0 [ run-8, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,494 INFO -0 thread-0 [ run-9, test-1 ]: http://myapp.com/page1 -> 403 Forbidden, 18680 bytes
2014-07-22 15:17:26,495 INFO -0 thread-0: finished 10 runs
2014-07-22 15:17:26,497 INFO -0 : elapsed time is 2503 ms
2014-07-22 15:17:26,498 INFO -0 : Final statistics for this process:
2014-07-22 15:17:26,523 INFO -0 : 
 TestsErrorsMean TestTest TimeTPS Mean Response Response Mean time to Mean time to Mean time to 
Time (ms)Standard response bytes pererrorsresolve host establishfirst byte
Deviation lengthsecond connection
(ms)

Test 1100247.4034.604.00 18680.00 74630.44 100.10 3.20 230.20"Request resource"

Totals100247.4034.604.00 18680.00 74630.44 100.10 3.20 230.20

 Tests resulting in error only contribute to the Errors column. 
 Statistics for individual tests can be found in the data file, including
 (possibly incomplete) statistics for erroneous tests. Composite tests
 are marked with () and not included in the totals. 
Thanks and regards,
Ravikumar Maddi,
[hidden email],
+ 91 - 8884638999


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use




--
Hi ,


Thanks and regards,
Ravikumar Maddi,
[hidden email],
+ 91 - 8884638999



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Loading...