About the selenium RC environment (based on the Java language), I have done before the system learning selenium, and in my series of articles can be found. It was done according to a video operation of a predecessor, I detailed the procedure of recording.
Here we have a look at the working principle of selenium RC.
Brief introduction
So before we learned the Selenium IDE and the Selenium command, did we use the Selenium IDE to complete all of our automated test work? No! The Selenium IDE is not as powerful as we think it is, and there are a variety of complex operations in the actual project, such as conditional judgment, looping, reading and writing files, querying databases, and e-mail test reports. These are not selenium IDE simple recordings can be done.
Selenium RC can adapt to more complex automated test requirements, not just simple browser operations and linear execution. Selenium RC can make full use of programming language to build more complex automated test cases.
Selenium RC Working principle
Then how the selenium RC components work and what role they play in the test case run.
Explains that client library files pass commands to the server. The server then uses the Selenium-core JavaScript command to pass to the browser, which uses its own JavaScript translator to execute the selenium command. This means that the Selenese actions and validations in the test script will be executed.
* Selenium Server
It is responsible for starting and closing the browser, interpreting and running the Selenese command from the test program, and intercepting and validating the HTTP message between the browser and the application to be tested (AUT), like an HTTP proxy.
When the test program opens the browser (using the API function of the client library file), the RC server binds selenium core and automatically embeds it in the browser. Selenium core is a JavaScript program, actually a series of JavaScript functions that use the browser's built-in JavaScript translator to translate and execute Selenese commands.
* Client File
The client library file provides a programming interface. Allows you to run the Selenese command using the program you have written, with the corresponding client library files for different languages. Similar to the concept of database dialect package, if you want to use Java operation database, for different databases, you need to import different database driver jar files, MySQL has MySQL dialect package, DB has db dialect package.
The client library file obtains a selenise command and passes it to selenium Server to perform a specified operation or to test based on the application to be tested (AUT). The client library file receives the execution result of the command and passes it to your test program. After the program receives the result, it is saved in the variable. Then report success or failure, if the result is unexpected failure, can also be targeted to take corrective action.
So to create a test program, you just use the client library file API to write the program, the program will run a series of selenium commands, of course selenium IDE recorded content generated Selenese test script, can be converted to different language scripts.