harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Wilson <jessewil...@google.com>
Subject FYI: I'm dividing up some test cases
Date Fri, 07 Jan 2011 03:28:57 GMT
Harmony folks,

Here on Android, we've been running Harmony's test suite on our devices. The
extensive test suite includes many large test methods that exercise many
behaviors. For example, consider this test method from
StringBuffer2Test.java:

 public void test_insertI$CII() { // Test for method java.lang.StringBuffer
// java.lang.StringBuffer.insert(int, char [], int, int) char[] c = new
char[]{'n', 'o', 't', ' '}; testBuffer.insert(8, c, 0, 4);
assertEquals("This is not a test buffer", testBuffer.toString());
StringBuffer buf1 = new StringBuffer("abcd"); try { buf1.insert(-1, (char[])
null, 0, 0); fail("Should throw StringIndexOutOfBoundsException"); } catch
(StringIndexOutOfBoundsException e) { //expected } try {
testBuffer.insert(testBuffer.length() - 1, c, -1, 1); } catch
(StringIndexOutOfBoundsException e) { //expected } }
This tests that the behavior of insert() is consistent with the spec. But it
also tests which exception is thrown when multiple arguments are incorrect.
That behavior is not specified, but Harmony tests it to ensure that
implementation behaviors are consistent with those in the RI.

I'd like to split this into two test methods. We Androids want to pass every
test for behavior that's specified. But we're not as concerned with
implementation details like exception priority. Splitting it into two tests
makes it possible for us to manage the most important tests.

For another example, InetAddressTest.test_getAllByNameLjava_lang_String()
covers null handling, security managers, and IPv4 vs. IPv6 addresses. For
this test I'd like to move the SecurityManager testing to a separate method.

I'm planning on starting into this work beginning on Monday the 9th. If
you'd rather I didn't, please let me know!

Cheers,
Jesse from Android

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message