Download presentation
Presentation is loading. Please wait.
Published byAudrey Gibbs Modified over 8 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 Develop a unit test framework for Tcl and a plug-in for Eclipse to have a central location to develop Tcl projects Create a project that is open source Final Presentation Introduction Updated: 04-Dec-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 Not 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 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
6
Loyola Marymount University6 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
7
Loyola Marymount University7 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
8
Loyola Marymount University8 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
9
Loyola Marymount University9 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 Dr. Laurie Williams of North Carolina State University has shown that paired programmers are only 15% slower than two independent individual programmers, but produce 15% fewer bugs. - The Economist Final Presentation Agile Practices Updated: 04-Dec-2006
10
Loyola Marymount University10 Paired Programming 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: 04-Dec-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 accurately can not test Tcl lists and Tcl arrays “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 Final Presentation Test Case File Description Updated: 04-Dec-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 Tcl Package Creator Tcl File Creator Tcl File Editor Preferences menu Namespace Explorer Execution of t-unit scripts A set of unit tests is also available to test the TUnit plug-in Final Presentation Agile Practices Updated: 25-Nov-2006
22
Loyola Marymount University22 Demonstration Final Presentation Demonstration Updated: 04-Dec-2006
23
Loyola Marymount University23 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 Final Presentation Agile Practices Updated: 25-Nov-2006
24
Loyola Marymount University24 Demonstration Final Presentation Demonstration Updated: 04-Dec-2006
25
Loyola Marymount University25 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
26
Loyola Marymount University26 Acknowledgements I would like to thank the many people who inspired and assisted me for the past couple of years. The LMU faculty for acting as a guide Especially Dr. Dionisio for dealing with me every semester I have been here BJ Johnson for the idea to create t-unit and the TUnit plug-in And my classmates for always bringing my ego back to earth Final Presentation Ackowledgements Updated: 04-Dec-2006
27
Loyola Marymount University27 Conclusions Agile makes development easier Design and develop for today Self testing code Automate the process as much as possible Keep the customer in the loop Not all the practices need to be followed: come up with a set that fits the team’s needs Perhaps start with unit testing t-unit and the TUnit plug-ins are being used by other Tcl developers today Recently helped a user setup their development environment Final Presentation Future Research Updated: 25-Nov-2006
28
Loyola Marymount University28 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
29
Loyola Marymount University29 Questions? Final Presentation Questions? Updated: 04-Dec-2006
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.