From fe1bb074db951791223fb10a9d825bf18952a825 Mon Sep 17 00:00:00 2001 From: PriestJ Date: Mon, 19 Nov 2007 15:04:41 +0000 Subject: [PATCH] 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 --- tests/constants.rb | 8 +- tests/exportdatatests.rb | 112 ++++++++++++++-------------- tests/webmipintegrationteststart.rb | 93 +++++++++++++++++++++++ 3 files changed, 150 insertions(+), 63 deletions(-) create mode 100644 tests/webmipintegrationteststart.rb diff --git a/tests/constants.rb b/tests/constants.rb index e897e83..00e6f8a 100644 --- a/tests/constants.rb +++ b/tests/constants.rb @@ -44,10 +44,4 @@ MIPADMIN_PWD = 'testagent' ICU = 'testagent' ICU_PWD = 'testagent' CS = 'testagent' -CS_PWD = 'testagent' -INORG = 'testagent' -INORG_PWD = 'testagent' -EXTORG = 'testagent' -EXTORG_PWD = 'testagent' -MEMBER = 'testagent' -MEMBER_PWD = 'testagent' \ No newline at end of file +CS_PWD = 'testagent' \ No newline at end of file diff --git a/tests/exportdatatests.rb b/tests/exportdatatests.rb index 09361f1..e89de18 100644 --- a/tests/exportdatatests.rb +++ b/tests/exportdatatests.rb @@ -21,62 +21,62 @@ class Test_01_export_data < Test::Unit::TestCase #Check that all the appropriate tables are listed for export # def test_02_correct_list_of_tables_displayed - listoftablestoexport= %W[ACCESS_CONTROLS -ADDRESSES -ASSET_LOCATION_TYPES -BASES -BYPASS_REASONS -CARE_CATEGORIES -CONNECTION_ORIENTATIONS -CONNECTION_TYPES -CONTACT_MECHANISMS -CONTACT_MECHANISM_TYPES -COSTS -DATA_ITEMS -DATA_ITEM_ROLES -DATA_ITEM_ROLES_IMPORT -DRAWINGS -ENQUIRIES -ENQUIRY_EVENTS -ENQUIRY_ROLES -ENQUIRY_STATUS_TYPES -ENQUIRY_TYPES -ERROR_LOGS -EXCEPTION_MESSAGES -FILTERS -FILTER_TYPES -HOUSINGS -HOUSING_TYPES -METERS -METER_SIZE_CODES -METER_TYPES -MODULES -PARTIES -PARTY_ADDRESSES -PARTY_ADDRESS_ROLES -PARTY_CONTACT_MECHANISMS -PARTY_CONTACT_MECHANISM_ROLES -PARTY_RELATIONSHIPS -PARTY_RELATIONSHIP_TYPES -PARTY_ROLES -PASSWORDS -QUOTES -QUOTE_EVENTS -QUOTE_ITEMS -QUOTE_ROLES -QUOTE_STATUSES -REGIONS -REGULATORS -REGULATOR_TYPES -RELIEF_VALVES -RELIEF_VALVE_TYPES -ROLE_TYPES -SERVICE_PRESSURES -SERVICE_PRESSURE_TYPES -SLAMSHUT_TYPES -SLAMSHUT_VALVES] - assert_equal(listoftablestoexport,@@ie.select_list(:id, 'P5_TABLES').getAllContents ,'The data export screen did not appear') + listoftablestoexport= %W[ACCESS_CONTROLS + ADDRESSES + ASSET_LOCATION_TYPES + BASES + BYPASS_REASONS + CARE_CATEGORIES + CONNECTION_ORIENTATIONS + CONNECTION_TYPES + CONTACT_MECHANISMS + CONTACT_MECHANISM_TYPES + COSTS + DATA_ITEMS + DATA_ITEM_ROLES + DATA_ITEM_ROLES_IMPORT + DRAWINGS + ENQUIRIES + ENQUIRY_EVENTS + ENQUIRY_ROLES + ENQUIRY_STATUS_TYPES + ENQUIRY_TYPES + ERROR_LOGS + EXCEPTION_MESSAGES + FILTERS + FILTER_TYPES + HOUSINGS + HOUSING_TYPES + METERS + METER_SIZE_CODES + METER_TYPES + MODULES + PARTIES + PARTY_ADDRESSES + PARTY_ADDRESS_ROLES + PARTY_CONTACT_MECHANISMS + PARTY_CONTACT_MECHANISM_ROLES + PARTY_RELATIONSHIPS + PARTY_RELATIONSHIP_TYPES + PARTY_ROLES + PASSWORDS + QUOTES + QUOTE_EVENTS + QUOTE_ITEMS + QUOTE_ROLES + QUOTE_STATUSES + REGIONS + REGULATORS + REGULATOR_TYPES + RELIEF_VALVES + RELIEF_VALVE_TYPES + ROLE_TYPES + SERVICE_PRESSURES + SERVICE_PRESSURE_TYPES + SLAMSHUT_TYPES + SLAMSHUT_VALVES] + assert_equal(listoftablestoexport,@@ie.select_list(:id, 'P5_TABLES').getAllContents ,'The expected table list for export was not found') end - + end \ No newline at end of file diff --git a/tests/webmipintegrationteststart.rb b/tests/webmipintegrationteststart.rb new file mode 100644 index 0000000..e5b982a --- /dev/null +++ b/tests/webmipintegrationteststart.rb @@ -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 = < +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 \ No newline at end of file