Introduction: Adobe's Flex has become more and more popular, but the performance testing of the Flex program is not a good tool. Including the famous Performance test tool LoadRunner has not yet had a good support for the new version of Flex performance testing. In the study of the actual work, I found a good way to test the Flex program. This article focuses on how to handle Flex's AMF messages in performance testing. The test tool used in this article is the grinder, the development language is Jython and Java.
Keywords: Flex test, Flex performance test, AMF message decoding
1. The puzzle of Flex program performance test
Flex uses the AMF protocol for transport by default. The AMF Protocol's interaction with the Server side of the browser is transmitted through the HTTP protocol, as shown in Figure 1-1. Client end to server: First is the object of the Action Script, packaged into the AMF MESSAGE,AMF message object is serialized into a binary array, stored in the HTTP POST request data domain, after uploading to the server, reverse order As a Java version of the AMF message object, the server-side Flex framework takes out the business objects in the AMF messages and sends them to the corresponding server-side Java objects. Server-side to client side is similar.
Figure 1-1 Flex AMF message transfer
When the AMF message is recorded with the script recorder, it is a string of human unreadable binary arrays.
result = request1201. POST ('/home/messagebroker/amfsecure ' +
'?) RND ',
(0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04,
0x6e, 0x75, 0x6c, 0x6c , 0x00, 0x02, 0x2f, 0x31,
0x00, 0x00, 0x00, 0xCB, 0x0A, 0x00, 0x00, 0x00,
0 X01, 0x11, 0x0A, 0x81, 0x13, 0x4d, 0x66, 0x6c,
0x31, 0x30, 0x37, 0x37, 0x34, 0x32, 0x45, 0 X31,
...,
0x07, 0x6e, 0x69, 0x6c, 0x01, 0x04, 0x00,),
( ' Content-type ', ' APPLICATION/X-AMF '),)
If you do not need to make any parameterization to the sent AMF message, you can replay the script directly. But if you want to understand the content of the AMF message, or if you need to modify the content of the AMF message in accordance with the actual situation, then you should find a way to parse the binary array. As previously mentioned, this binary array is actually the data serialized by the AMF message object. Unfortunately, this serialization algorithm is Adobe custom, ordinary Java deserialization, and can not parse out, and parsed into the AMF message object, but also need to be serialized into binary, sent to the server side. The author has tried a variety of methods to parse and encode the AMF message object, finally found a way to encode and parse the AMF message, and in the actual test to be used, this method applies to the grinder, and LoadRunner.