Warming up to modular testing Raleigh.pm 2009-03-19 Brad Oaks of Plus Three, LP.

Slides:



Advertisements
Similar presentations
Grid Wizard Enterprise Basic Tutorial Using Web Control Panel.
Advertisements

Optional Static Typing Guido van Rossum (with Paul Prescod, Greg Stein, and the types-SIG)
Lecture 4 Basic Scripting. Administrative  Files on the website will be posted in pdf for compatibility  Website is now mirrored at:
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Objected Oriented Perl An introduction – because I don’t have the time or patience for an in- depth OOP lecture series…
Topics Recap of the Object Model Inheritance Polymorphism – virtual functions Abstract classes, Pure virtual functions Design issues UML examples Templates.
Copyright Ó Oracle Corporation, All rights reserved Sharing Objects and Code.
Common project problems From Twin Cities CFUG meeting7/10/02.
Modules Standard Modules. Standard Modules The Subs and Functions worked perfectly well where they were – inside the two lines “Public Class Form1” and.
Software Development Unit 6.
Object-Oriented Programming in Visual Basic.NET. Overview Defining Classes Creating and Destroying Objects Inheritance Interfaces Working with Classes.
The GUS 3.0 Perl Object Layer CBIL Jonathan Schug June
01-Intro-Object-Oriented-Prog-Alice1 Barb Ericson Georgia Institute of Technology Aug 2009 Introduction to Object-Oriented Programming in Alice.
Adobe Acrobat. Overview Basic Skills – Updating – Making – Updating – Sending Advanced – Form creation – Data Exportation Help Resources.
Using Task Manager to Work EDI/ERA Posting Lori Phillips CHUG at Centricity Live April 29 – May 2,2015.
Changing Internet Explorer Settings for ActiveX control Installation VirtuOx Technical Services Guides.
To define a class in Visual Basic.NET, you can follow this general procedure: 1. Add a class to the project. 2. Provide an appropriate file name for.
Estimation Wrap-up CSE 403, Spring 2008, Alverson Spolsky.
Experiences Deploying Xrootd at RAL Chris Brew (RAL)
Win32 Programming Lesson 9: Jobs & Thread Basics.
Wolfgang Friebel, April AFS Administration Framework.
BZUPAGES.COM. PRESENTED TO: SIR AHMED KARIM PRESENTED BY: MUHAMMAD FAISAL RAO Malik Shabaz Asif BIT Department Of Information Technology Institute.
More Modules Inheritance, Exporting, documentation, testing.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormack 3rd floor 607.
1 Using Modules. 2 Modules A Perl module is a collection of subroutines and variables that typically implements some common functionality – and "packaged"
Meet Perl, Part 2 Flow of Control and I/O. Perl Statements Lots of different ways to write similar statements –Can make your code look more like natural.
Oracle Data Integrator Procedures, Advanced Workflows.
Templates, Databases and Frameworks. Databases: DBI Common database interface for perl Provides a functional,
Games Development 2 Concurrent Programming CO3301 Week 9.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Learning Unity. Getting Unity
Matt Arena, Fermilab.  Overview of SPMS  SPMS History & Statistics  Fermilab  Users, Roles & Privileges (Fine-grained Access)  System Parameters.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
How to write & use Perl Modules. What is a Module? A separate Namespace in a separate file with related functions/variables.
Optimizing in Perl By Peter Wad Sackett. Optimizing the code – minor gains 1 ++$i and $st.= $data instead of $i = $i+1 and $st = $st. $data Use index.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
CH 13 Server and Network Monitoring. Hands-On Microsoft Windows Server Objectives Understand the importance of server monitoring Monitor server.
Chapter 5 Files and Exceptions I. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. What is a file? A.
Class Discussion Boards. This is a tour of Manhattan’s Class Discussion Board Module. You’ll find that although there are lots of different ‘modules’
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
– Intermediate Perl 1/6/ Intermediate Perl - POD, parameters and configuration Intermediate Perl – Session 7 · POD –
More PowerPoint. Re-using your slides You can re-use your slides in different presentation. Choose Insert, Slides from Files Browse to locate the presentation.
Lecture 8: Advanced OOP Part 2. Overview Review of Subtypes Interfaces Packages Sorting.
Introduction to Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Computer Programming for Biologists Class 4 Nov 14 th, 2014 Karsten Hokamp
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
Advanced Perl For Bioinformatics Part 1 2/23/06 1-4pm Module structure Module path Module export Object oriented programming Part 2 2/24/06 1-4pm Bioperl.
Operators. Perl has MANY operators. –Covered in Chapter 3 of Camel –perldoc perlop Many operators have numeric and string version –remember Perl will.
1 Using Perl Modules. 2 What are Perl modules?  Modules are collections of subroutines  Encapsulate code for a related set of processes  End in.pm.
Perl Ed Finegan. Overview of Pearl Perl is a high-level programming language written by Larry Wall. It derives from the C programming language and to.
Customizing Share Document Previews Will Abson Senior Integrations Engineer and Share Extras Project Lead
CSU - DCE Webmaster JavaScript Class - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to Object-Oriented Perl and CGI.pm Instructor:
Copyright 2001, ActiveState. Using perl with Zope Andy McKay, ActiveState Python 9 Conference.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
3/5/2007Chris Green, FNAL / OSG VO-Level Site Validation.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Working in the Forms Developer Environment
Computer Programming I
Perl Reliability Workshop
Perl Modules.
Cs561 Presenter: QIAOQIAO CHEN Spring 2012
Packages and Interfaces
Medications Utilities – Mass Void Medications
Namespaces – Local and Global
Introduction to Object-Oriented Programming in Alice
Importing Transmittals Using the Excel Spreadsheet Template
September 12-14, 2018 Raleigh, NC.
Framework Anil
Presentation transcript:

Warming up to modular testing Raleigh.pm Brad Oaks of Plus Three, LP

Harness to run the show./bin/simple_test --files=t/pod.t #!/usr/bin/env perl use strict; use warnings; use Test::Harness; = glob("t/pod.t"); my $harness = TAP::Harness->new( {verbosity => 1, merge => 0} );

TAP::Harness can run multiple test jobs at once (aggregate_tests) try to emit results with color be verbose or varying levels of quiet see "perldoc TAP::Harness" Test::Harness is for backwards compatibility. For new work, you should start with TAP::Harness.

use base 'Test::Class'; use Arcos::Test; use Arcos::TestData; use Test::Builder qw(ok is_eq); use Test::LongString; sub tc_startup : Test(startup) { my $self = shift; $self->{td} = Arcos::TestData->new; } sub tc_shutdown : Test(shutdown) { my $self = shift; $self->{td}->cleanup(ignore_deleted => 1); } package Arcos::Test::Class

Arcos::Test::Class We provide a number of methods at this level: contains_url() lacks_url() json_success() json_failure() json_contains() json_lacks() input_value_is() local $Test::Builder::Level = $Test::Builder::Level + 1;

Test::Builder t/lib/Arcos/Test/Class.pm use Test::Builder qw(ok is_eq); # make Test::Builder give the right line number for failures local $Test::Builder::Level = $Test::Builder::Level + 1; Also provides plan $Test->plan(’no_plan’); $Test->plan( skip_all => $reason ); $Test->plan( tests => $num_tests );

An example of inherited tests Arcos::Form::Test is the parent of Arcos::Form::ContactOfficial::Test Arcos::Form::Register::Test They each have use base 'Arcos::Form::Test'; sub tc_startup : Test(startup) { $self->{td} = Arcos::TestData->new(); return $self->SUPER::tc_startup; }

package Arcos::Form::Test sub tc_startup : Test(startup) { sub tc_shutdown : Test(shutdown) { sub x_create_form : Test(startup => 3) { sub additional_elements { '' } sub form_db_class { '' } sub mech_shows_custom_fields sub person_has_custom_fields sub hit_form sub custom_field_default sub custom_fields_for_mech

t/register_form.t use strict; use warnings; use Arcos::Test; use Arcos::Test::Script; use Arcos::Form::Register::Test; Arcos::Test->needs_running_krang(); Arcos::Test->needs_running_apache(); Arcos::Form::Register::Test->new->runtests;

t/contact_official_form.t use Arcos::GeoCoder; my $coder = Arcos::GeoCoder->new; if (!$coder->available) { Test::More::plan(skip_all => 'geocoding databases not available.'); exit; } unless (Arcos::Test->stop_queue()) { Test::More::plan(skip_all => 'Could not stop Queue daemon in time.'); exit; } Arcos::Form::ContactOfficial::Test->new->runtests; Arcos::Test->restart_queue;

separating tests within a module t/pac_contribution_form-authorize.net.t Arcos::PACContributionForm::Test::AuthorizeNet Arcos::PACContributionForm::Test b_submit_empty_form : Test(no_plan) b_require_security_code : Test(5) c_address_validation : Test(21) e_amount_other_validation : Test(31) f_two_names_in_first_name : Test(3) g_card_security_code : Test(6)

return to skip return 'The default templates do not currently have security code; skipping for now.'; return 'You have no test payment account.' unless $self->test_account; return 'The deleted form test is not implemented for this form type yet.';

plan to skip use Arcos::Conf qw(ContributionTestMode); Arcos::Test->needs_run_daily(); if (!ContributionTestMode) { plan(skip_all => 'contributions not in test mode'); } elsif (!Arcos::Test->can_reach_url( ' { plan(skip_all => "Can't reach bin/wstest.vps"); } else { Arcos::ContributionForm::Test::Vanco->runtests(); }

calling plan from Arcos::Test if ($ENV{'RUN_DAILY_TESTS'}) { if ($ENV{'OVERRIDE_DAILY_TESTS'} or $class->_run_daily()) { $class->_update_run_daily_timestamp(); } } else { Test::More::plan( skip_all => 'RUN_DAILY_TESTS environment variable not set; skipping daily tests.'); }

needs_run_daily if ($ENV{'RUN_DAILY_TESTS'}) { if ($ENV{'OVERRIDE_DAILY_TESTS'} or $class->_run_daily()) { $class->_update_run_daily_timestamp(); } } else { Test::More::plan( skip_all => 'RUN_DAILY_TESTS environment variable not set; skipping daily tests.'); }

a lot of reuse use base 'Arcos::Report::SiteEvent::Test'; Arcos::Report::Volunteer::Test Arcos::Report::Contribution::Test Arcos::Report::ContactOfficial::Test Arcos::Report::Petition::Test Arcos::Report::Tellafriend::Test Arcos::Report::Subscription::Test Arcos::Report::RadioCall::Test Arcos::Report::LTE::Test Arcos::Report::ContactUs::Test

TEST_METHOD TEST_METHOD=a_good_file bin/arcos_test --files=t/admin- listupload.t TEST_METHOD=e_failed_contributions bin/arcos_test -- files=t/report-contribution.t TEST_METHOD=k_listing_checkbox bin/arcos_test -- files=t/admin-mailingmessage.t TEST_METHOD='(a|b)_.*' bin/arcos_test --files=t/warehouse- loader.t

pausing to look around warn 'pausing to look around; hit return to continue:'; my $PAUSE = ; This will keep the test from cleaning up before you've had a chance to look around. Add a few warns of URL values and you can bring up the reports in a browser to get a better idea of what's going on.

Additional Resources suites-with-testclass.html Organizing Test Suites with Test::Class