List Icon
Archive de la liste de diffusion

La liste de diffusion est fermée depuis juillet 2022, mais sert toujours d'archive d'informations sur QF-Test.
Cependant, si vous souhaitez rester informé des nouveautés concernant QF-Test, vous pouvez simplement vous
abonner à la newsletter 

our obtenir des informations à jour sur chaque version - y compris les versions mineures - vous pouvez
nous pouvez vous abonner au flux RSS ou nous suivre sur les médias sociaux.
Alternativement, QF-Test fournit également des informations sur la version elle-même.

Une autre source d'information est notre blog, qui contient des articles actuels sur des thèmes généraux, sur l'entreprise QFS et aussi divers "how-tos", veuillez vous
ABonner au Blog


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[QF-Test] Extracting/checking text from JEditorPane


  • Subject: [QF-Test] Extracting/checking text from JEditorPane
  • From: Michael Theurich <Michael.Theurich@?.int>
  • Date: Thu, 26 Jun 2014 13:44:18 +0200

I have a problem checking the displayed text in a swing JEditorPane component. The HTML text is generated by my SUT code in one go, then submitted to the component, and looks like this:
 
<html>
  <head>
 
  </head>
  <body>
    <h2>
      Minimum Report Detail <a href="" size="small">show
      help info...</font></a>
    </h2>
    <table id="detail" rules="cols">
      <tr id="normalrow" currentrow="0">
        <td id="label" border="1" cellspacing="0" align="left">
 
        </td>
        <td id="value" border="1" cellspacing="0" align="right">
          Raw
        </td>
        <td id="value" border="1" cellspacing="0" align="right">
          Calibrated
        </td>
        <td id="value" border="1" cellspacing="0" align="right">
          Unit
        </td>
      </tr>
and so on...
 
This (expected) text has been put into the “expected text” field of a Check-txt node in my test, by way of the check recording feature of qft (this is exactly how the text looks in a debugger prior to throwing it at JEditorPane). But when the test runs and the check is executed, it fails, and the following actual text is displayed:
<html>
  <head>
 
  </head>
  <body>
    <h2>
      Minimum Report Detail <font size="small"><a href=""
      help info...</a></font>
    </h2>
    <table id="detail" rules="cols">
      <tr currentrow="0" id="normalrow">
        <td border="1" cellspacing="0" align="left" id="label">
 
        </td>
        <td border="1" cellspacing="0" align="right" id="value">
          Raw
        </td>
        <td border="1" cellspacing="0" align="right" id="value">
          Calibrated
        </td>
        <td border="1" cellspacing="0" align="right" id="value">
          Unit
        </td>
      </tr>
 
As you can see, the position of the id attribute has changed, although not in all cases. Also the relative order of the a and the font element have changed. Of course with this text, the test fails.
But it also sometimes occurs that the text is extracted unaltered. Component identification is never an issue.
 
Strange, isn’t it? I also noticed that qftest becomes VERY slow when a check_txt contains a large text field with many line breaks.
 
Maybe qftest has to employ special logic to retrieve the HTML from the component. The normal copy-to-clipboard handler e.g. only retrieves the plain text and strips any tags. Have I spotted a bug? Is this non-deterministic behaviour of JEditorPane (or it’s instrumentation by qftest) or of qftest?
 
Another solution for me would be to retrieve the plain text from the contents of JEditorPane and base the comparison on that. Is that supported by qftest in any way?
 
I am currently using qftest-3.5.6 for evaluation.
 
Thanks for any help,
Michael
 
 
---------------------------------------------------------------------------------
Michael Theurich
Monitoring Application Tools SW Engineer
 
Telespazio VEGA Deutschland GmbH
Provision of Engineering Support Services
 
EUMETSAT
Eumetsat-Allee 1
64295 Darmstadt
Tel +49 6151 807-7530