-----Original Message-----
From: Max Rydahl Andersen [mailto:max.andersen@redhat.com]
Sent: Monday, December 17, 2007 9:59 AM
To: vrubezhny(a)exadel.com; Dgolovin@Exadel. Com;
Jbosstools-Dev@Lists. Jboss. Org
Subject: Re: Testing the CA
> Amoung the JUnit test cases we have the one that tests OpenOn's region
> types
> recognition. This tests contains the informatin for the specified file
> region types and calls the OpenOn "detector" on each character
position
> in that file to ensure that the region types are properly detected.
sounds good.
> So, for the CA we can create something like this. Because of algorithm
> of CA
> invokation is closed deep inside ContentAssistant and
> CompletionProposalPopup classes we have to write the same algorithm to
> get
> the CA Processor for the source viewer and text position specified and
> then
> aquire the processor for proposals.
Ok.
> There are some difficulties because of UI staff (there are too many
> private
> and package local/internal classes in CA which need to, but cannot be
> accessed from outside (from test case code)) but I think it's
possible to
> get the proposals for some test file.
would be really usefull if we could get this. But is all the UI stuff
needed to
test the contentassist ? Can't it run just on the model(s) ?
We need to test two main items: first is that Seam EL CA processor is
detected and found in the registry for the specified text region (EL region,
attribute value region, etc.), and the second is that the proposal list
returned by the Seam EL CA processor is valid. Anyway we need the document
and its partitionning to be calculated to perform CA processors search
within the registry. So, before we start to search CA processors for some
text region we need to initialize the document and proper (the same as in
real workspace) document partitioner. This work is hidden deep inside the
Eclipse Workbench UI.
IMHO it will be wrong to "emulate" this part of work.
> The big question is how the test case can ensure that the proposal list
> returned is the right proposals? There are too many variations for the
> proposal set (depending on the JBoss and 3rd-party plugins installed and
> project configuration it is possible to get a different set of
> proposals).
I don't understand this. If you control the code completion then
you also
can limit the code
completion to a specific set of completion mechanisms + you also can
completely control
what goes into the project you are code completing on.
We neeed to test not only Seam EL CA processor. Also we need to test its
invocation on the specified text regions.
If so not only the Seam EL CA processor will be invoked but all the
processors set found for the specified text partition.
(But you're right, we are able to call only Seam EL processor and exclude
other CA processors).
Victor