[ptt-users] Future TestMaker Features
Kyle Bell
kylebell at tango-networks.com
Tue Nov 28 17:59:16 PST 2006
Frank,
Thanks a ton! This is much easier! I used your junit test case
template and made the following test case from an example provided by
sipunit documentation:
import sys, re, time, string, traceback#, junit
from java.lang import Exception
from org.cafesip.sipunit import
SipCall,SipPhone,SipResponse,SipStack,SipTestCase,SipTransaction
class TestWithProxyNoAuthentication:
sipStack = None
ua = None
def __init__( self ):
''' Initialize the test case '''
pass
def setUp( self ):
''' Add any needed set-up code here. '''
self.sipStack = SipStack(None, -1)
self.ua = self.sipStack.createSipPhone("lab027.tango-
networks.com", "udp", 5060, "sip:5610000 at 192.168.73.53") # create user a
def runTest( self ):
''' Run the test '''
#self.ua.register(None, 1800)
#assertLastOperationSuccess("Caller registration failed - "+
self.ua.format(), self.ua)
try:
ub = self.sipStack.createSipPhone("lab027.tango-
networks.com", "udp", 5060, "sip:5610001 at 192.168.73.53") # create user
b
#ub.register(None, 600)
#assertLastOperationSuccess(ub) # standard JUnit fail
output
a = self.ua.createSipCall()
b = ub.createSipCall()
b.listenForIncomingCall()
time.sleep(.01)
a.initiateOutgoingCall("sip:5610001 at 192.168.73.53", None)
b.waitForIncomingCall(5000)
print "b message:", b.format()
b.sendIncomingCallResponse(SipResponse.RINGING, "Ringing",
0)
a.waitOutgoingCallResponse(10000)
print "a message:", a.format()
b.sendIncomingCallResponse(SipResponse.OK, "Answer - Hello
world", 0)
a.waitOutgoingCallResponse(10000)
print "a message:", a.format()
a.sendInviteOkAck()
time.sleep(5)
a.disconnect()
b.waitForDisconnect(5000)
print "b message:", b.format()
b.respondToDisconnect()
ub.dispose()
except:
etype, value, tb = sys.exc_info()
errmsg = string.join(traceback.format_exception( etype,
value, tb ))
print errmsg
def tearDown( self ):
''' Add any needed code to end the test here. '''
self.ua.dispose()
self.sipStack.dispose()
if __name__ == 'main':
test = TestWithProxyNoAuthentication()
test.setUp()
test.runTest()
test.tearDown()
print "done"
I put a little datafill into our test system and made a call. It didn't
complete end to end, but I did get some interaction. Check this out:
b message: Timeout Occurred: The maximum amount of time to wait for a
request message has elapsed.
a message: Status code received from network = 100, Trying
a message: Status code received from network = 500, Server Internal
Error
b message: Timeout Occurred: The maximum amount of time to wait for a
request message has elapsed.
done
And all in a couple of hours! This is fantastic. All I did was install
sipunit, and added to your TMCP.sh file a path to the jars which
comprise the sipunit/lib directory and wrote the test case. I tried to
extend the SipTestCase class and got the following error, however:
java.lang.IllegalAccessError: tried to access method
junit.framework.TestCase.<init>()V from class
org.cafesip.sipunit.SipTestCase
In your programming experience, have you come across a remedy for this?
I'm merely adding SipTestCase to the inheritance list for my test case
class thusly:
class TestWithProxyNoAuthentication(SipTestCase):
In the interim, I'll see if I can figure out why your zip file is
picking up two copies of TestMaker.sh. I'm unsure why this would be
happening... Are you running in Windows or Linux when you build?
-Kyle
On Tue, 2006-11-28 at 14:05 -0800, Frank Cohen wrote:
> Hi Kyle: I ran across SIPUnit on Freshmeat.
>
> http://www.cafesip.org/projects/sipunit/
>
> It looks to me like we could incorporate SIPUnit into TestMaker.
>
> -Frank
>
>
> On Oct 31, 2006, at 6:17 AM, Kyle Bell wrote:
>
> > Frank,
> >
> > Generally speaking the ability to build, send and parse Request and
> > Response messages is the basis for all SIP interaction, IM or other
> > uses, much the same as HTTP/HTTPS.
> >
> > Thinking about your protocol handler interface and how they implement
> > HTTP, the same could be provided for SIP/SIPS. Get a PH for SIP, add
> > the body and headers for a message which implements a particular SIP
> > method much the same as GET and POST for http only these methods would
> > be INVITE, MESSAGE, INFO, SUBSCRIBE, etc for the Request messages.
> > There would be a necessity to build the URI for the Request much the
> > same as an HTTP message and I would image your add header interface
> > would work for standard SIP headers to the message where you
> > specify the
> > header type and the user provides a string representing the header
> > content. The body of the message would likely contain standard SDP
> > for
> > the application part or plain text in the case of an instant
> > message for
> > the MESSAGE method.
> >
> > Once the message has been built, calling the connect function would
> > then
> > connect to the specified URI, send the message and collect a response.
> > These responses would then be given to the user as text as your normal
> > response, or if you are feeling randy, you might parse the response
> > message and provide the user with the standard textual description of
> > the canned response code (SIP standard response) or give the user the
> > capability to look for a particular bit of text in a particular
> > header.
> >
> > Typical implementations of SIP clients not only have a UAC part, but
> > also a UAS. This means that the client would also be able to
> > listen for
> > messages on a well known port specified by the application. This
> > being
> > the case, being able to give your PH a port to listen on as a UAS,
> > would
> > be very useful. When the UAS is instantiated, it could run in a
> > separate thread and report received requests to the test case. This
> > being the case, the PH for a UAS would also need to parse request
> > messages and build response messages in the same manner.
> >
> > In summary, you'd likely require a UAC version of the PH which looks
> > like your current implementation for HTTP and another
> > implementation of
> > a UAS so that reception of a message is possible, not just sending.
> >
> > I'll be on the lookout for a web site which talks about these
> > implementations that I can pass along although I image there are a
> > number of examples on www.sipforum.org.
> >
> > Regards,
> >
> > -Kyle
> >
> > On Fri, 2006-10-27 at 11:17 -0700, Frank Cohen wrote:
> >> Jain's SIP looks good. I'm a newbie to IM protocol libraries, just a
> >> frequent user of them. What methods would you like exposed to a
> >> TestMaker script? -Frank
> >>
> >>
> >> On Oct 27, 2006, at 11:02 AM, Kyle Bell wrote:
> >>
> >>> Frank,
> >>>
> >>> NIST has a SIP stack available for download which is also written in
> >>> Java. If you follow this link:
> >>>
> >>> https://jain-sip.dev.java.net/
> >>>
> >>> you'll find a built jar in the downloads section along with other
> >>> available material. If I find any other implementations that may be
> >>> more suitable, I'll alert you.
> >>>
> >>> Regards,
> >>>
> >>> -Kyle
> >>>
> >>> On Thu, 2006-10-26 at 18:26 -0700, Frank Cohen wrote:
> >>>> Hi Kyle: Thanks for the suggestion. Do you know of a stable SIP
> >>>> client written in Java with an open-source license? If so, point me
> >>>> to it. It's very easy to add protocol handlers. -Frank
> >>>>
> >>>>
> >>>>
> >>>> On Oct 26, 2006, at 5:19 PM, Kyle Bell wrote:
> >>>>
> >>>>> Frank,
> >>>>>
> >>>>> I don't know if you might be taking suggestions on feature
> >>>>> content,
> >>>>> but
> >>>>> I thought I'd just kind of drop this into the mail group and see
> >>>>> what
> >>>>> you think.
> >>>>>
> >>>>> Have you given any consideration to adding SIP to your protocol
> >>>>> handler
> >>>>> implementation? This would likely endear your product to those
> >>>>> who
> >>>>> perform testing with instant messengers, presence based
> >>>>> applications or
> >>>>> telephony products.
> >>>>>
> >>>>> Just a suggestion...
> >>>>>
> >>>>> Regards,
> >>>>>
> >>>>> Kyle
> >>>>>
> >>>>> _______________________________________________
> >>>>> Users mailing list
> >>>>> Users at lists.pushtotest.com
> >>>>> http://lists.pushtotest.com/mailman/listinfo/users
> >>>>>
> >>>>
> >>>> _______________________________________________
> >>>> Users mailing list
> >>>> Users at lists.pushtotest.com
> >>>> http://lists.pushtotest.com/mailman/listinfo/users
> >>>>
> >>>
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at lists.pushtotest.com
> >>> http://lists.pushtotest.com/mailman/listinfo/users
> >>>
> >>
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.pushtotest.com
> >> http://lists.pushtotest.com/mailman/listinfo/users
> >>
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.pushtotest.com
> > http://lists.pushtotest.com/mailman/listinfo/users
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.pushtotest.com
> http://lists.pushtotest.com/mailman/listinfo/users
>
More information about the Users
mailing list