#file: testdata.rb require 'net/http' require 'rexml/document' include REXML class Testdata def initialize end def load(url) xml_data = Net::HTTP.get_response(URI.parse(url)).body @doc = Document.new(xml_data) true end def get_input(name) @doc.root.elements['test/inputs/input/' + name].text end def get_output(name) @doc.root.elements['test/outputs/output/' + name].text end def tested?() end def print(method, result) puts "<result method='#{method}'>#{result}</result>" end def plan @doc end end #test #url = 'http://m.jamesrobertson.eu/test/testdata/' #testfile = "testfile.xml" #td = Testdata.new #td.load(url + testfile) #print('get_input', #td.get_input('input1').scan('instring').length > 0) #print('get_output', td.get_output('output1').scan('outstring').length > 0) #puts test_feed.tested?
You need to create an account or log in to post comments to this site.