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.
<ul><li>“ 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.” </li></ul><ul><ul><ul><li>Steven Webster </li></ul></ul></ul><ul><ul><ul><li>Adobe Consulting </li></ul></ul></ul><ul><ul><ul><li>cairngorm framework core contributor </li></ul></ul></ul><ul><li> </li></ul>"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
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.
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