Watir-webdriver Automation test scheme and implementation based on Ruby (IV.)

Source: Internet
Author: User
Tags mysql query

then the Watir-webdriver Automation test scheme and implementation based on Ruby (III.)Http://www.cnblogs.com/Javame/p/4159468.html continue ... First recall our system architecture, and then talk about the specific implementation.

The automated testing framework is divided into three modules: test use case, control layer, Tools tool class, Model master control.

Test use case
    1. Ruby-based Watir-webdriver development
    2. Uniform preset parameter input rules, provide a rule template, do a use case a class, a method of one output. (A class can be multiple methods)
    3. Unified output rules, such as: ①[info]②tistone③login successful! ④001011

①[info]: On behalf of the use case executed successfully! [ERROR] stands for failure! [Warn] represents a warning!

②tistone: Represents the execution case name

③login successful! : Describes or captures the value values to "! "End

④001011: Return code

4. Uniform use case name, should be consistent with output ②

Control layer
    1. A use case corresponds to a control
    2. Validation output, determine the success or failure of the use case, according to the rules associated Linux server capture related logs, configuration files and other reasons for analysis failure, reduce the location area range.
    3. Compare data, correlate MySQL query data, and compare Web Capture value.
Tools Tool Class
    1. Package Tool Class
    2. Associating Linux with MySQL
    3. Provides test case support to reduce the difficulty of use case development
Index Total Control
    1. Control case execution and presentation
Scenario Design test use case

Involves dependencies:

Require ' watir-webdriver ' require ' watir-webdriver-performance '

Page Load Performance monitoring

1.times do B.goto ("Https://192.168.10.1/web") Load_secs = b.performance.summary[:response_time]/1000puts "Load Time: # {load_secs} seconds. " End

Identification of functional success

If B.text.include? ' t_100m '            #捕获web属性value值            #后续操作            puts "①[info]②tistone③login successful! 000000 "Else            #后续操作            #输出错误码            puts" ①[error]②tistone③login failed! 001011 "End

Parametric extraction

Class Basicnumber    def initialize (number,name)        @number = number        @name = name    end    def add (x)        @number + x    endend
Control layer

Involves dependencies:

Load ' linux.rb ' load ' mysql.rb '

The concrete realization communicates with the tools, makes the information transmits the hub.

Tools Tool Class

Involves dependencies:

Require ' net/ssh ' require ' scp/ssh ' require ' test/unit '

Associating Linux

#ip/username/Password host = "192.168.48.233" username = "root" password = "root" #调用linux命令server_cmd1 = ' Tail-1000/home/log/web.log  grep ERROR ' server_shell= ' sh/home/wyong/w.sh '

Associated MySQL

Specific implementation of a slightly ...

Unit Test

Class Tc_mytest  < Test::unit::testcase         def Test_add                   n=basicnumber.new (134)                   assert_equal ( N.add (4), "This test on add is failure!")      EndEnd
Model Master Control

Involves dependencies:

Load Control_ use case name. RB '

Unified invocation

t = Control_ use case name. Newtest_methods = T.public_methods.grep (/^test_/) Test_methods.each do |test|  T.send (test) end

Watir-webdriver Automation test scheme and implementation based on Ruby (IV.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.