paint-brush
IntelliGame in Action: Gamifying JavaScript Unit Tests - Implementationby@gamifications

IntelliGame in Action: Gamifying JavaScript Unit Tests - Implementation

by GamificationsApril 3rd, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

This paper is available on arxiv(https://arxiv.org/abs/2403.03565) under CC BY-SA 4.0 DEED license. We successfully transferred 19 achievements out of 26 from Java to JavaScript. Each achievement is represented by a trophy indicating the level, a progress bar showing the current progress towards the next level.
featured image - IntelliGame in Action: Gamifying JavaScript Unit Tests - Implementation
Gamifications HackerNoon profile picture

Authors:

(1) Philipp Straubinger, University of Passau, Passau, Germany and this author contributed equally to this research;

(2) Tommaso Fulcini, Politecnico di Torino, Torino, Italy and this author contributed equally to this research;

(3) Gordon Fraser, University of Passau, Passau, Germany;

(4) Marco Torchiano, Politecnico di Torino, Torino, Italy.

Abstract and Introduction

Background and Related Work

Implementation

Experiment

Results

Conclusions, Acknowledgement, and References

3 IMPLEMENTATION

To enable JavaScript support in IntelliGame, we transitioned from using IntelliJ Community Edition to IntelliJ Ultimate[1]. This shift was necessary because JavaScript support is exclusively available in the latter. While we managed to adapt most of the existing test achievements for JavaScript, some proved challenging to port, and a few were even deemed impossible.


Adjusting for test execution tracking, such as the number of tests and assertions, was straightforward, thanks to the Jest testing framework’s syntax[2]. However, obtaining coverage information posed a greater challenge. The built-in test engine of IntelliJ lacks the same coverage details for JavaScript as it does for Java, such as covered branches or methods.


Figure 1: IntelliJ window showing achievements and progress


To address this, we devised a specialized test execution configuration that utilizes Jest to output overall coverage information to the console. We extract and employ this information for our achievements. Additionally, Jest writes coverage details to a JSON file, offering comprehensive class-specific information that we leverage for the remaining achievements. In summary, we extract JavaScript coverage information from three sources: the built-in test engine, the console, and summary files.


Another obstacle arose with the JavaScript debugger, which lacks support for method breakpoints and field watchpoints, required by the implementation of some of the achievements. Unfortunately, we could not find suitable alternatives for these features. Similarly, most of the refactoring-related achievements, implemented using RefactoringMiner for Jav[a3], lacked equivalent tools for JavaScript.


Despite facing challenges, we successfully transferred 19 achievements out of 26 from Java to JavaScript. These achievements can be identified by a small JavaScript symbol (see Fig. 1). Each achievement is represented by a trophy indicating the level, a progress bar showing the current progress towards the next level, and a description detailing the progress required for reaching the next level, accessible by hovering over the question mark. For further details and explanations of the achievements, refer to related work [8].


This paper is available on arxiv under CC BY-SA 4.0 DEED license.


[1] https://www.jetbrains.com/products/compare/?product=idea&product=idea-ce


[2] https://jestjs.io/


[3] https://github.com/tsantalis/RefactoringMiner