<!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>Modern programming assignment verification, testing and plagiarism detection approaches</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Aleksejs Grocevs</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>A. Manual Work Comparison</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>B. Diff-tool Application</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>C. Abstract Syntax Tree (AST) comparison</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Department of Software Engineering Riga Technical University Riga</institution>
          ,
          <country country="LV">Latvia</country>
        </aff>
      </contrib-group>
      <fpage>61</fpage>
      <lpage>64</lpage>
      <abstract>
        <p>-This paper provides insights of possible plagiarism detection approach based on modern technologies programming assignment versioning, auto-testing and abstract syntax tree comparison to estimate code similarities. assignment; testing; continuous means or not. However, it is possible to outline some widespread approaches of assessment comparison.</p>
      </abstract>
      <kwd-group>
        <kwd>automation</kwd>
        <kwd>integration</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>In the emerging world of information technologies, a
growing number of students is choosing this specialization for
their education. Therefore, the number of homework and
laboratory research assignments that should be tested is also
growing. The majority of these tasks is based on the necessity
to implement some algorithm as a small program. This article
discusses the possible solutions to the problem of automated
testing of programming laboratory research assignments. The
course “Algorithmization and Programming of Solutions” is
offered to all the first-year students of The Faculty of
Computer Science and Information Technology (~500
students) in Riga Technical University and it provides the
students the basics of the algorithmization of computing
processes and the technology of program design using Java
programming language (the given course and the University
will be considered as an example of the implementation of the
automated testing). During the course eight laboratory research
assignments are planned, where the student has to develop an
algorithm, create a program and submit it to the education
portal of the University. The VBA test program was designed
as one of the solutions, the requirements for each laboratory
assignment were determined and the special tests have been
created. At some point, however, the VBA offered options
were no longer able to meet the requirements, therefore the
activities on identifying the requirements for the automation of
the whole cycle of programming work reception, testing and
evaluation have begun.</p>
    </sec>
    <sec id="sec-2">
      <title>I. PLAGIARISM DETECTION APPROACHES</title>
      <p>To identify possible plagiarism detection techniques, it is
imperative to define scoring or detecting threshold. Surely it is
not an easy task, since only identical works can be considered
as “true” plagiarism. In all other cases a person must make his
decision whether two pieces of code are identical by their</p>
    </sec>
    <sec id="sec-3">
      <title>Copyright © 2017 held by the authors 61</title>
      <p>
        Since the code comparison technology takes very important
part in the work of plagiarism detection and software
evaluation, some authors assume that software plagiarism
mainly appears as copy-and-paste or with a little modification
after this, which will not change the function of the code, such
as replacing the name of methods or variables, reordering the
sequence of the statements etc. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>To generalize AST creation approach, multiple ready-to-use
libraries exist, most notable are ANTLR (a powerful parser
generator for reading, processing, executing, or translating
structured text or binary files), JavaCC (much more a Parser
generator than a compiler. AST support is provided through
another lib called JJTree) and SableCC (parser generator which
generates fully featured object-oriented frameworks for
building compilers, interpreters and other text parsers. In
particular, generated frameworks include intuitive
strictlytyped abstract syntax trees and tree walkers).</p>
      <p>It is possible to implement any of abovementioned AST
generators, however ANTL provides wider source code
language support and it will be used for our reference system
implementation.</p>
    </sec>
    <sec id="sec-4">
      <title>II. VERIFICATION SYSTEM METRIC IDENTIFICATION</title>
      <p>
        In order to get a grade, the student has to implement the
required algorithm as a program, submit the program in a
binary (compiled) form as well as providing its source code.
The professor has to test both the program using a subset of
pre-calculated input/output data pairs, and its source code
equivalence to the binary representation, including the
compilation ability and the absence of errors while executing
it. It is imperative to evaluate the factors affecting the whole
process and to choose the metrics for intercomparison [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <sec id="sec-4-1">
        <title>A. Metrics and Identification Process</title>
        <p>Algorithm implementation validation speed is criteria that
reflects how fast can the professor obtain the program and its
source code, execute and test it using the predefined test
patterns. In the University, the student has to upload the result
of his work to the "Homework" section of the Moodle
education portal, where the professor should run and evaluate
it after downloading.</p>
        <p>Plagiarism check – even if the tasks are relatively similar it
is crucial to make sure the source code was written by the
student himself and not plagiarized from a colleague. This
check should be made once by a professor in order to avoid
the code consecutive altering so it can successfully pass the
check.</p>
        <p>Evaluation quality – even in case of simple tasks, such as
"implementing a list sorting algorithm" there might be many
border cases which can lead to incorrect execution results, but
sometimes may not be checked due to time limitation. When
using the automated testing solutions, it is possible to
precreate the large number of different tests that check all the
aspects of the performance of the given assessment.</p>
        <p>Report preparation – it is important to put the data of
successful/unsuccessful test runs together and to inform the
student of the result. When using on-line solutions, there is a
possibility to send a test-passed-successfully notification as
soon as an assessment has been uploaded and tested. It is also
important to record the summary of all students’ assessments
in form of a table that can later be used to be uploaded to the
University education portal.</p>
        <p>Safety check – the binary representation of the program and
its source code are usually tested separately in order to save
time, and this is most commonly done in that particular order.
Although, it is not always possible to quickly detect the
malicious code, which is meant to erase or alter the test results
or even the testing system itself, when the solution consists of
several files or modules. Therefore, while testing the compiled
programs they should be treated as potential malware or
viruses that may damage the test environment. Ideally, they
should be executed in the sandbox environment which ensures
the isolation of the potential threat.</p>
        <p>Bug fix tracking – if the code has been partially altered
(either on the professor's request or during the debugging
process) the modified parts of the file are indistinguishable
from the previous code in the file. Therefore, the professor has
to manually compare two versions of the file in order to detect
these changes, or even look through the entire source code file.
This problem can be solved by using version control system
(VCS). The Moodle system itself does not provide neither an
option nor plugin for that, so this possibility can only be
considered in the context of implementing it in on-site solution.</p>
      </sec>
      <sec id="sec-4-2">
        <title>B. Available automated verification systems</title>
        <p>
          At the moment, all of the assessment checking, test
executing and running as well as plagiarism check/percentage
evaluation is done manually. It is obvious that an ordinary
human cannot keep the source code of five hundred similar
programs in mind, nor is he able to measure their similarity.
That is why similar researches exist that also suggest
automated testing implementation [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ].
        </p>
        <p>In order to aid the manual testing the academic department
of the University has developed a VBA script that
automatically executes and checks the assessments for a
compiled program; the test results are recorded in an Excel
file. This improvement has allowed to speed up the evaluation
process making it possible for the professor to focus more on
the source code, which is a more important than an actual test
run.</p>
        <p>
          Some authors [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ], [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] are offering to use the automated
verification of test runs and a plagiarism check as a separate
Moodle module, which implements many previously defined
criteria at the time the assessment is uploaded to Moodle.
However, none of these researches provide the complete
solution to this problem.
        </p>
        <p>In addition to the above-mentioned methods it is also
possible to use the features of the Continuous Integration
technology that was made specifically to constantly check the
software. This would allow the students to upload their works
into an automated testing environment that would immediately
check these assessments based on the tests prepared by a
professor and would provide the near-realtime response,
whether the program has passed the tests or not. In addition to
the functional check this service could also evaluate the source
code for potentially harmful behavior or actions in an isolated
sandbox-environment.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>III. ANTI-PLAGIARISM INTEGRATION POSSIBILITIES</title>
      <p>By identifying the possible solutions and considering the
current approach to the testing it is possible to compare these
approaches using the previously proposed metrics in
accordance to further anti-plagiarism system integration.</p>
      <sec id="sec-5-1">
        <title>A. Manual Testing</title>
        <p>The speed and the quality of manual check of each
assessment will be definitely lower compared with the
automated check. The numerical representation of absolute
comparison results is impossible in that case due to average
human concentration and performance abilities of each
individual.</p>
        <p>Report preparation is done manually, therefore both the
error rate and the time consumed will be considerably higher
when compared to an automated check.</p>
        <p>Plagiarism check in general will be less accurate with a
large amount of assessments, however human perception
makes detecting such cases reflexively or by using additional
environment information possible (the plagiarism rate is
higher if the students are friends). Furthermore, biased
perception and evaluation of the work are also possible due to
the human factor.</p>
        <p>Safety check depends on the set of rules enforced by the
University. These rules define how to verify the programming
assessments and how to run the executable files. It is most
likely that a professor will primarily check the compiled
program in order to return it for correction in case of a
program failing the tests. This saves him the time for
compiling the program from its source code.</p>
      </sec>
      <sec id="sec-5-2">
        <title>B. Custom Script Usage</title>
        <p>The speed and the quality of such checks are increased in
comparison with manual checks. Since the VBA
implementation allows to check just one assessment at a time,
it cannot be considered as a finished testing automation, as the
required programming work has yet to be copied to the proper
folder for a script check.</p>
        <p>Report preparation is consistent with the expectations and
the requirements – the results of automated test are recorded in
Excel file for each student.</p>
        <p>The plagiarism and safety checks remain at the same level
as in case of manual check, since the VBA script can only
work with the compiled program.</p>
      </sec>
      <sec id="sec-5-3">
        <title>C. E-Learning Portal Approach</title>
        <p>According to the authors, the speed and the quality of such
checks are high and take place in real time.</p>
        <p>The preparation of report is made using Moodle so this
solution is also consistent with the requirements.</p>
        <p>The plagiarism check is present in some announced
solutions but it is not fully functional (system improvement
work is still in progress).</p>
        <p>Safety check remains poor since the sandbox-environment
is not used, which increases the risk of compromising the
whole Moodle system (since all tests are executed under the
Moodle user privileges).</p>
      </sec>
      <sec id="sec-5-4">
        <title>D. Custom Implementation</title>
        <p>
          While creating an on-site solution using the third-party
developer tools, it is possible to meet all the abovementioned
needs. We propose to use Gogs as a Git-repository – the
storage for the source code of all programming assessments;
Jenkins as a Continuous Integration server; Docker as a
sandbox-environment and Apache Solr or other full-text
search system as a plagiarism checker. Many authors [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ],
[
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] have approached the problem of detecting the plagiarism in
the source code, and some authors [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] are proposing the
solutions that are consistent with the University requirements
and can be integrated into the suggested infrastructure. Our
suggested infrastructure involves the workflow shown on Fig.
2:
Workflow step description:
 The students code the task in the program code and
uploads/updates it using Git;
 Jenkins checks all the students' repositories once per
minute, sends a plagiarism check request to Sorl
whenever a new commit appears, creates a separate
sandbox-environment, compiles a program within it and
runs the tests. If the tests are passed – Moodle API is
used to mark the student’s assessment as successfully
completed and to upload the source code his behalf. If
the tests are not passed or the harmful code was found –
the student is notified by an e-mail and has to go back
to step one. The Docker sandbox container is being
automatically removed either when the tests are
completed or by timeout.
 After the assessment submission deadline, the professor
sets all Git-repositories to read-only mode, runs a
Jenkins-plugin, which sends a plagiarism check request
for each of the assessments to Solr and records the
additional data on plagiarism score for every task’s
source code to Moodle.
 The only action left for the professor is to check the
source codes or to compare the latest source code
version with the previous using the built-in Gogs tools.
        </p>
        <p>Such an approach provides the level of checking speed and
quality as well as a report preparation level similar to that of
the Moodle plugin.</p>
        <p>It is possible to use outer systems for plagiarism checks
since Jenkins API allows to connect the various external
services.</p>
        <p>Safety check is at a high level due to the isolated container
(sandbox) use, so the risk of system infestation by the
malicious code and other destructive actions is minimized.</p>
        <p>Tracking of error correction is a standard feature of the
Gogs-repository which facilitates the comparison of file
versions and change-tracking.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>IV. CONCLUSION AND FURTHER WORK</title>
      <p>Based on the comparison results of the programming work
automated testing capabilities using the VBA script, Moodle
plugins and on-site solution, we can assert that the initial
implementations in that area already exist; many authors are
highlighting this fact. However, there is no general method
which could improve the education quality by simplifying the
verification process and shifting the assessor's professional
skill focus from routine tasks towards the student's skills
check in implementing the required task and understanding of
the material. Our suggested approach to the programming
assessment storage organization, testing and verification
allows to solve the abovementioned problems and improve the
professor's working efficiency.</p>
      <p>Hereafter we are planning to implement our suggested
AST-based plagiarism checking approach alongside with other
mentioned techniques in a single system.</p>
    </sec>
    <sec id="sec-7">
      <title>REFERENCES</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Grocevs</surname>
            <given-names>А.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Prokofjeva</surname>
            <given-names>N</given-names>
          </string-name>
          , “
          <source>The Capabilities of Automated Functional Testing of Programming Assignments,” In: Procedia - Social and Behavioral Sciences</source>
          , vol.
          <volume>228</volume>
          , pp.
          <fpage>457</fpage>
          -
          <lpage>461</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Cui</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guo</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ma</surname>
          </string-name>
          , D., “
          <source>Code Comparison System based on Abstract Syntax Tree,” 2010 3rd IEEE International Conference on Broadband Network and Multimedia Technology (ICBNMT)</source>
          , Beijing, pp.
          <fpage>668</fpage>
          -
          <lpage>673</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Hansen</surname>
            ,
            <given-names>D. M.</given-names>
          </string-name>
          , “
          <article-title>Paperless subjective programming assignment assessment: a first step</article-title>
          ,
          <source>” Journal of Computing Sciences in Colleges</source>
          , vol.
          <volume>29</volume>
          (
          <issue>1</issue>
          ), pp.
          <fpage>116</fpage>
          -
          <lpage>122</lpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4] Cheng,
          <string-name>
            <given-names>Z.</given-names>
            ,
            <surname>Monahan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Mooney</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          ,
          <article-title>“nExaminer: A semi-automated computer programming assignment assessment framework for Moodle,” International Conference on Engaging Pedagogy (ICEP11) NCI</article-title>
          , Dublin, Ireland,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Thiébaut</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          , “
          <article-title>Automatic evaluation of computer programs using Moodle's virtual programming lab (VPL) plug-in,”</article-title>
          <source>Journal of Computing Sciences in Colleges</source>
          , vol.
          <volume>30</volume>
          (
          <issue>6</issue>
          ), pp.
          <fpage>145</fpage>
          -
          <lpage>151</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Cosma</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Joy</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>“</surname>
          </string-name>
          <article-title>An approach to source-code plagiarism detection and investigation using latent semantic analysis,” Computers, IEEE Transactions on</article-title>
          , vol.
          <volume>61</volume>
          (
          <issue>3</issue>
          ), pp.
          <fpage>379</fpage>
          -
          <lpage>394</lpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Pozenel</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Furst</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mahnicc</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          , “
          <article-title>Introduction of the automated assessment of homework assignments in a university-level programming course</article-title>
          .
          <source>In Information and Communication Technology, Electronics and Microelectronics (MIPRO)</source>
          ,
          <year>2015</year>
          38th International Convention on, IEEE, pp.
          <fpage>761</fpage>
          -
          <lpage>766</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Zhang</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Joy</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cosma</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Boyatt</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sinclair</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yau</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , “
          <article-title>Source-code plagiarism in universities: a comparative study of student perspectives in China and the UK</article-title>
          .
          <article-title>Assessment and Evaluation in Higher Education</article-title>
          , vol.
          <volume>39</volume>
          (
          <issue>6</issue>
          ), pp.
          <fpage>743</fpage>
          -
          <lpage>758</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Kikuchi</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Goto</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wakatsuki</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nishino</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <article-title>“A Source Code Plagiarism Detecting Method Using Sequence Alignment with Abstract Syntax Tree Elements</article-title>
          ,”
          <source>International Journal of Software Innovation (IJSI)</source>
          , vol.
          <volume>3</volume>
          (
          <issue>3</issue>
          ),
          <fpage>41</fpage>
          -
          <lpage>56</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>