Ruby-based watir-webdriver Automated Testing Solution and implementation (2), watirwebdriver
Then the Ruby-based watir-webdriver Automated Testing Solution and implementation (1)Http://www.cnblogs.com/javame/p/4259360.htmlcontinue ...... review overview of software automation testing Web automation testing solution design functional solution design business solution designImplementation of Web automation testing solutionsRecording and compiling of automated test scripts and executing specific test operations and collecting Test Data
Automated test script design and recording
• Tool: WatirRecorder ++
The preset parameter input rules are unified and the rule template is provided to implement one use case, one class, one method, and one output. (A class can have multiple methods)
• Example 1: (implement hao123 and search for "ruby)
Require 'watir-webdriver 'include Watirrequire 'test/unit' class TC_recorded <test: Unit: TestCase def test_recorded @ B = watir: Browser. new @ B. goto ('HTTP: // www.hao123.com/') @ B. text_field (: name, 'word '). set ('Ruby ') @ B. text_field (: name, 'word '). set ('Ruby ') @ B. button (: value, 'Baidu click '). click endend
Implementation of Automated Testing
• The specific implementation is embodied in the Tools tool class in Linux and Mysql. • • Column 2: (check whether the blacklist and whitelist take effect in linux)
class Linux < Mysqldef initialize ( host )@@host = host@@username = "root"@@password = "rootmengmeng“def L.gethost return @@hostenddef L.getusername return @@usernameenddef L.getpassword return @@passwordend def acl(ip)@name = ip a = "#{@name}" server_cmd1 = "{ echo ' acl -L'; sleep 2; echo -e '\n'; } | telnet 0 1234 | grep #{a}" ssh = Net::SSH.start(L.gethost, L.getusername, :password => L.getpassword) do |ssh| result = ssh.exec!(server_cmd1) @result=result ….. .….endattr_writer :host
Cost investment and risk analysis of Automated Software Testing
Cost of Automated Software Testing
• Script maintenance cost: automated testing processes make script maintenance a key basis for automated implementation. For a standardized system development process, it is necessary to automate testing. However, automated script maintenance makes automated testing expensive. The development of each system changes with the change of requirements at all times. However, in most cases, a very small number of system modifications will cause us to modify a large number of automated test scripts.
(That's why we need to introduce the relationship between architectures !)
The advantage of our architecture is that the business is separated from the logic, that is, when the page is updated or modified, you only need to record or write a new use case, without affecting the business results.
Maintenance of automated testing scripts
• The entire Automated Testing Open Platform consists of two parts:
JAVA front-end (responsible for data preset and execution initiation)
Ruby underlying layer (responsible for business implementation and operation execution)
• Maintenance
All configuration parameters of the JAVA frontend are dynamically obtained, and no modifications are required for later business changes.
Ruby underlying layer
The Test case layer and Control layer require long-term maintenance as demand iterates.
The Tools tool layer will only be changed based on significant changes in the business.
Othe does not need to be changed
Risk Analysis of Automated Software Testing
• Cause of risk: automated testing only tests and verifies most of the main functions of the system, so that the coverage of the test area is narrow, some Hidden Problems of the system cannot be found. • Risk Reduction suggestions: at the initial stage of automated testing, we should design automated test cases, grasp the key functions of the system and possible problems, and then implement automated testing. Reduce predictable system risks under existing conditions. • Objective: To reduce predictable system test risks under existing conditions.
At the end
1. Automation is not fully automated. It takes effort to automate it.
2. automation tools are not omnipotent, and they also have their own defects.
3. Automation will never replace the human location.
4. Maintenance of automated scripts is sometimes fatal and requires some experience.