Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 258934 - [Viewers] Improve CheckboxTreeViewer coverage
Summary: [Viewers] Improve CheckboxTreeViewer coverage
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-16 09:18 EST by Matthew Bisson CLA
Modified: 2009-06-03 13:35 EDT (History)
2 users (show)

See Also:


Attachments
More CheckboxTreeViewer tests (4.25 KB, patch)
2008-12-16 11:30 EST, Matthew Bisson CLA
bokowski: iplog+
Details | Diff
More CheckboxTableViewer tests (7.46 KB, patch)
2008-12-17 14:47 EST, Matthew Bisson CLA
bokowski: iplog+
Details | Diff
More StructuredViewer Tests (4.88 KB, patch)
2008-12-18 11:10 EST, Matthew Bisson CLA
bokowski: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Bisson CLA 2008-12-16 09:18:14 EST
Build ID: I20081211-1908

There are a number of methods in CheckboxTreeViewer which have no tests and could easily be tested.
Comment 1 Matthew Bisson CLA 2008-12-16 11:30:45 EST
Created attachment 120602 [details]
More CheckboxTreeViewer tests

Tests now cover almost all methods in CheckboxTreeViewer - the only ones not covered are the selection handlers and CheckStateListeners, which are user-input dependent. 

CheckboxTreeViewer coverage: from 48.0% -> 81.9%
org.eclipse.jface.viewers coverage: from 51.2% -> 52.2%

(in JFace-All Tests)
Comment 2 Matthew Bisson CLA 2008-12-17 14:47:41 EST
Created attachment 120745 [details]
More CheckboxTableViewer tests

While I was at it, I added some tests for the CheckboxTableViewer. 

The CheckboxTableViewer has a number of ways to instantiate it. To support these, I subclassed the CheckboxTableViewerTest and overrode the createViewer method. This may not be the optimal solution as each test class takes about 1.5 seconds to run. 

The static factory method was not being tested, so now it is. I also test the deprecated constructors, which may not be necessary - they actually required me to change a test, as they have some unexpected behaviour. 

Coverage improvement: on CheckboxTableViewer, from 47.7% to 84.6%. I only left out the UI selection routines.
Comment 3 Matthew Bisson CLA 2008-12-18 11:10:02 EST
Created attachment 120847 [details]
More StructuredViewer Tests

As I continue to prove this bug is badly named... these tests boost the code coverage on Viewer from 11.4% to 66.7%.
Comment 4 Boris Bokowski CLA 2009-01-21 12:50:48 EST
Released to HEAD. Thanks, Matthew!
Comment 5 Oleg Besedin CLA 2009-01-29 15:57:04 EST
JUnits run fine in the I20090128-1800 build:

testSetAndGetData
testSetAllChecked
testSetGrayChecked
testSetGrayedElements
testGetCheckedElements
testSetCheckedElements