background image
<< Client/Server Testing - Evolving a testing strategy | Client/Server Testing - Threads and concurrent programming >>
Client/Server Testing - Using 4Test's parallel processing features
<< Client/Server Testing - Evolving a testing strategy | Client/Server Testing - Threads and concurrent programming >>
User's Guide
365
21 I
MPLEMENTING
C
LIENT
/S
ERVER
T
ESTING
Using 4Test's parallel processing features
In a script: SilkTest allows you to specify the target's name in an explicit
connection command within the script. If you wish to connect to multiple
Agents, you must do it this way. There are two connection commands; this
chapter discusses the use of the Connect command and Chapter 22 describes
the SetUpMachine command.
The method you use depends on the type of network testing you are doing.
The examples in this chapter show each method, as appropriate.
Remote recording
Once you establish a connection to a target machine, any action you initiate
on the host machine (the one running SilkTest) is executed on the target
machine. For example, if you initiate a Record/Testcase command on the host
machine, you will record the interactions of the user manipulating the
application under test on the target machine. In order to use the Record
menu's remote recording operations, you have to place the target machine's
name into the Runtime Options dialog (select Options/Runtime).
Using 4Test's parallel processing features
Developing
concurrent scripts
A concurrent (or multithreaded) script is one in which multiple statements
can execute in parallel. Concurrency allows you to more effectively test
distributed systems by allowing multiple client applications to submit
requests to a server simultaneously.
The 4Test language fully supports the development of concurrent scripts,
enabling a script to:
Create and coordinate multiple concurrent threads
Protect access to variables that are global to all threads
Synchronize threads with semaphores
Protect critical sections of code (for atomic operations)
Recover from errors in the event of deadlock
This section explains each of these features.
Using 4Test to initiate
parallel testing
SilkTest can run testcases in parallel on more than one machine. To run
testcases in parallel, you can use parallel threads within main() or in a
function called by main(). A more elegant alternative is to use a multitestcase
function, which provides a robust multi-machine recovery system. For more
information, see Chapter 22, "Multi-Application Testing" and Appendix D,
"Useful Multitestcase Code Templates"
. Note that, if you attempt to run
testcases in parallel on the same machine, you will generate a runtime error.