Java Serial Stream Adapter for IBMRational Robot Test
Java Serial Stream Adapter for IBM/Rational Robot & Test Manager© Zyntax Consulting BV 2005/03/03 JSS Extension 1
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 2005/03/03 JSS Extension 2
Overview Why the JSS Our solution Examples Caveats Future plans Questions 2005/03/03 JSS Extension 3
Why the JSS (1) • Robot© scripts have raw data: sock_send "`aced 0005`sr`0015`dcslibrary. DCSRequest` "heck. Sum. I`0010`m_n. Request. Action. I`000 d`m_n "java/lang/Object; L`000 f`m_str. Function. Idt "_str. Languageq`007 e 00024 c 000 e`m_str. Sessio "n. Typeq`007 e 00024 c 0011`m_str. Station. Groupq "`007 e 00024 c 0011`m_str. Time. Zone. Nameq`007 e 0 2005/03/03 JSS Extension 4
Why the JSS (2) • Users want a high-level script they can read, modify and replay: jss_data( 2005/03/03 _string, _ref, "m_object. m_str. Session. Id", "m_object. m_str. Session. Type", "m_object. m_str. Station. Id", "m_str. Error. Code", JSS Extension "71" ) + "W 71" ) + "NULL" ) + 5
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 2005/03/03 JSS Extension 6
Our solution (2) • Architecture overview Raw script 2005/03/03 JSS Extension JSS script 7
Our solution (3) • Interception protocol data Client HTTP SQL … custom raw data Server socket (IP) client machine net server machine Scripts are more readable with higher-level data 2005/03/03 JSS Extension 8
Our solution (4) • JSS “under the hood” Raw script GNU Flex JSS non-java JSS parser JSS script Detects and reassembles Java object streams in VU 2005/03/03 JSS Extension 9
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 2005/03/03 JSS Extension 10
Our solution (6) • Example: sock_send jss_begin( “ 5” ) + jss_new( _object, jss_def( _class, jss_def( _field_p, /* … */ jss_data( _bool, jss_data( _float, jss_end(); 2005/03/03 “obj 1”, “obj 1. <name>”, “obj 1. <uid>”, “obj 1. <flags>”, “obj 1. <num_flds>”, “obj 1. the. Bool”, “obj 1. the. Float”, “” ) + “All. Prim” ) + “c 73 a 9 c 3 cb 013 e 429” ) + “SC_SERIALIZABLE” ) + “ 2” ) + “boolean” ) + “float” ) + “obj 1. the. Bool”, “obj 1. the. Float”, “TRUE” ) + “ 1. 23456” ) + JSS Extension 11
Details (1) • Supported VU encapsulations: – sock_send <rawdata> – http_request <request header> <rawdata> – http_requests where data is chunked – #if 0 <rawdata> #endif 2005/03/03 JSS Extension 12
Details (2) • Nesting jss_data( _string, _ref, "m_object. m_str. Session. Id", "m_object. m_str. Session. Type", "m_object. m_str. Station. Id", "m_str. Error. Code", "71" ) + "W 71" ) + "NULL" ) + • Arrays jss_new( /* … */ jss_data( 2005/03/03 _class, "obj 1. the. Int. Array", "[I" ) + _int, "obj 1. the. Int. Array. <size>", "obj 1. the. Int. Array[0]", "obj 1. the. Int. Array[1]", “ 2" ) + “ 516" ) + “ 781" ) + JSS Extension 13
Details (3) • References – to NULL – to a previous string / object (0 x 7 e####) java_data( _string, "m_str. Session. Type", "W" ) + java_data( _ref , "m_str. Station. Group", "0 x 7 e 0009" ) + Prevents data repeating and infinite loops for linked lists – are automatically recalculated on replay 2005/03/03 JSS Extension 14
Details (4) • Heuristic parser deals with data that is further formatted: – Content in ZIP format (standard Java I/O) jss_deflate( jss_begin( “order ID: 5” ) + /* … */ jss_end() ) – Nested streams in binary blocks jss_begin( “ 5” ) + jss_blocks( 3, 1024, jss_begin( “ 5” ) + … 2005/03/03 JSS Extension 15
Details (5) • Multi-connection data often misunderstood 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” ); 2005/03/03 JSS Extension 16
Caveats • Script generation: – Manual edits may confuse FLEX module – New encapsulations? – Use Win. Diff when in doubt • Replay: – Datapool use may change sizes, possibly causing different numbers of packet receives. 2005/03/03 JSS Extension 17
Future Plans • Serialization in J 2 SE 1. 5. 0 (XML!) • Other encapsulations for serial blocks? • Similar protocols (RMI, …) 2005/03/03 JSS Extension 18
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 2005/03/03 JSS Extension 19
Questions • Questions? Visit http: //www. zyntax. com Email info@zyntax. com Call +31 -20 -6155033 Post a nice letter… PO Box 51336 1007 EH Amsterdam The Netherlands 2005/03/03 JSS Extension 20
- Slides: 20