Search

Aparna Chaudhary Blog

My Blog about Java, and Open Source

Month

December 2008

Getting Started with FlexUnit and Maven

flex1Today I created my first unit tests for Flex code using FlexUnit. Later I integrated the tests with the maven build using Flex Mojos. Flex-Mojos is a collection of maven-plugins created to work with Flex.

We have to use the Flex Compiler Plugin. This plugin is basically used to compile the source files and run tests. This plugin has 5 goals which are bound to different maven lifecycles. I chose to explicitly specify goals that I want maven to run. Maven has a default value for testSourceDirectory as src/test/java. For using Flex mojos, we have to specify testSourceDirectory as src/test/flex. Make sure all your tests are created under this directory.

	<build>
		<sourceDirectory>src/main/flex</sourceDirectory>
		<testSourceDirectory>src/test/flex</testSourceDirectory>
	        <plugins>
		    <plugin>
			<groupId>info.flex-mojos</groupId>
			<artifactId>flex-compiler-mojo</artifactId>
			<version>${flex-mojos.version}</version>
			<extensions>true</extensions>
			<executions>
			    <execution>
				<goals>
				    <goal>compile-swf</goal>
				    <goal>test-compile</goal>
				    <goal>test-run</goal>
				</goals>
			    </execution>
			</executions>
			<configuration>
			    <locales>
				<param>en_US</param>
			    </locales>
			    <contextRoot>/</contextRoot>
			</configuration>
		    </plugin>
  		</plugins>
	</build>

Next thing is to add Flex Unit dependency in the dependency section.

	<dependencies>
		<dependency>
			<groupId>flexunit</groupId>
			<artifactId>flexunit</artifactId>
			<version>0.85</version>
			<type>swc</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>flexunit.junit</groupId>
			<artifactId>flexunit-optional</artifactId>
			<version>0.85</version>
			<type>swc</type>
			<scope>test</scope>
		</dependency>
	</dependencies>

You would also need flash player installed on the build server. In case if you end up with OutOfMemory error, increase the heap size using MAVEN_OPTS in mvn.bat file.

SET MAVEN_OPTS=-Xmx128m

If you need more help, you can always refer the FlexUnit Example.

Planning Poker

Are you ever involved in project estimations? Did you ever enjoy this task? I sure know the answer is big NO. This is because at the planning phase of the project there are lot of unknowns. Some members of the team are given the sheet to bring out those magic numbers. Its tough to get the realistic figure this way.

Planning Poker Deck
Planning Poker Deck

Planning Poker is the answer to some of the problems. Planning Poker is a team estimation meeting. So all members of the team i.e. developers, testers, project manager are present for the meeting. Each member is given a deck of 13 cards. You can see the cards have Fibonacci sequence on it. Whenever a story is to be estimated, each member selects a card from his/her deck that represents the weight of the story and places it face-down on the table. The weight is the unit of amount of work to be done for the story. When all team members are done, the cards on the table are revealed simultaneously. So this technique makes sure that the estimates are not leaned on team’ estimates (really?).

It is very likely at this point that the estimates will differ significantly. If estimates differ, the high and low estimators explain their estimates. This is a good practice as you get to know different views of the team members on a story, and catch some point you might have missed.

I’m using this story point estimation technique in my current project. We have a small team of 5, its working quite well. But I personally feel that there should be different meeting set for developers to come up with CUT i.e. Construcion and Unit Testing efforts and one for testers to get the System Testing, Integration Testing and Acceptance Testing efforts.

So get ready to play poker at work :-) !!

Create a free website or blog at WordPress.com.

Up ↑