Android Performance Testing II

Posted: August 10, 2009 in Android, Java
Tags:

As I stated in a previous post, you would use the Monkey UI testing framework with a hprof setting to ge the overall picture and than focus using a PerformanceTestCase class to focus in on problem areas. The Monkey UI ANT target looks like this:

	<target name="tests.monkey" depends="reinstall" description="tests money">

									    <exec executable="${adb}">
									    <arg value="shell" />
									    <arg value="am" />
									    <arg value="monkey" />
									    <arg value="-p" />
									    <arg value="$&#91;application-package}" />
									    <arg value="-v"/>
									    <arg value="600"/>
									    <arg value="--hprof" />
									    </exec>
				        </target>

And of course your performance testing target looks like this:

<target name="tests.performance" depends="reinstall" description="tests perforrmance">
								    <echo>Building and installing tests..</echo>
								    <exec executable="ant" failonerror="true">
								        <arg value="-f" />
								        <arg value="tests/build.xml" />
								        <arg value="reinstall"/>
								    </exec>
								    <mkdir dir="${basedir}/log" />
								    <exec executable="${adb}">
								    <arg value="shell" />
								    <arg value="am" />
								    <arg value="instrument" />
								    <arg value="-w" />
								    <arg value="-e" />
								    <arg value="perf"/>
								    <arg value="true"/>
								    <arg value="${application-package}.tests/android.test.InstrumentationTestRunner" />
								    </exec>
			        </target>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s