Markup transfer – nightmare or a piece of cake?

train Markup transfer   nightmare or a piece of cake?
The whole process of creating a markup and developing tests is time consuming. And when it seems that the work is done, a new version of spec is released. What happens next? Of course there is a need of a new version of the test suite. New tests must be written and the old ones updated or even deleted.

The best way to start is to do the markup. This task can be devided into two subtasks:

  • transfer old markup from previous spec to the new spec (this is needed because many tests were already  written, they are linked to spec id’s, reusing all possible tests is a good idea);
  • markup new and updated assertions.

Transferring the markup is simple enough to do it by hand:

  1. Find the markup tag in the old spec.
  2. Find the best place to insert the tag in the new version of spec.
  3. Insert the tag.

If there are only 10 assertions – this work is a piece of cake. But if there are thousands it is a hard job that should be automated. The hardest part is to find a new proper place for markup tags. It’s hard just because the spec was changed. For JLS2 to JLS3 migration process the flollowing alrorithm was used:

Each assertion is rounded with html anchors. Both of them should be transferred using such algorithm.

Hin 1t: if some tag is transfered, there is a great possibility, that next tag in old spec will be positioned after the one that is transfered.

Hint 2: algorithm should check that the second anchor should be positioned after the first one and not too far from it.

  1. Look at the text before and after tag in old spec. Find it in the new spec. If one of them72s Markup transfer   nightmare or a piece of cake? wasn’t changed – the answer is found. usually the length should be 1-2 sentances, at least 60 characters long. If none or several sentances found – skip this step.
  2. Try to do the same as in (1), but remove all html tags from the near text that surrounds the tag. If none found – skip this step.
  3. Try the adopt algorithm, which tries to find similar text in the new spec.
    a. Use steps (1) and (2), but desrease the length of the searching text in a loop until the sentance is found or the length is too short. The practical work showed that this number shouldn’t be less than 20.
    b. If steps (1) and (2), or (3a) found several sentances increase the length of the text to search until the text is found in the new spec or the upper limit (f.e. 140 chars) is reached. Use hints to find the best matching text.

Adopt algorithm could be used with both ignoring html tags and taking advantage of them. Algorithm is valid for specs written in plain text, html or xml.

This algorithm was implemented in JLS2->JLS3 markup transfer tool. 84% of the markup tags were transfered automatically. The rest of them were done manually.



, , , , , ,



       

    Leave a Reply

    You must be logged in to post a comment.