Last modified 16 years ago
Last modified on 06/27/09 13:11:14
Analysis
Overview
Automatic tests need to be improved. Latest Hudson build reports 288 test failures out of 962 tests.
Task requirements
- Revise the current unit tests
- Remove any useless test cases (for more, see implementation idea).
- Make as much as possible tests / demos to work. This includes improving the source if tests report problems.
- Writing new tests is not required for this revision, since it is too much effort.
Task result
Removed useless tests, others - passing.
Implementation idea
- Read about how to write good unit tests, PLATFORM_STANDARDS_AUTO_TESTS for documented convensions for testing and "Code smells" in the internal backlog. Look also at the available demos.
- Describe what needs to be removed, what will be repaired and what tests need to be written during the next revision.
- Use FakeModuleRegistry where you need to use extension points.
Related
How to demo
Run all the available tests (through Eclipse, right click sophie2-platform, run as.., maven test).
Design
- While refactoring tests, look for the following things:
- Each test must have setUp() and tearDown methods, containing at least super.setUp() and super.tearDown().
- Tests should be UnitTestBase or IntegrationTestBase
- All resources needed for tests should be placed in the /src/test/resources folder of the module where the test is in
- Remove testing of obvious things
- Repair fake JavaDoc
- Where ither modules are needed, use FakeModuleRegistry.start(). In this case, make the class extend IntegrationTestBase. Look specifically at the modules ewhich have to be started, this is a common mistake.
- Take care for "TODO: refactor" things.
- Remove "fail('not implemented')" methods.
- Refactor any "try{fail();} catch(Throwable){}" statements, since they are useless: if expected Exception, change to catch(Exception); If expected AssertionError, change to catch(Throwable){if (e instanceof AssertionFailedError) fail();} Fix the errors that will appear after refactoring them.
- Either refactor commented tests, or delete them.
- Look for the correct place of each test - if incorrect, fix it.
- Fix the assertEquals and assertSame arguments: first should be expected, then actual.
- Here is a list of the current modules and what has to be changed there :
org.sophie2.base.bound | refactor |
org.sophie2.base.commons | refactor |
org.sophie2.base.connectivity | nothing - no tests |
org.sophie2.base.dialogs | DialogManagerTest must be DialogManagerDemo, it should run |
org.sophie2.base.halos | refactor |
org.sophie2.base.layout | BaseLayoutDemo is actualy a test; needs to refactor |
org.sophie2.base.media | nothing - no tests |
org.sophie2.base.menus | refactor |
org.sophie2.base.model.book | thoroughly refactor/delete GroupTest, review the others. |
org.sophie2.base.model.resources | nothing - OK |
org.sophie2.base.model.text | nothing - the demo is OK |
org.sophie2.base.persistence | many try-catch mistakes, refactor |
org.sophie2.base.scene | Delete SceneTest2, revire the demo. |
org.sophie2.base.skins | nothing - no tests |
org.sophie2.base.visual | nothing - OK |
org.sophie2.core | refactor |
org.sophie2.core.modularity | review - add super.setUp() to setUp methods |
org.sophie2.core.mvc | review - Decide whether no view should not be handled (TestDemo2) |
org.sophie2.extra.func.annotations | nothing - OK |
org.sophie2.extra.func.embedded | nothing - no tests |
org.sophie2.extra.func.pdf | nothig - OK |
org.sophie2.extra.func.print | nothing - no tests |
org.sophie2.main.app.commons | rename AppViewUnitTest to AppViewTest, make it an integration test. Thoroughly refactor BookViewUnitTest. Move AudioContentViewTest and VideoContentViewTest to org.sophie2.main.func.media, refactor ContentViewTest, review FrameAddUndoViewTest, fix "catch(Throwable e)" statements, remove any "fail('not implemented')" methods. |
org.sophie2.main.app.halos | nothing - no tests |
org.sophie2.main.app.layout | nothing - no tests |
org.sophie2.main.app.menus | Make WindowMenuTest integration, decide whether to delete it. Refactor FileMenuTest, move SystemTestBase to org.sophie2.main.app.commons/src/main.java |
org.sophie2.main.app.model | Move BackgroundStyleUnitTest, BorderStyleUnitTest, FrameAddUndoTest and FrameUnitTest to org.sophie2.base.model.book, refactor them. Remove BookLegacyTest, review the rest. |
org.sophie2.main.dialogs.input | nothing - no tests |
org.sophie2.main.func.config | nothing - no tests |
org.sophie2.main.func.file | nothing - no tests |
org.sophie2.main.func.help | nothing - no tests |
org.sophie2.main.func.image | refactor |
org.sophie2.main.func.links | nothing - OK |
org.sophie2.main.func.media | nothing - no tests |
org.sophie2.main.func.resources | nothing - no tests |
org.sophie2.main.func.servers | nothing - no tests |
org.sophie2.main.layout.mydoggy | rename MyDoggyLayoutDemo to test, since it is not a demo. Make it integration test, add the needed modules and refactor the failing cases. |
org.sophie2.main.layout.vldocking | thoroughly refactor |
org.sophie2.main.media.fobs | delete all |
org.sophie2.main.persistence.r1 | refactor (or delete) |
org.sophie2.main.persistence.r2 | nothing - no tests |
org.sophie2.main.scene.jogl | nothing - no tests |
org.sophie2.main.scene.simple | nothing - OK |
org.sophie2.main.skin.alternative | nothing - no tests |
org.sophie2.main.ws_connector | nothing - no tests |
org.sophie2.server | add setUp() and tearDown() methods, review |
org.sophie2.server.connector | add setUp() and tearDown() methods, review. |
org.sophie2.server.persistence | Remove default values of type "new Date()", add setUp() and tearDown() methods. |
Implementation
org.sophie2.base.bound | done [2404], [2459] |
org.sophie2.base.commons | done [2405] |
org.sophie2.base.dialogs | nothing has been done |
org.sophie2.base.halos | [2469]: not all tests pass yet. |
org.sophie2.base.layout | [2467] |
org.sophie2.base.menus | nothing has been done |
org.sophie2.base.model.book | [2472], GroupTest seems to be failing only on my computer, so it was not deleted. |
org.sophie2.base.persistence | [2473], still a lot tests do not pass. |
org.sophie2.base.scene | [2475] The demo actually shows just 2 lines of text, maybe it doesn't work. |
org.sophie2.core | nothing has been done |
org.sophie2.core.modularity | [2476] |
org.sophie2.core.mvc | nothing has been done. |
org.sophie2.main.app.commons | [2491] Did not have time to refactor BookViewUnitTest and AppLogicSystemtest. AudioContentViewTest and VideoContentViewTest deleted. |
org.sophie2.main.app.menus | [2505] needs a lot more. |
org.sophie2.main.app.model | [2498], [2501] BackgroundStyleUnitTest and BorderStyleUnitTest also deleted |
org.sophie2.main.func.image | [2497] needs more to be done. |
org.sophie2.main.layout.mydoggy | [2499] Now it starts, but half of the cases do not pass. Not enough time. |
org.sophie2.main.layout.vldocking | nothing has been done here |
org.sophie2.main.media.fobs | fixed by peko/nenko |
org.sophie2.main.persistence.r1 | nothing has been done here |
org.sophie2.server.persistence | [2503] |
Conclusions:
- base,dialogs, base.menus, core, core.mvc, app.menus and layout.vldocking need to be done in the next revision
- legacy modules like persistence.r1 and server.persistence should be decided whether to delete or to refactor the tests
- many modules have not a single test.
- all suppressWarnings("all") clauses must be removed.
- JavaDoc must be fixed.
Merged to the trunk in changeset [2549]. --meddle
- Final result for this revision: 156 tests fail out of 946.
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)