build the start page for the initial integration test suite, this will run all the integration tests and email any errors or failure to my mail box, will need to add other members of the team at a later date

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@2867 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2007-11-19 15:04:41 +00:00
parent 4c31f7e3e0
commit fe1bb074db
3 changed files with 150 additions and 63 deletions

View File

@@ -0,0 +1,93 @@
#requires
require 'watir'
#require our constants
require 'constants'
#require our useful helper methods
require 'default_methods.rb'
#email stuff
require 'net/smtp'
#require the test unit library
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'test/unit/testsuite'
#include the integration test cases
require 'exportdatatests'
#includes
include Watir
@@ie = IE.new
@@ie.maximize
#set the speed of watir, we'd also set the speed of light but that's supposed to be a constant
@@ie.speed = :fast
#
# Setup default config
#
# Remove the test data
#
#dosql('begin cleanup_testdata; commit; end;')
#
# Set the system submission deadline
#
#dosql('begin UPDATE system_configuration SET value = \'20:00\'
# WHERE parameter = \'G_SUBMISSION_DEADLINE\'; commit; end; ')
#
#Set up our contracts before we start serious testing
#
#require 'usefulscriptthatmightsetupdata'
#
#Get our individual integration tests
#
class WebMipIntegrationTests
def self.suite
suite = Test::Unit::TestSuite.new('webMIP Integration tests')
suite << Test_01_export_data.suite
#copy the line above, inserting your test to add
#more testcases into the integration test suite
return suite
end
end
#set output from test runner to be verbose and output to a iostring
sio = StringIO.new
tr = Test::Unit::UI::Console::TestRunner.new(
WebMipIntegrationTests, Test::Unit::UI::VERBOSE, sio )
#Set the test runner off
passed = tr.start()
#if we have some test failures or errors then send the email
if (passed.failure_count() > 0 or passed.error_count() > 0)
#build the email
from_addr = 'jamie.priest@advantica.com'
to_addr = 'jamie.priest@advanticagroup.com'
project = 'webMIP'
errors = sio.string
emailtext = <<END_EMAIL
From: webMIP <#{from_addr}>
To: Jamie Priest <#{to_addr}>
Subject: #{project} automated test failure
An automated assertion failed for the project
#{project}
#{errors}
END_EMAIL
Net::SMTP.start('LOMAIL01') do |smtp|
smtp.sendmail emailtext, from_addr, to_addr
end
end
@@ie.wait
@@ie.close