6/02/2012

Android CTS Datetime error

Question: When running CTS, we see the following error in android.text package. How do we work around this?

cts_host > start --plan CTS -t
android.text.format.cts.DateUtilsTest#testFormatMethods
cts_host > start test android.text.format.cts.DateUtilsTest#testFormatMethods
==============================================================
Test package: android.text
android.text.format.cts.DateUtilsTest#testFormatMethods...(fail)
junit.framework.ComparisonFailure: expected:<...> but was:<..., 2009> at
android.text.format.cts.DateUtilsTest.testFormatMethods(DateUtilsTest.java:238)
at
android.text.format.cts.DateUtilsTest.testFormatMethods(DateUtilsTest.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:164)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:151)
at
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:425)
at
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1520)
at
android.text.format.cts.DateUtilsTest.testFormatMethods(DateUtilsTest.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:164)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:151)
at
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:425)
at
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1520)

Answer:
If you set the phone system time to 2009 year, this test will be passed. Note that Android is continuously improving CTS framework. This issue may be fixed in the future.

No comments:

Post a Comment