Auto-tools/Projects/Robocop: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Added Example)
(→‎Setup: Updated Flow.)
Line 5: Line 5:
= Setup  =
= Setup  =


Look at [https://bugzilla.mozilla.org/show_bug.cgi?id=701076 [this bug]] for more information on how to set it up. One or two patches from the birch tree and you should be good to go.  
Look at [https://bugzilla.mozilla.org/show_bug.cgi?id=701076 [this bug]] for more information on how to set it up. One or two patches and you should be good to go.  


adb install dist/fennec-robocop.apk will install the robocop-able version of fennec
make -f client.mk
 
cd objdir
adb install dist/test-package-stage/bin/robocop.apk will install robocop
make package
 
adb install dist/fennec-robocop.apk
adb shell am instrument -w org.mozilla.roboexample.test/android.test.InstrumentationRunner runs the test.
make package-tests
export TEST_DEVICE = 1.2.3.4
export MOZ_HOST_BIN=~/objdir/dist/bin
make mochitest-robotium


= Frequently found Errors  =
= Frequently found Errors  =

Revision as of 17:46, 8 December 2011

Problem

With advent of NativeFennec, a new framework was needed to test the UI of the Mobile Browser. Robotium was identified as a useful framework to take advantage of, but is not complete. Robocop incorporates all of Activity, Instrumentation, and Robotium Classes to inject events into the new Java front-end of Fennec.

Setup

Look at [this bug] for more information on how to set it up. One or two patches and you should be good to go.

make -f client.mk cd objdir make package adb install dist/fennec-robocop.apk make package-tests export TEST_DEVICE = 1.2.3.4 export MOZ_HOST_BIN=~/objdir/dist/bin make mochitest-robotium

Frequently found Errors

OOM Error. This is an error found after use of Robocop frequently, but once it has happened, Fennec itself continues to crash. To fix it, simply uninstall and reinstall. This does not occur of frequent use of Robocop, as I have run 30 iterations of just robocop without it throwing this error.

InvocationTargetException Error. This is an issue arising when using a Tegra.It looks like the following:

W/System.err( 2610): java.lang.reflect.InvocationTargetException
W/System.err( 2610): at org.mozilla.gecko.GeckoAppShell.unregisterGeckoEventListener(GeckoAppShell.java:1565)
W/System.err( 2610): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 2610): at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err( 2610): at org.mozilla.fennec_tfairey.ExampleTest.waitForEvent(ExampleTest.java:204)
W/System.err( 2610): at org.mozilla.fennec_tfairey.ExampleTest.waitForFennecContent(ExampleTest.java:215)
W/System.err( 2610): at org.mozilla.fennec_tfairey.ExampleTest.testTPAN(ExampleTest.java:131)
I/Gecko ( 2610): leaving void mozilla::AndroidBridge::HandleGeckoMessage(const nsAString_internal&, nsAString_internal&)
W/System.err( 2610): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 2610): at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err( 2610): at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:204)
W/System.err( 2610): at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:194)
W/System.err( 2610): at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:186)
W/System.err( 2610): at junit.framework.TestCase.runBare(TestCase.java:127)
W/System.err( 2610): at junit.framework.TestResult$1.protect(TestResult.java:106)
W/System.err( 2610): at junit.framework.TestResult.runProtected(TestResult.java:124)
W/System.err( 2610): at junit.framework.TestResult.run(TestResult.java:109)
W/System.err( 2610): at junit.framework.TestCase.run(TestCase.java:118)
W/System.err( 2610): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
W/System.err( 2610): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
W/System.err( 2610): at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)
W/System.err( 2610): at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
W/System.err( 2610): Caused by: java.lang.NullPointerException: null result when primitive expected
W/System.err( 2610): at $Proxy0.equals(Native Method)
W/System.err( 2610): at java.util.ArrayList.remove(ArrayList.java:421)
W/System.err( 2610): ... 20 more
I/Gecko ( 2610): void mozilla::AndroidBridge::HandleGeckoMessage(const nsAString_internal&, nsAString_internal&)

Notes

  • We are using [NativeUI Messages] to talk between Robocop and gecko
  • There has been interest in using a record/replay tool similar to [testdroid]. Most likely this will allow for people to record something and then we can hand edit it into a proper test case.
  • adb shell am instrument -w org.mozilla.roboexample.test/android.test.InstrumentationTestRunner