<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Using Calculation Fragments for Spreadsheet Testing and Debugging</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Cell X</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fragment A</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Cell Z</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dietmar Jannach, Thomas Schmitz Department of Computer Science</institution>
          ,
          <addr-line>TU Dortmund</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>-A number of automated techniques and tools were proposed in the research literature over the years which aim to support the spreadsheet developer in the process of testing and debugging a faulty spreadsheet. One underlying assumption of many of these approaches is that the spreadsheet developer is capable of providing test cases or is at least reliably able to determine whether a calculated value in a certain cell is correct given the current set of inputs. Since real-world spreadsheets can be complex, we argue that these assumptions might be too strong in some situations. We therefore propose to support the user during testing and debugging by automatically computing spreadsheet fragments of manageable size. The spreadsheet developer can then verify the correctness of a smaller set of formulas for which the calculated output can be more easily validated.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>
        In environments like MS Excel, the set of built-in features
designed to support the users when testing or debugging their
spreadsheet programs is quite limited. Examples of the few
available features include the visualization of individual cell
dependencies or the markup of cells containing suspicious
formulas (“smells” in the sense of [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] or [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]). Over the
last decades a variety of different tools and techniques were
proposed in the research literature to help the user avoid,
locate and remove errors in spreadsheets [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. The proposed
approaches range from intelligent visualizations over test case
generation to the application of novel debugging techniques.
      </p>
      <p>
        Many of these testing and debugging approaches assume
that the users are able to provide test cases, which contain
the expected values for the output cells of their spreadsheets
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]; some techniques require the user at least to reliably
indicate if an output cell value or a test case is correct or faulty
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Providing expected values or even assessing the
correctness of individual values might, however, be challenging
for the user in particular when the spreadsheets are large and
when no known-to-be-correct test cases are available.
      </p>
      <p>We therefore propose to (automatically) modularize the
spreadsheet under investigation and ask the user for feedback
on the correctness of calculations of smaller and more
comprehensible spreadsheet fragments. These fragments in some
sense correspond to the concept of unit tests in standard
software development processes based on which the correctness
of smaller functional parts of the program can be validated.</p>
      <p>
        The proposed fragment extraction approach is also related
to automated refactoring techniques for long methods in
imperative programs based, e.g., on control flow and data flow
graphs like in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. However, spreadsheets have no standard
control flow graphs and the data flow graphs are much simpler,
because the formulas in the cells do not directly change
the values of other cells. Existing refactoring approaches
therefore cannot be directly applied and further investigations
are required to assess how these methods can be adapted to be
applicable for the special and defined structure of spreadsheets.
      </p>
      <p>
        Consider the example in Figure 1, which shows the
dependency structure of a typical financial calculation sheet adapted
from [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. In the upper part of the spreadsheet (Fragment A),
monthly sales data are aggregated with the help of a number of
copy-equivalent rows. In the lower part (Fragment B), further
data aggregation is done and additional calculations are made
on the aggregate values. Structurally or semantically different
cells are denoted by differently styled circles, e.g., the empty
circles denote input cells or fixed parameters.
      </p>
      <p>... ..</p>
      <p>.</p>
      <p>
        Let us assume that the spreadsheet developer observes that
the “final outcome” in the lower right part of the spreadsheet
(Cell Z) only meets his expectations for some but not all
tested input value constellations. However, providing the exact
expected values – as required by some automated debugging
methods [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] – might be cumbersome for the user and
error-prone in particular when the spreadsheet is complex.
      </p>
      <p>In this example, we could – as indicated in Figure 1 –
have two fragments that can be tested individually and in
the case of Fragment A use one row of the spreadsheet as
a representative for the other copy-equivalent rows. These
fragments could be defined manually by the user; in our work,
we are, however, interested in techniques to automatically
identify possible fragments and provide adequate tool support.</p>
      <p>III. DESIGN CONSIDERATIONS - TECHNICAL APPROACH</p>
      <sec id="sec-1-1">
        <title>A. End User Perspective</title>
        <p>
          As spreadsheet developers are usually not IT experts or
programmers, special care has to be taken when designing
a tool for fragment-based testing and debugging. We therefore
plan to integrate the sketched techniques in our model-based
debugging plug-in to Excel called EXQUISITE [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. When using
this tool, the users can stay within their usual spreadsheet
environment; appropriate user-oriented metaphors for those
concepts that are not part of typical spreadsheet tools (like
test cases, fragments, or unit tests), however, still have to be
found and evaluated with users.
        </p>
        <p>Another open question in that context is related to the
optimal complexity of the fragments a user should work on. If
the fragments are too small, test cases for too many fragments
have to be defined by the user; if they are complex and span
major parts of the spreadsheet, the cognitive effort for the user
when providing the test cases might be too high.</p>
      </sec>
      <sec id="sec-1-2">
        <title>B. Automated Extraction of Fragments</title>
        <p>
          The main goal of our work is to develop algorithms
and heuristics to automatically extract potentially overlapping
fragments that are manageable in size and in the best case
semantically connected. These fragments can then for example
serve as a basis for the manual or automated creation of
test cases, e.g., using property-based testing techniques [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ],
where the goal is to automatically create test cases which
falsify user-specified properties of the output values. In another
scenario, the fragments can be used to inspect parts of the
spreadsheet which are considered to be “suspicious” as a result
of a diagnosis or smell detection technique. We are currently
exploring the following fragment construction strategies.
        </p>
      </sec>
      <sec id="sec-1-3">
        <title>1) Collapsing Copy-Equivalent Structures: In Figure 1,</title>
        <p>only the last four cells on the right of Fragment A (including
Cell X) contain formulas. When the right-most cells of each
row are considered suspicious, it can be sufficient to create a
fragment which comprises one representative row, so that the
user only has to create one test case for all rows.</p>
        <p>On the other hand, the left-most cell of Fragment B (Cell
Y) is based on the values of several copy-equivalent cells and,
e.g., corresponds to the sum of the monthly sales figures. If we
defined this cell and a subset of its inputs as another Fragment
C (not shown in Figure 1), the fragment could contain two
or more of the copy-equivalent rows such that the user can
validate the correctness of the aggregation function, which
would be impossible when there is only one input row. With
this second technique the user could, however, miss range
errors such as an omitted cell of a sum.</p>
        <p>2) Limiting the Dependency Paths: Fragments of
manageable size like Fragment B in Figure 1 can be obtained by
limiting the depth and maybe also the breadth of the
dependency paths leading to a suspicious cell. The depth limitation
could be based on simple path length restriction heuristics
or based on structural or semantic considerations, e.g., by
observing that we encounter a set of copy-equivalent cells.
Existing techniques developed for spreadsheet visualization
and comprehension could be applicable in that context.</p>
      </sec>
      <sec id="sec-1-4">
        <title>C. Interactive Testing and Debugging</title>
        <p>The provision of adequate tool support when testing or
debugging a calculation fragment is finally a crucial part of our
approach. From a UI perspective, one could for example create
a new worksheet which only contains the cells and formulas of
the fragment under investigation. This could however remove
context information, as neighboring cells outside the fragment
would not be visible. Therefore, we propose to only visually
dim the cells outside the fragment and make them read-only
to help the user focus on the current task.</p>
        <p>
          For debugging purposes, our model-based diagnosis
approach presented in [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] can be used to find the possible causes
whenever there is a discrepancy between the expected and
the calculated value of an output cell of a fragment. Because
of the small sizes of the fragments, we conjecture that the
combination of these approaches could help to quickly find
the faulty formulas.
        </p>
        <p>In addition, the proposed test and debugging environment
should be able to automatically create appropriate test cases
which are easy to validate manually. Again, existing
approaches for test case generation from the literature should
be applied. Note that when creating these test cases, input
values have to be generated only for the cells at the fragment
borders (e.g., Cell Y in Fragment B). The developed software
environment and Excel plug-in has furthermore to be extended
in a way that test cases can be easily stored, adapted and
automatically executed, e.g., for regression testing.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>IV. SUMMARY</title>
      <p>We argue that providing exact values for expected
calculation outcomes in spreadsheet testing and debugging scenarios
might be too challenging for users in some situations. We
therefore propose to further investigate approaches in which
the given spreadsheet is decomposed into smaller fragments
which can be more easily validated by the user.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>R.</given-names>
            <surname>Abraham</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Erwig</surname>
          </string-name>
          .
          <article-title>AutoTest: A Tool for Automatic Test Case Generation in Spreadsheets</article-title>
          .
          <source>In Proc. VL/HCC</source>
          , pages
          <fpage>43</fpage>
          -
          <lpage>50</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Abraham</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Erwig</surname>
          </string-name>
          .
          <article-title>GoalDebug: A Spreadsheet Debugger for End Users</article-title>
          .
          <source>In Proc. ICSE</source>
          , pages
          <fpage>251</fpage>
          -
          <lpage>260</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>R.</given-names>
            <surname>Abreu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Cunha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. P.</given-names>
            <surname>Fernandes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Martins</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Perez</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Saraiva</surname>
          </string-name>
          .
          <article-title>Smelling faults in spreadsheets</article-title>
          .
          <source>In Proc. ICSME</source>
          , pages
          <fpage>111</fpage>
          -
          <lpage>120</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>G.</given-names>
            <surname>Fink</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Bishop</surname>
          </string-name>
          .
          <article-title>Property-based testing: A new approach to testing for assurance</article-title>
          .
          <source>SIGSOFT Softw. Eng. Notes</source>
          ,
          <volume>22</volume>
          (
          <issue>4</issue>
          ):
          <fpage>74</fpage>
          -
          <lpage>80</lpage>
          ,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>F.</given-names>
            <surname>Hermans</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Pinzger</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <surname>A. van Deursen. Detecting</surname>
          </string-name>
          <article-title>and Visualizing Inter-Worksheet Smells in Spreadsheets</article-title>
          .
          <source>In Proc. ICSE</source>
          , pages
          <fpage>441</fpage>
          -
          <lpage>451</lpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>B.</given-names>
            <surname>Hofer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Riboira</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wotawa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Abreu</surname>
          </string-name>
          , and
          <string-name>
            <given-names>E.</given-names>
            <surname>Getzner</surname>
          </string-name>
          .
          <article-title>On the Empirical Evaluation of Fault Localization Techniques for Spreadsheets</article-title>
          .
          <source>In Proc. FASE</source>
          , pages
          <fpage>68</fpage>
          -
          <lpage>82</lpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>D.</given-names>
            <surname>Jannach</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Schmitz</surname>
          </string-name>
          .
          <article-title>Model-based diagnosis of spreadsheet programs - A constraint-based debugging approach</article-title>
          . Autom. Softw. Eng., online, Feb.
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>D.</given-names>
            <surname>Jannach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Schmitz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Hofer</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Wotawa</surname>
          </string-name>
          .
          <article-title>Avoiding, finding and fixing spreadsheet errors - a survey of automated approaches for spreadsheet QA</article-title>
          .
          <source>Journal of Systems and Software</source>
          ,
          <volume>94</volume>
          :
          <fpage>129</fpage>
          -
          <lpage>150</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>K.</given-names>
            <surname>Maruyama. Automated</surname>
          </string-name>
          Method-
          <article-title>Extraction Refactoring by Using Block-Based Slicing</article-title>
          .
          <source>In Proc. SSR</source>
          , pages
          <fpage>31</fpage>
          -
          <lpage>40</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>