Download presentation
Presentation is loading. Please wait.
Published byChristine Ramsey Modified over 9 years ago
1
t-unit: Tcl Unit Test Package Automated Unit Test Package For Tcl Procedures Final Presentation Joseph Boyle Loyola Marymount University
2
2 Introduction Understand how Agile Software practices can be used in a scripting language environment How Agile practices can be applied in an industry that is big on up-front design Create a project that is open source Final Presentation Introduction Updated: 25-Nov-2006
3
Loyola Marymount University3 Related Work Many key players in the Agile movement Kent Beck Extreme Programming Martin Fowler Refactoring, Continuous Integration Andrew Hunt and David Thomas The Pragmatic Programmer Tcl Scripting Language Created by John Ousterhout in early 1980’s at Berkeley Final Presentation Related Work Updated: 25-Nov-2006
4
Loyola Marymount University4 State of Software Development Need to get away from plan-driven approach Can’t see the complexity of the software ahead of time The culture must be ready for change! Start with a vision and a set of principles that defines what needs to be accomplished From these principles we can derive a set of working practices Final Presentation State of SW Development Updated: 25-Nov-2006
5
Loyola Marymount University5 Agile Culture Disciplined in approach and goal focused Responsible for one’s work Leaders that can help others succeed Highly collaborative team that can embrace differences between personalities and roles and strive for success Feel comfortable communicating with the team Keep the product simple to solve only the problem at hand Courage to speak up when things are going bad Final Presentation Agile Culture Updated: 25-Nov-2006
6
Loyola Marymount University6 Agile Principles Continual Refinement Enhances the ability to change with the customer’s needs Working Product at All Times The goal of software developers is to ship software. Keep the software as close as possible to a shipping state. Continual investment in and emphasis on Design Design decisions and changes are made every day by every member of the team Extends the life of the product Value defect prevention over defect detection Prevent defects to save yourself the headaches later on Final Presentation Agile Principles Updated: 25-Nov-2006
7
Loyola Marymount University7 Design and Documentation Keep the design simple Design and code for what is needed today Consider designing reusable software for future projects UML offers a wide variety of tools to document the design Since Tcl is a scripting language, a sequence diagram can typically be used when designing a module Extraction software such as JavaDoc can be useful for documenting software Tcl has its own documentation utility known as AutoDOC Developed by Andreas Kupries in 2001 as an extension to the language Final Presentation Agile Practices Updated: 25-Nov-2006
8
Loyola Marymount University8 The Customer Always have the customer's input when creating software Responsible for the requirements Ability to pick which features are most important, and therefore, should be developed first Final Presentation Agile Practices Updated: 25-Nov-2006
9
Loyola Marymount University9 Coding Conventions Makes the code easy to read, especially if a new team member arrives Ray Johnson of Sun Microsystems created a Tcl style guide for the Tcl programming language Using these coding conventions in conjunction with the AutoDOC utility makes Tcl source code well commented and easy to read Final Presentation Agile Practices Updated: 25-Nov-2006
10
Loyola Marymount University10 Paired Programming Paired programming involves two people sitting at one computer where each person can sit comfortably and work can get done. Keep one another on task Refine the system Come up with ideas When one partner is stuck the other can take over, lowering the stress level Hold each other responsible for following the other practices the team is following Downsides of Paired Programming Watching another person type can be painful Many companies consider paired programming a waste of a resource Final Presentation Agile Practices Updated: 25-Nov-2006
11
Loyola Marymount University11 Code Reviews Code reviews in conjunction with paired programming allow for the whole team to own the code Allow for the team to learn and share ideas about the project There are downsides of code reviews without paired programming Typically logic errors are missed A combination of paired programming and code reviews will lead to better defect prevention Final Presentation Agile Practices Updated: 25-Nov-2006
12
Loyola Marymount University12 Iterative and Incremental Development “Plan a little, do a little, learn a little.” By developing the software incrementally, the software can stay in a releasable state Putting in the most important features first, the software could theoretically be released to the customer if they decide that some of the features initially envisioned are no longer necessary Final Presentation Agile Practices Updated: 25-Nov-2006
13
Loyola Marymount University13 Continuous Integration Frequent integration insures that modules that must fit together will Automate the build with unit tests to detect errors as soon as possible An Ant build can be created for this A single source repository keeps the necessary items for a build together Final Presentation Agile Practices Updated: 25-Nov-2006
14
Loyola Marymount University14 Sample Test Target <!-- < Define the test target (runs the unit tests) Final Presentation Agile Practices Updated: 25-Nov-2006
15
Loyola Marymount University15 Refactoring Refactoring can improve the structure of code without changing its behavior Martin Fowler wrote a whole book on refactoring and offers wide variety of refactorings available Most can only be applied to Object Oriented Languages Sample refactorings for scripting languages: Add a parameter Consolidate Conditional Expression Extract Method Final Presentation Agile Practices Updated: 25-Nov-2006
16
Loyola Marymount University16 Unit Testing Prevents defects from ending up in software Gives confidence that the product is behaving as expected Tcl had two unit test frameworks available: tcltest – does not use the xUnit framework TclTkUnit – does not report results sufficiently “t-unit” was developed to be a better unit test framework for Tcl Final Presentation Agile Practices Updated: 25-Nov-2006
17
Loyola Marymount University17 t-unit Provides an automated unit test framework Modeled after the “JUnit” Java test suite All calls are “asserts”; e.g.: “assertEqual” checks for equal results “assertTrue” checks for result of boolean TRUE...and so on... Final Presentation Agile Practices Updated: 25-Nov-2006
18
t-unit “Class” Diagram Updated: 25-Nov-2006 File Test Suite Report «creates» «examines» Procedure Package Under Test Expression «calls» «input, expected» Test Case + reason: String Test ResultPassFail «result» {complete, discrete} Package t-unit t-unit::assertXXXX «abstract» t-unit::testHarness «calls» t-unit::assertEquals t-unit::assertEqualsReal t-unit::assertEqualsList t-unit::assertEqualsArrayt-unit::assertNotEquals t-unit::assertFalse t-unit::assertTrue «test function» «reads» «writes» user «runs»
19
Loyola Marymount University19 Sample Test Case TUnit Process Model Test Case File Description Updated: 27-Oct-2006 t-unit::assertEquals12.3412.34| PASS | OK t-unit::assertEquals"hello“"hello”| PASS | OK t-unit::assertEquals"hello“"world“| FAIL | NOT_EQUAL t-unit::assertEquals2 2| PASS | OK t-unit::assertEquals23| FAIL | NOT_EQUAL t-unit::assertEquals1234512345| PASS | OK t-unit::assertEquals1234512345.0| FAIL | ARG_MISMATCH t-unit::assertEqualsTRUETRUE| PASS | OK t-unit::assertNotEqualsTRUEFALSE| PASS | OK t-unit::assertNotEquals“hello”“world”| PASS | OK t-unit::assertEqualsList{1 2 3}{1 2 3}| PASS | OK t-unit::assertEqualsArrayA1A2| PASS | OK t-unit::assertEquals [samplePackage::addOne 1] 2 | PASS | OK Usage notes: 1.Vertical bars required as shown 2.Whitespace required as shown 3.Optional third parameter (not shown) allows tailoring of response message for each assertion 4.Either parameter (or both parameters) may be a Tcl “list” data type List can contain a procedure name and its arguments Allows testing of procedures, not just values (real strength of this package) Enclose lists in curly braces within test file, or define globally prior to running t-unit (may be defined as part of automated test suite) List may comprise a procedure and its argument list Final Presentation Test Case File Description Updated: 25-Nov-2006
20
Loyola Marymount University20 Use Available Tools A wide variety of tools at our disposal Text editors that offer syntax highlighting Office suites for presentations and UML documents Configuration Management (CM) System Keep track of every change in source code and documentation Allows for continuous integration to be seamless Subversion, CVS Eclipse Open Development Platform Text editor Build and unit testing Integrated GUI for CM Final Presentation Agile Practices Updated: 25-Nov-2006
21
Loyola Marymount University21 TUnit TUnit is a plug-in for the Eclipse IDE. TUnit makes use of the t-unit package that was developed for the Tcl programming language. Features: Tcl Perspective Tcl Project Wizard – creates tcl projects with t-unit included Tcl Package Creator – creates packages within the project Tcl File Creator – creates tcl files with AutoDOC comments in place Tcl File Editor – allows for syntax highlighting, auto indentation, and content assistance (i.e. completion of commands) Preferences menu Namespace Explorer – lists packages and files within each package; can be used to verify that Tcl coding standards are being followed Execution of t-unit scripts A set of unit tests is also available to test the TUnit plug-in Demonstration Final Presentation Agile Practices Updated: 25-Nov-2006
22
Loyola Marymount University22 TUnit Extension The Eclipse Dynamic Languages Toolkit (DLTK) project was created to develop a framework for tool vendors, researchers, and end-users who rely on dynamic languages such as Tcl Xored Software Inc. was behind the plug-in and they are developing the project in Russia Eclipse DLTK did not include a unit test framework as part of the plug-in TUnit extension was born Offered to create this part of the plug-in using the t-unit package Demonstration Final Presentation Agile Practices Updated: 25-Nov-2006
23
Loyola Marymount University23 Future Research Over time, more practices will be added to Agile to make the development process even more seamless The future of TUnit and the TUnit extension is still up in the air TUnit has been released as version 1.0.0 No bugs reported to date via the Google Code repository TUnit extension could see additional revisions The Eclipse DLTK project is interested in adding the tcltest framework to the TUnit extension Code is written to do this fairly easily Looking at a date in January 2007 Final Presentation Future Research Updated: 25-Nov-2006
24
Loyola Marymount University24 Conclusions Agile is not going away but getting stronger More and more it is being accepted as a valid process for creating software Not all the practices need to be followed: come up with a set that fits the team’s needs Final Presentation Future Research Updated: 25-Nov-2006
25
Loyola Marymount University25 Source Code TUnit has a homepage at: http://tunitplugin.googlepages.comhttp://tunitplugin.googlepages.com Project can be downloaded from here along with documentation and screenshots Source code repository for the paper, this presentation, TUnit and the TUnit unit tests at: http://code.google.com/p/t-unit/http://code.google.com/p/t-unit/ Eclipse DLTK considering putting the extension of TUnit in their next milestone release The source code is located in Loyola Marymount’s CVS for now but could move into the Eclipse DLTK repository next year Could not use the Google repository because the Eclipse Public License is not available Can also download the project at the TUnit homepage Final Presentation Future Research Updated: 25-Nov-2006
26
Loyola Marymount University26 Questions or Comments
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.