20
2005/03/03 JSS Extension 1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

Embed Size (px)

Citation preview

Page 1: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 1/20

Java Serial Stream Adapterfor IBM/Rational Robot & Test Manager©

Zyntax Consulting BV

Page 2: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 2/20

Introduction

• Java is an established standard• Applications written in Java need testing, too• Messaging between client and server involves

passing of objects in a serialized format• Object serialization is via a defined protocol• Robot© generates scripts containing raw binary

data; serialization simply unsupported• JSS Extension supports this serialization

Page 3: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 3/20

Overview

Why the JSSOur solutionExamplesCaveats

Future plansQuestions

Page 4: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 4/20

Why the JSS (1)

• Robot© scripts have raw data:

sock_send "`aced0005`sr`0015`dcslibrary.DCSRequest` "heckSumI`0010`m_nRequestActionI`000d`m_n "java/lang/Object;L`000f`m_strFunctionIdt "_strLanguageq`007e00024c000e`m_strSessio "nTypeq`007e00024c0011`m_strStationGroupq "`007e00024c0011`m_strTimeZoneNameq`007e0

Page 5: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 5/20

Why the JSS (2)

• Users want a high-level script they can read, modify and replay:

jss_data( _string, "m_object.m_strSessionId", "71" ) +jss_data( _string, "m_object.m_strSessionType", "W" ) +jss_data( _string, "m_object.m_strStationId", "W71" ) +jss_data( _ref, "m_strErrorCode", "NULL" ) +

Page 6: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 6/20

Our solution (1)

• Requirements:– Recording and playback– Simple, easy-to-read scripts– Quick implementation

• Experiences developing other adaptors:– Integration with Robot nice, but hard– Impossible to record customer protocol and

other protocols simultaneously

Page 7: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 7/20

Our solution (2)

• Architecture overview

JSSRawscript

JSSscript

Page 8: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 8/20

Our solution (3)

• Interceptionraw data

Client

ServerHTTP

SQL

custom

socket(IP)

client machine netserver

machine

protocol data

Scripts are more readable with higher-level data

Page 9: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 9/20

Our solution (4)

• JSS “under the hood”

JSS

Rawscript

JSSscript

GNUFlex JSS

parser

java

Detects and reassembles Java object streams in VU

non-java

Page 10: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 10/20

Our solution (5)

• Stream elements are translated to:– jss_begin() / jss_end() delimit stream– jss_new() for new objects / classes– jss_def() for class / object definition details– jss_data() for data – jss_raw() for unsupported details (mixed mode)

• During replay, data elements are merged into serialized objects and sent to server

Page 11: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 11/20

Our solution (6)

• Example:sock_send jss_begin( “5” ) + jss_new( _object, “obj1”, “” ) + jss_def( _class, “obj1.<name>”, “AllPrim” ) + jss_def( _class, “obj1.<uid>”, “c73a9c3cb013e429” ) + jss_def( _class, “obj1.<flags>”, “SC_SERIALIZABLE” ) + jss_def( _class, “obj1.<num_flds>”, “2” ) + jss_def( _field_p, “obj1.theBool”, “boolean” ) + jss_def( _field_p, “obj1.theFloat”, “float” ) + /* … */ jss_data( _bool, “obj1.theBool”, “TRUE” ) + jss_data( _float, “obj1.theFloat”, “1.23456” ) + jss_end();

Page 12: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 12/20

Details (1)

• Supported VU encapsulations:– sock_send

<rawdata>– http_request

<request header> <rawdata>

– http_requests where data is chunked– #if 0

<rawdata>#endif

Page 13: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 13/20

Details (2)

• Nesting

• Arraysjss_new( _class, "obj1.theIntArray", "[I" ) +/* … */jss_data( _int, "obj1.theIntArray.<size>", “2" ) +jss_data( _int, "obj1.theIntArray[0]", “516" ) +jss_data( _int, "obj1.theIntArray[1]", “781" ) +

jss_data( _string, "m_object.m_strSessionId", "71" ) +jss_data( _string, "m_object.m_strSessionType", "W" ) +jss_data( _string, "m_object.m_strStationId", "W71" ) +jss_data( _ref, "m_strErrorCode", "NULL" ) +

Page 14: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 14/20

Details (3)

• References– to NULL – to a previous string / object (0x7e####)

Prevents data repeating and infinite loops for linked lists

– are automatically recalculated on replay

java_data( _string, "m_strSessionType", "W" ) + java_data( _ref , "m_strStationGroup", "0x7e0009" ) +

Page 15: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 15/20

Details (4)

• Heuristic parser deals with data that is further formatted:– Content in ZIP format (standard Java I/O)

– Nested streams in binary blocks

jss_deflate( jss_begin( “order ID: 5” ) + /* … */ jss_end())

jss_begin( “5” ) +jss_blocks( 3, 1024, jss_begin( “5” ) + …

Page 16: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 16/20

Details (5)

• Multi-connection data often misunder- stood by Robot. JSS re-assembles:

http_nrecv [“cmd_001"] 218 ; /* 218 bytes /(unknown response length) */

jss_store( “zyntax_com_3", _response );

/* VU code to receive data on different connection *//* VU code to change back to original connection */

http_nrecv [“cmd_002"] 48 ; jss_store( “zyntax_com_3", _response );full_response = jss_retrieve( “zyntax_com_3” );

Page 17: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 17/20

Caveats

• Script generation:– Manual edits may confuse FLEX module– New encapsulations?– Use WinDiff when in doubt

• Replay:– Datapool use may change sizes, possibly

causing different numbers of packet receives.

Page 18: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 18/20

• Serialization in J2SE 1.5.0 (XML!)• Other encapsulations for serial blocks?• Similar protocols (RMI,…)

Future Plans

Page 19: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 19/20

Conclusion

• JSS Extension– Affordable, Quick to implement

and– Switches focus to how application behaves under

multi-user load, if it meets requirements, etc.

• Technically– Makes testing possible– Allows understanding what application is doing– Provides ability to generate realistic scripts

Page 20: 2005/03/03JSS Extension1/20 Java Serial Stream Adapter for IBM/Rational Robot & Test Manager © Zyntax Consulting BV

2005/03/03 JSS Extension 20/20

Questions

• Questions?Visit http://www.zyntax.comEmail [email protected] +31-20-6155033Post a nice letter…

PO Box 513361007EH AmsterdamThe Netherlands