dwhipple99 / caldav4j

Automatically exported from code.google.com/p/caldav4j
0 stars 0 forks source link

Fix tests #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
There's a whole number of problems with the current tests.  They need to be 
stabilised before anyone can confidently contribute to the codebase.

Initial problems:

1) Some tests fail under Java5 as they assume a DOM Level 3 implementation is 
available

2) Mixed JUnit3 & 4 syntax in tests causing some tests to fail or be ignored

3) Some tests are missing a default constructor

4) Misnamed tests that are ignored by Maven

5) Confusing test resource configuration

6) Too much noise in the test console output; mainly debug log messages, some 
System.outs

Original issue reported on code.google.com by markhob...@gmail.com on 16 Feb 2011 at 4:39

GoogleCodeExporter commented 8 years ago
Attached patch starts to address these problems respectively by:

1) Upgrading Xerces to 2.9.1 that supports DOM 3
2) Adding missing JUnit4 annotations
3) Adding default constructors to tests
4) Renaming tests to *Test
5) Removing testResources block from pom.xml and adjusted resource paths in 
tests accordingly; corrected location of messages.properties files
6) Commenting out debug log level configuration and System.outs

After applying this patch I get the following on Java 5 & 6:

Failed tests:
  queryPartialCalendar(org.osaf.caldav4j.CalDAVCollectionTest)
  testNewPropfind(org.osaf.caldav4j.methods.PropFindTest)
  testGetCalendar(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testGetCalendarByPath(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testGetEventResources(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testMakeTicket(org.osaf.caldav4j.methods.TicketTest)
  testUsingTicket(org.osaf.caldav4j.methods.TicketTest)
  testAddRemoveCalendarResource(org.osaf.caldav4j.google.methods.GooglePutGetTest)
  testGetCalendarByPath(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testGetEventResources(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testAddNewRemove(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)

Tests in error:
  testRequestReplyAccept(org.osaf.caldav4j.scheduling.util.ITipUtilsTest)
  testRequestReplyDeclined(org.osaf.caldav4j.scheduling.util.ITipUtilsTest)
  testRequestReplyDelegated(org.osaf.caldav4j.scheduling.util.ITipUtilsTest)
  testUpdateEvent(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testCacheGetsHit(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testTicket(org.osaf.caldav4j.CalDAVCalendarCollectionTest)
  testGetCalendar(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testUpdateEvent(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testMultigetCalendar(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testTicket(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)

Tests run: 88, Failures: 11, Errors: 10, Skipped: 10

I'm not sure if some of these broken tests should be @Ignore'd or not.

Original comment by markhob...@gmail.com on 16 Feb 2011 at 4:39

Attachments:

GoogleCodeExporter commented 8 years ago
I'm applying your patch with some slight modifications.

A question: do you run your tests in Eclipse?

Peace,
R:

Original comment by robipo...@gmail.com on 17 Feb 2011 at 10:34

GoogleCodeExporter commented 8 years ago
I just applied many of your patches. I'd like to understand the 5th point:

 5) Removing testResources block from pom.xml and adjusted resource paths in tests accordingly; corrected location of messages.properties files

Why did you need to remove the resources?

Thank you + Peace,
R.

Original comment by robipo...@gmail.com on 17 Feb 2011 at 11:15

GoogleCodeExporter commented 8 years ago
Hi, I run tests both using Maven command line and Eclipse IDE.  They weren't 
running the same number of tests due to the JUnit3/4 discrepancies and naming 
convention mismatches.

Point (5) encompassed two changes.  Firstly, I removed the explicit 
testResources block from pom.xml since it only brought through ehcache.xml, 
log4j.xml and icalendar/*.ics from src/test/resources.  Removing it means that 
the default of src/test/resources/**/* is used, thus bringing in the previous 
test resources and all the others.  This has the consequence that the 
icalendar/*.ics test resources now reside at this path, rather than being 
mapped to *.ics as before.

Secondly, I moved the messages*.properties from src/test/java to 
src/test/resources.  This is because src/test/java is only meant to contain 
Java files, where src/test/resources is to be used for resource files.  
Previously they were being ignored and hence failing some tests.  In their new 
location they are now available to the tests at runtime.  For more info 
regarding Maven's directory layout see:

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directo
ry-layout.html

Original comment by markhob...@gmail.com on 17 Feb 2011 at 12:59

GoogleCodeExporter commented 8 years ago
Attached new patch against r272 for remaining changes.

Original comment by markhob...@gmail.com on 17 Feb 2011 at 4:22

Attachments:

GoogleCodeExporter commented 8 years ago
Ok, at this time we can close this ticket.

just one note:

I prefer setting the log level instead of commenting the block.
so do:
-     <level value="TRACE"/>
+     <level value="INFO"/>

instead of
-  <logger name="org.osaf">
+  <!--<logger name="org.osaf">
     <level value="TRACE"/>
-  </logger>
-  <logger name="httpclient.wire">
+  </logger>-->
+  <!--<logger name="httpclient.wire">
     <level value="DEBUG"/>
-  </logger>
+  </logger>-->

Thx again + Peace,
R.

Original comment by robipo...@gmail.com on 17 Feb 2011 at 5:51

GoogleCodeExporter commented 8 years ago
Current state of tests:

Failed tests:
  queryPartialCalendar(org.osaf.caldav4j.CalDAVCollectionTest)
  testNewPropfind(org.osaf.caldav4j.methods.PropFindTest)
  testGetCalendar(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testGetCalendarByPath(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testGetEventResources(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testMakeTicket(org.osaf.caldav4j.methods.TicketTest)
  testUsingTicket(org.osaf.caldav4j.methods.TicketTest)
  testAddRemoveCalendarResource(org.osaf.caldav4j.google.methods.GooglePutGetTest)
  testGetCalendarByPath(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testGetEventResources(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testAddNewRemove(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)

Tests in error:
  testRequestReplyAccept(org.osaf.caldav4j.scheduling.util.ITipUtilsTest)
  testRequestReplyDeclined(org.osaf.caldav4j.scheduling.util.ITipUtilsTest)
  testRequestReplyDelegated(org.osaf.caldav4j.scheduling.util.ITipUtilsTest)
  testRealTimeScheduling_SimpleMeetingReply(org.osaf.caldav4j.scheduling.SchedulePostMethodTest)
  testUpdateEvent(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testCacheGetsHit(org.osaf.caldav4j.CalDAVCalendarCollectionWithCacheTest)
  testTicket(org.osaf.caldav4j.CalDAVCalendarCollectionTest)
  testGetCalendar(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testUpdateEvent(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)
  testMultigetCalendar(org.osaf.caldav4j.google.GCalDAVCalendarCollectionTest)

Tests run: 89, Failures: 11, Errors: 10, Skipped: 17

Original comment by markhob...@gmail.com on 18 Feb 2011 at 10:33

GoogleCodeExporter commented 8 years ago
 1- queryPartialCalendar should work
 2- we can mark the ticket tests unsupported. if you need that feature try to fix it
 3- I'll look at the Cache tests: they should work.
 4- the scheduling tests are work in progress but I'd like to let them work

Original comment by robipo...@gmail.com on 18 Feb 2011 at 10:39

GoogleCodeExporter commented 8 years ago
Tests stabilised:

Tests run: 76, Failures: 0, Errors: 0, Skipped: 20

Fixed where possible and ignored and issues raised for ones that need further 
investigation.

Original comment by markhob...@gmail.com on 18 Feb 2011 at 2:14