In the previous section, we talked about how to set up the ruby + watir automated testing environment. In this section, I will learn more about harruby and watir.
Ruby features
The development of computer programming languages is always closely related to the rapidly changing world. Ruby emerged to adapt to changes, improve and improve programming art.
L fully open-source
L multi-platform Ruby can run in Linux, UNIX, windows, MS-DOS, BEOs, OS/2...
L multi-threaded threads are the functions that can process several control flows in a program. Unlike the process provided by the OS, threads can share memory space.
L completely object-oriented
L memory management is not required. Garbage collect and GC functions are available to automatically recycle objects that are no longer in use.
L explain and execute the program without compilation.
L powerful string operations/Regular Expressions
L Exception Handling
L you can directly access OS Ruby and use the vast majority of system calls (UNIX. You can also use Ruby for system programming.
L The ruby variable in the dynamic type language has no type, so you don't have to worry about type matching.
L when the dynamic language program is running, you can add new attributes, behaviors, or rewrite methods.
L support operator Rewriting
L it is easy to support numbers with infinite precision, for example, to calculate a factorial of 400.
L rich library functions
L mix-in Ruby removes multiple inheritance but has the hybrid insertion function. Use modules to share data and methods beyond the limitations of classes.
L The syntax is simple. It is a scripting language with no pointer and a low learning curve.
To sum up, Ruby draws on Perl regular expressions, Python's simplicity and readability, Smalltalk's pure object-oriented syntax and single inheritance, LISP's infinitely nested syntax, Java's thread...
Watir Introduction
Watir encapsulates a mechanism for identifying web page elements. Testers can use Ruby to identify objects based on their attributes, and then write Ruby code to control the test logic, add checkpoints and so on to achieve automated testing, and have the advantages of customizing the framework and test logic at will.