Is it possible to call a test case from with in another?

#1

Hi there,

I’m trying to build some logic in one of my test cases where it can decided, depending on the server response, which test case to execute. Is this possible from with in a test case?

I am using the Autobahn testsuite in python

Thanks,

Adrian

0 Likes

#2

I’m using the websocket fuzzingclient, i forgot to mention that

···

On Friday, March 14, 2014 6:31:19 AM UTC+2, Adrian Dukhan wrote:

Hi there,

I’m trying to build some logic in one of my test cases where it can decided, depending on the server response, which test case to execute. Is this possible from with in a test case?

I am using the Autobahn testsuite in python

Thanks,

Adrian

0 Likes

#3

Adrian,

not sure I understand. Do you mean

- Fuzzing client executes case against a testee server
- Depending on case result (pass or fail), fuzzing client will execute either next case A or B?

/Tobias

···

Am 14.03.2014 06:00, schrieb Adrian Dukhan:

I'm using the websocket fuzzingclient, i forgot to mention that

On Friday, March 14, 2014 6:31:19 AM UTC+2, Adrian Dukhan wrote:

    Hi there,

    I'm trying to build some logic in one of my test cases where it can
    decided, depending on the server response, which test case to
    execute. Is this possible from with in a test case?

    I am using the Autobahn testsuite in python

    Thanks,
    Adrian

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#4

Hi Tobias,

Just to explain my setup, I have an auth test case(test case 1) and then some action test case(test case 2), e.g. pick item.

To pick an item, I would need to have an auth session in the same websocket connection.

So, if in my fuzzingclient.json I let it know to run test case 1 and then test case 2, it would open a connection for test case 1 then close it, and then do the same for test case 2.

What I would like to do is execute test case 1 and 2 in the same connection, to do that I would need to create a test case (test case 3 ) that executes test case 1 and then executes test case 2.

Is this possible or am I totally missing the point here?

Thanks,

Adrian

···

On Friday, March 14, 2014 11:47:58 AM UTC+2, Tobias Oberstein wrote:

Adrian,

not sure I understand. Do you mean

  • Fuzzing client executes case against a testee server

  • Depending on case result (pass or fail), fuzzing client will execute
    either next case A or B?

/Tobias

Am 14.03.2014 06:00, schrieb Adrian Dukhan:

I’m using the websocket fuzzingclient, i forgot to mention that

On Friday, March 14, 2014 6:31:19 AM UTC+2, Adrian Dukhan wrote:

Hi there,
I'm trying to build some logic in one of my test cases where it can
decided, depending on the server response, which test case to
execute. Is this possible from with in a test case?
I am using the Autobahn testsuite in python
Thanks,
Adrian

You received this message because you are subscribed to the Google

Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send

an email to autobahnws+...@googlegroups.com

mailto:autobahnws+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#5

Adrian,

> Just to explain my setup, I have an auth test case(test case 1) and then

some action test case(test case 2), e.g. pick item.

To pick an item, I would need to have an auth session in the same
websocket connection.

So, if in my fuzzingclient.json I let it know to run test case 1 and
then test case 2, it would open a connection for test case 1 then close
it, and then do the same for test case 2.

What I would like to do is execute test case 1 and 2 in the same
connection, to do that I would need to create a test case (test case 3 )
that executes test case 1 and then executes test case 2.

The testsuite is designed to run test cases independent of each other, and run each test case on a completely new WebSocket connection. This is to avoid possible interferences between test cases as far as possible.

What you could do (as you noted above .. or at least that is how I understand what you outlined) is to create new test cases which "sequence" execution of other test cases internally.

To create a test case, you subclass

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/case.py

e.g.

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/case1_1_2.py

and then add the new case to

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/init.py

The (subclass) of Case is then driven by

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/fuzzing.py#L80

Is this possible or am I totally missing the point here?

To be honest, I am still unsure I get what you want:

What is "auth test case"?

Is that about "authentication"? If so, what should that be?

Do you want to have a separate test case for "authentication" (whatever that should do), and then combine that with further testing into new test cases?

Like:

Test 1: authentication test only
Test 2: test for X
Test 3: Test 1 + Test 2 (that is, first authenticate, then test for X)

?

Cheers,
/Tobias

···

Thanks,
Adrian

On Friday, March 14, 2014 11:47:58 AM UTC+2, Tobias Oberstein wrote:

    Adrian,

    not sure I understand. Do you mean

    - Fuzzing client executes case against a testee server
    - Depending on case result (pass or fail), fuzzing client will execute
    either next case A or B?

    /Tobias

    Am 14.03.2014 06:00, schrieb Adrian Dukhan:
     > I'm using the websocket fuzzingclient, i forgot to mention that
     >
     > On Friday, March 14, 2014 6:31:19 AM UTC+2, Adrian Dukhan wrote:
     >
     > Hi there,
     >
     > I'm trying to build some logic in one of my test cases where
    it can
     > decided, depending on the server response, which test case to
     > execute. Is this possible from with in a test case?
     >
     > I am using the Autobahn testsuite in python
     >
     > Thanks,
     > Adrian
     >
     > --
     > You received this message because you are subscribed to the Google
     > Groups "Autobahn" group.
     > To unsubscribe from this group and stop receiving emails from it,
    send
     > an email to autobah...@googlegroups.com <javascript:>
     > <mailto:autobahnws+...@googlegroups.com <javascript:>>.
     > For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#6

Hi Tobias,

Thanks for getting back to me and sorry for not being too clear.

My auth is authentication, this is a test case which would have an onOpen function, then call sendMessage with a json payload. e.g login, so the payload will be username and password.

"import json

class Case1_1_1(Case):

DESCRIPTION = “”“Send message with payload.”""

EXPECTATION = “”“Receive OK message. Clean close with normal code.”""

def onOpen(self):

payload = { “username”: “john”, “password”: “john”

}

self.expected[Case.OK] = []

self.expectedClose = {“closedByMe”:True,“closeCode”:[self.p.CLOSE_STATUS_CODE_NORMAL],“requireClean”:True}

self.p.sendMessage(payload, isBinary = False)"

then:

test case 2:

Run test case requires test case1_1_1

"import json

class Case2_1_1(Case):

DESCRIPTION = “”". Then Send message with payload action."""

EXPECTATION = “”“Receive OK message if open auth session or fail if no session. Clean close with normal code.”""

def onOpen(self):

payload = {

“action”: “pick”,

“item”: 1

}

self.expected[Case.OK] = [(“message”,Case.FAIL, false)]

self.expectedClose = {“closedByMe”:True,“closeCode”:[self.p.CLOSE_STATUS_CODE_NORMAL],“requireClean”:True}

self.p.sendMessage(payload, isBinary = False)"

So, if I run test case2_1_1 on it’s own it would fail because it requires test case1_1_1 to be run in the same connection.

What I would like to do is build a test case3_1_1 which would look something like:

import json

class Case3_1_1(Case):

DESCRIPTION = “”“Run test case1_1_1 and then 2_1_1"”"

EXPECTATION = “”“Receive OK message. Clean close with normal code.”""

def onOpen(self):

runTest(case1_1_1)

runTest(case2_1_1)

self.expected[Case.OK] = []

self.expectedClose = {“closedByMe”:True,“closeCode”:[self.p.CLOSE_STATUS_CODE_NORMAL],“requireClean”:True}

Thanks,

Adrian

···

On Tuesday, March 18, 2014 9:55:05 AM UTC+2, Tobias Oberstein wrote:

Adrian,

Just to explain my setup, I have an auth test case(test case 1) and then

some action test case(test case 2), e.g. pick item.

To pick an item, I would need to have an auth session in the same

websocket connection.

So, if in my fuzzingclient.json I let it know to run test case 1 and

then test case 2, it would open a connection for test case 1 then close

it, and then do the same for test case 2.

What I would like to do is execute test case 1 and 2 in the same

connection, to do that I would need to create a test case (test case 3 )

that executes test case 1 and then executes test case 2.

The testsuite is designed to run test cases independent of each other,
and run each test case on a completely new WebSocket connection. This is
to avoid possible interferences between test cases as far as possible.

What you could do (as you noted above … or at least that is how I
understand what you outlined) is to create new test cases which
“sequence” execution of other test cases internally.

To create a test case, you subclass

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/case.py

e.g.

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/case1_1_2.py

and then add the new case to

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/init.py

The (subclass) of Case is then driven by

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/fuzzing.py#L80

Is this possible or am I totally missing the point here?

To be honest, I am still unsure I get what you want:

What is “auth test case”?

Is that about “authentication”? If so, what should that be?

Do you want to have a separate test case for “authentication” (whatever
that should do), and then combine that with further testing into new
test cases?

Like:

Test 1: authentication test only

Test 2: test for X

Test 3: Test 1 + Test 2 (that is, first authenticate, then test for X)

?

Cheers,

/Tobias

Thanks,

Adrian

On Friday, March 14, 2014 11:47:58 AM UTC+2, Tobias Oberstein wrote:

Adrian,
not sure I understand. Do you mean
- Fuzzing client executes case against a testee server
- Depending on case result (pass or fail), fuzzing client will execute
either next case A or B?
/Tobias
Am 14.03.2014 06:00, schrieb Adrian Dukhan:
 > I'm using the websocket fuzzingclient, i forgot to mention that
 >
 > On Friday, March 14, 2014 6:31:19 AM UTC+2, Adrian Dukhan wrote:
 >
 >     Hi there,
 >
 >     I'm trying to build some logic in one of my test cases where
it can
 >     decided, depending on the server response, which test case to
 >     execute. Is this possible from with in a test case?
 >
 >     I am using the Autobahn testsuite in python
 >
 >     Thanks,
 >     Adrian
 >
 > --
 > You received this message because you are subscribed to the Google
 > Groups "Autobahn" group.
 > To unsubscribe from this group and stop receiving emails from it,
send
 > an email to autobahnws+...@googlegroups.com <javascript:>
 > <mailto:autobahnws+unsub...@googlegroups.com <javascript:>>.
 > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout)
<[https://groups.google.com/d/optout](https://groups.google.com/d/optout)>.

You received this message because you are subscribed to the Google

Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send

an email to autobahnws+...@googlegroups.com

mailto:autobahnws+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#7

I’m looking for something like test case 12_X_X but have them dependant on each other where 12_2_x is dependant on the result of 12_1_x.

I see now that I would have to re-work the fuzzing.py file to get my desired result. Thanks again for the assistance.

···

On Tuesday, March 18, 2014 12:16:19 PM UTC+2, Adrian Dukhan wrote:

Hi Tobias,

Thanks for getting back to me and sorry for not being too clear.

My auth is authentication, this is a test case which would have an onOpen function, then call sendMessage with a json payload. e.g login, so the payload will be username and password.

"import json

class Case1_1_1(Case):

DESCRIPTION = “”“Send message with payload.”""

EXPECTATION = “”“Receive OK message. Clean close with normal code.”""

def onOpen(self):

payload = { “username”: “john”, “password”: “john”

}

self.expected[Case.OK] = []

self.expectedClose = {“closedByMe”:True,“closeCode”:[self.p.CLOSE_STATUS_CODE_NORMAL],“requireClean”:True}

self.p.sendMessage(payload, isBinary = False)"

then:

test case 2:

Run test case requires test case1_1_1

"import json

class Case2_1_1(Case):

DESCRIPTION = “”". Then Send message with payload action."""

EXPECTATION = “”“Receive OK message if open auth session or fail if no session. Clean close with normal code.”""

def onOpen(self):

payload = {

“action”: “pick”,

“item”: 1

}

self.expected[Case.OK] = [(“message”,Case.FAIL, false)]

self.expectedClose = {“closedByMe”:True,“closeCode”:[self.p.CLOSE_STATUS_CODE_NORMAL],“requireClean”:True}

self.p.sendMessage(payload, isBinary = False)"

So, if I run test case2_1_1 on it’s own it would fail because it requires test case1_1_1 to be run in the same connection.

What I would like to do is build a test case3_1_1 which would look something like:

import json

class Case3_1_1(Case):

DESCRIPTION = “”“Run test case1_1_1 and then 2_1_1"”"

EXPECTATION = “”“Receive OK message. Clean close with normal code.”""

def onOpen(self):

runTest(case1_1_1)

runTest(case2_1_1)

self.expected[Case.OK] = []

self.expectedClose = {“closedByMe”:True,“closeCode”:[self.p.CLOSE_STATUS_CODE_NORMAL],“requireClean”:True}

Thanks,

Adrian

On Tuesday, March 18, 2014 9:55:05 AM UTC+2, Tobias Oberstein wrote:

Adrian,

Just to explain my setup, I have an auth test case(test case 1) and then

some action test case(test case 2), e.g. pick item.

To pick an item, I would need to have an auth session in the same

websocket connection.

So, if in my fuzzingclient.json I let it know to run test case 1 and

then test case 2, it would open a connection for test case 1 then close

it, and then do the same for test case 2.

What I would like to do is execute test case 1 and 2 in the same

connection, to do that I would need to create a test case (test case 3 )

that executes test case 1 and then executes test case 2.

The testsuite is designed to run test cases independent of each other,
and run each test case on a completely new WebSocket connection. This is
to avoid possible interferences between test cases as far as possible.

What you could do (as you noted above … or at least that is how I
understand what you outlined) is to create new test cases which
“sequence” execution of other test cases internally.

To create a test case, you subclass

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/case.py

e.g.

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/case1_1_2.py

and then add the new case to

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/case/init.py

The (subclass) of Case is then driven by

https://github.com/tavendo/AutobahnTestSuite/blob/master/autobahntestsuite/autobahntestsuite/fuzzing.py#L80

Is this possible or am I totally missing the point here?

To be honest, I am still unsure I get what you want:

What is “auth test case”?

Is that about “authentication”? If so, what should that be?

Do you want to have a separate test case for “authentication” (whatever
that should do), and then combine that with further testing into new
test cases?

Like:

Test 1: authentication test only

Test 2: test for X

Test 3: Test 1 + Test 2 (that is, first authenticate, then test for X)

?

Cheers,

/Tobias

Thanks,

Adrian

On Friday, March 14, 2014 11:47:58 AM UTC+2, Tobias Oberstein wrote:

Adrian,
not sure I understand. Do you mean
- Fuzzing client executes case against a testee server
- Depending on case result (pass or fail), fuzzing client will execute
either next case A or B?
/Tobias
Am 14.03.2014 06:00, schrieb Adrian Dukhan:
 > I'm using the websocket fuzzingclient, i forgot to mention that
 >
 > On Friday, March 14, 2014 6:31:19 AM UTC+2, Adrian Dukhan wrote:
 >
 >     Hi there,
 >
 >     I'm trying to build some logic in one of my test cases where
it can
 >     decided, depending on the server response, which test case to
 >     execute. Is this possible from with in a test case?
 >
 >     I am using the Autobahn testsuite in python
 >
 >     Thanks,
 >     Adrian
 >
 > --
 > You received this message because you are subscribed to the Google
 > Groups "Autobahn" group.
 > To unsubscribe from this group and stop receiving emails from it,
send
 > an email to autobahnws+...@googlegroups.com <javascript:>
 > <mailto:autobahnws+unsub...@googlegroups.com <javascript:>>.
 > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout)
<[https://groups.google.com/d/optout](https://groups.google.com/d/optout)>.

You received this message because you are subscribed to the Google

Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send

an email to autobahnws+...@googlegroups.com

mailto:autobahnws+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes