Đang chuẩn bị liên kết để tải về tài liệu:
Java Testing and Design- P7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Java Testing and Design- P7: The ultimate test of every software construction effort is the user’s success using the product to accomplish some practical goal. No matter how much state-of-the-art technology goes into the software, success can only be judged through the lens of the user. | Preparation and Setup Agents 279 The agent begins the main body of the commands by opening the commands file. dbfile open target The default open command opens a file for read access. The agent then duplicates the command constants originally defined in Prepare_Setup_Agent. The agent loops through each record in the command.db file and processes each command. While the post_message function does not actually send a request to a Web-enabled application it does print the reply message with the correct indentation to the screen. The agent then creates variables used during command processing including a counter for the number of commands processed an identifier for the next new message and an integer value to track the indentation of the next reply message in the tree of reply messages. Setup_agent processes each command in the commands file. The for command loops through every line in the commands file. for line in dbfile.readlines The agent creates a list variable called commands by reading a line from the commands file and splitting it into a list of individual values by delimiting each value by a comma character using the split function. commands line.split The commands variable is a list so commands 0 refers to the first value found in the current line of the commands file. In the discussion system example the first time through this loop commands 0 contains a new_thread command. The agent handles commands and takes action accordingly. When handling a new_thread command the agent indicates the command has been handled bumps up the number of handled commands posts the message using the post_message function pushes the indentation value onto the stack using the push function then bumps up the number of messages and the indentation value. if int command new_thread handled 1 tick 1 node post_message next_message indent 280 Chapter8 State Design and Testing top-message commands 1 commands 2 push indent next_message 1 indent 1 The handled variable is a simple flag that