提交 1913efad 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

update test scripts

上级 561c249e
......@@ -8,17 +8,16 @@ pid=0
1. Load web page from url http://xxx
2. Retrieve img element zt-logo.png in html
3. Check img exist >> `.*zt-logo.png`
3. Check img exist >> `必应`
=end
require "open-uri"
require 'uri'
require 'net/http'
uri = 'http://max.demo.zentao.net/user-login-Lw==.html'
html = nil
open(uri) do |http|
html = http.read
end
uri = URI('https://cn.bing.com')
res = Net::HTTP.get_response(uri)
html = res.body
elem = html.match(/<img src="(.*?)" .*>/).captures
puts ""+elem[0]
elem = html.match(/<title>(.*?)</).captures
puts ""+elem[0]
\ No newline at end of file
......@@ -7,18 +7,18 @@ pid=0
1. Send a request to interface http://xxx
2. Retrieve sessionID field from response json
3. Check its format >> `^[a-z0-9]{26}`
3. Check its format >> `^[0-9]{8}`
=end
require "open-uri"
require "json"
require 'uri'
require 'net/http'
require 'json'
uri = 'http://max.demo.zentao.net/pms/?mode=getconfig'
html = nil
open(uri) do |http|
html = http.read
end
uri = URI('https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1')
res = Net::HTTP.get_response(uri)
json = JSON.parse(res.body)
puts json['images'][0]['startdate']
json = JSON.parse(html) # need json library (gem install json)
puts json['sessionID']
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册