Published on January 15, 2009
TDD & UNIT TESTING RAIN Internal Training Presented by: Chase Brammer Training Date: 1/14/2009
RIA DEVELOPMENT CYCLE
PHASES OF TESTING Unit: Testing individual bits of ActionScript. Such as individual classes or methods. Integration: Testing how your app is actually wired together. Such as-- do the right events trigger the right commands? Acceptance: Testing the whole app. Including how it behaves in a realistic deployment environment. Usability: Testing the flow of human interactions with the application.
“ The fact of the matter is, not only is Adobe Consulting leveraging FlexUnit each and every day on our projects, but we continue to be advocates to our customers of using FlexUnit on their projects.” Steven Webster Adobe Consulting cairngorm framework core contributor "It's about figuring out what you are trying to do before you run off to try to do it. You write a specification that nails down a small aspect of behavior in a concise, unambiguous, and executable form. It's that simple. Does that mean you write tests? No. It means you write specifications of what your code will have to do. It means you specify the behavior of your code ahead of time. But not far ahead of time. In fact, just before you write the code is best because that's when you have as much information at hand as you will up to that point." WHO, WHAT AND WHY
“ The fact of the matter is, not only is Adobe Consulting leveraging FlexUnit each and every day on our projects, but we continue to be advocates to our customers of using FlexUnit on their projects.”
cairngorm framework core contributor
Testing is like source control. You don't know how much you need until you start using it. WHO, WHAT AND WHY
HOW IT CAN HELP US (because we are way better than 2advanced) Faster overall development Less expensive (development and maintenance cycles) Less complicated code bases More independent and reusable code Less time and problems with regression testing Break new ground 1 | 2 | 3 | 4 | 5 | 6 | HOW WILL HURT US/PROBLEMS Developer learning curve Slower initial development speed Problems with a MVC type framework (Nimbus, Cairngorm, PureMVC) Poor Documentation 1 | 2 | 3 | 4 |
Yes I and many others within AC use TDD. I understand your frustration with the lack of information out there. I've talked at the last MAX conference about it and AFAIK this will be on Adobe TV soon. I'll ask when exactly. Also, I plan on publishing a lot more around this area. Best, Alex Alex Uhlmann Senior Consultant (Rich Internet Applications) Adobe Consulting POOR DOCUMENTATION
TEST DRIVEN DEVELOPMENT (TDD) Add a test Run tests, see if new one fails Write some code Run tests, watch them succeed Re-factor Repeat 1 | 2 | 3 | 4 | 5 | 6 | TDD Cycle Test-driven development (TDD), a concept of Extreme Programming, is a technique that uses short development iterations based on pre-written test cases that define desired improvements or new functions. We all sit down and write a piece of code in context, and even if we can sit down and fix that code, it is very difficult to see the relations of that piece of code with the rest of the application. Especially when working with large teams and projects.
KEY CONCEPTS Write tests firsts to develop expectations A good unit test exercises a single method Decoupled code Program to interfaces Every bug should have a unit test that exercises it before fixing it. | | | | |
TERMS Assertion: An assertion is a statement of expected outcome. In other words, it is the expected result of your test. Test Fixture: Things that are constant across all of your tests. setUp() and tearDown() functions. Test Case: A test case is the smallest unit of testing. It checks for a specific response to a particular set of inputs. Extends TestCase. Test Suite: A grouping of test cases. May contain test cases and other test suites. Test Runner: A test runner is a component that often has a graphical interface and displays the outcome of our tests.
KEY CONCEPTS Lets get into the code!
USEFUL LINKS Unit Testing with FlexUnit - InsideRIA Adobe - Developer Center : Unit testing and Test Driven Development (TDD) for Flex and ActionScript 3.0 Steven Webster: Unit Testing and Test Coverage with Flex Flex unit testing and continuous integration: Part 1 of 2 The Flex Show: Flex Show Episode 64: Interview with Michael labriola about Fluint Unit Testing Commands - Part 2 - Mocking Command Dependencies | Allen Manning SettingExpectations - mock-as3 - Google Code - Demonstrates the various expectations that can be set. Continuous integration - Wikipedia, the free encyclopedia Leif Wells: RIA Evangelist: 10 Questions About FlexUnit and Cairngorm Flex cookbook beta - Automated TestSuite Generation Flex cookbook beta - Testing Visual Components with FlexUnit Unit testing - Wikipedia, the free encyclopedia Google Testing Blog: TotT: Use EasyMock Daniel R.: Asynchronous Testing with FlexUnit Cairngorm | Allen Manning Tom Sugden: EventfulTestCase: a FlexUnit extension for testing event dispatching Using mock objects for complex unit tests joeberkovitz.com » Moment of Weakness: Weak Event Listeners Can Be Dangerous
You can do unit testing without doing test driven development. ... TDD and Unit Testing are two very specific terms which often get misused.
Test-driven development (TDD) ... instead it defines a proven way to ensure effective unit testing. A side effect of TDD is that the resulting tests are ...
Some think you must use the “xUnit style” testing tools to use the TDD process. This is not the case – TDD works great with unit tests, but you can ...
Test-driven development (TDD) ... This step increases the developer's confidence that the unit test is testing the correct constraint, ...
Stephen, your out of context quote doesn’t actually support the entire set of ideas that Martin is describing in that interview. “Testing each class ...
Unit testing is a technique for testing code modules (units) on a standalone basis. The tests can be manual or automated, and can be created before the ...
This conversation began as a consequence to David’s RailsConf keynote where he expressed his unhappiness with TDD and Unit Testing in the Rails community.
Lots of videos about TDD and Unit Testing, and the official site for the book
TDD Training. Train The Trainer. Home. Kata. TDD Kata 1. ... Video: Unit Testing and TDD – Why You Should Care and How to Make It Happen. Wednesday, ...
In computer programming, unit testing is a software testing method by which individual units of source code, sets of one or more computer program modules ...