An Examination of Automated Testing and Xray As A Test Management Tool
An Examination of Automated Testing and Xray As A Test Management Tool
Simon Bertlin
Abstract
Automated testing is a fast-growing requirement for many IT companies.
The idea of testing is to create a better product for both the company and
the customer. The goal of this study is to examine different aspects of au-
tomated testing and Xray as a test management tool. The literature study
considers information from several different scientific reports. It shows
that the benefits of automated testing include increased productivity and
reliable software but also pitfalls like a high initial cost and a maintenance
cost. Research suggests that automated testing is complementary to man-
ual testing. Manual testing is more suited for exploratory testing, while
automated testing is better for regression testing. Using historical data
manual tests can be placed into prioritised clusters. The coverage of each
test within a cluster determines its priority, where a test with high cover-
age has a high priority. A near-optimal solution for prioritising automated
tests is the combination of two well-known strategies, the additional cov-
erage strategy and the total coverage strategy. Tests are prioritised based
on how much of the code they uniquely cover. Code coverage is mea-
sured using statements, methods or complexity. Furthermore, this thesis
demonstrates a proof of concept for how the unified algorithm can pri-
oritise Xray tests. Xray is evaluated according to the ISO/IEC 25010:2011
standard together with a survey done on Xray practitioners. The evalua-
tion for Xray shows that Xray provides the necessary tools and functions
to manage a testing suite successfully. However, no official encryption
exist for the Jira server, and Xray lacks integrated documentation.
Keywords: Xray, testing, automated testing, manual testing, Jira, REST,
API, test prioritisation
i
Table of Contents
Abstract i
Terminology v
1 Introduction 1
1.1 Background and problem motivation . . . . . . . . . . . . . 1
1.2 Overall aim . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Concrete and verifiable goals . . . . . . . . . . . . . . . . . 2
1.5 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Theory 4
2.1 Different types of tests . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Unit testing . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Integration testing . . . . . . . . . . . . . . . . . . . 4
2.1.3 Exploratory testing . . . . . . . . . . . . . . . . . . . 4
2.1.4 Black-box testing . . . . . . . . . . . . . . . . . . . . 4
2.1.5 White-box testing . . . . . . . . . . . . . . . . . . . . 5
2.1.6 Regression testing . . . . . . . . . . . . . . . . . . . . 5
2.2 Test Case Prioritisation . . . . . . . . . . . . . . . . . . . . . 5
2.3 Jira . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4 HTTP Requests . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.5 Xray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5.1 How Xray interacts with Jira . . . . . . . . . . . . . 6
2.6 Cucumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 JUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.8 Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.9 OpenClover . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.10 Postman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.11 Jira REST Java Client Library . . . . . . . . . . . . . . . . . 9
2.12 The ISO standard . . . . . . . . . . . . . . . . . . . . . . . . 10
2.13 ISO/IEC 25010:2011 . . . . . . . . . . . . . . . . . . . . . . . 10
2.14 Confluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.15 Google Lighthouse . . . . . . . . . . . . . . . . . . . . . . . 10
2.16 OAuth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.17 Maven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.17.1 Active profiles . . . . . . . . . . . . . . . . . . . . . . 11
2.17.2 Maven Surefire Plugin . . . . . . . . . . . . . . . . . 11
2.18 Continuous integration . . . . . . . . . . . . . . . . . . . . . 11
2.19 Continuous Delivery . . . . . . . . . . . . . . . . . . . . . . 11
3 Methodology 12
ii
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
4 Construction 17
4.1 Xray with Maven integration . . . . . . . . . . . . . . . . . 17
4.2 Extracting coverage data from OpenClover . . . . . . . . . 18
4.3 Implementing the unified test prioritisation algorithm . . . 18
4.4 Updating test priority with the Xray API . . . . . . . . . . . 20
4.5 Automated tests in Jira . . . . . . . . . . . . . . . . . . . . . 20
4.5.1 Setting up Xray tests with Cucumber in Jira . . . . . 20
5 Results 23
5.1 Automated tests . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.1.1 Benefits and limitations of automated testing . . . . 23
5.1.2 Automatic testing and manual testing . . . . . . . . 26
5.1.3 Prioritising test cases . . . . . . . . . . . . . . . . . . 26
5.2 Testing the implementation of the prioritisation algorithm 28
5.3 Xray as a test management tool . . . . . . . . . . . . . . . . 29
5.3.1 Functional suitability . . . . . . . . . . . . . . . . . . 29
5.3.2 Reliability . . . . . . . . . . . . . . . . . . . . . . . . 30
5.3.3 Usability . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.3.4 Portability . . . . . . . . . . . . . . . . . . . . . . . . 32
5.3.5 Security . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3.6 Survey results . . . . . . . . . . . . . . . . . . . . . . 33
6 Analysis of Xray 35
7 Discussion 37
7.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.2 Research study . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.3 Xray as a test management tool . . . . . . . . . . . . . . . . 38
7.4 Implementation of the prioritisation algorithm . . . . . . . 38
7.5 Method discussion . . . . . . . . . . . . . . . . . . . . . . . 38
7.6 Social, ethical and scientific aspects . . . . . . . . . . . . . . 39
iii
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
A Appendix A 1
A.1 POM file for Maven integration . . . . . . . . . . . . . . . . 1
A.2 JSON file for Maven integration . . . . . . . . . . . . . . . . 2
B Appendix B 4
B.1 Implementation of the Jira REST client . . . . . . . . . . . . 4
B.2 Implementation of the prioritisation algorithm . . . . . . . 6
B.3 Implementation of the test case class . . . . . . . . . . . . . 9
iv
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
Terminology / Notation
REST Representational State Transfer
API Application Programming Interface
CI Continuous integration
HTTP Hypertext Transfer Protocol
HTML HyperText Markup Language
XML Extensible Markup Language
TCP Test Case Prioritisation
APFD Average Percentage of Faults Detected
JRJC Jira REST Java Client
ADC Additional Coverage Strategy
TCS Total Coverage Strategy
v
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
1 Introduction
The demand from consumers on applications and software products are
higher than ever. Famous IT companies, such as Facebook push code
daily into production[1]. A core part of this fast development is auto-
mated testing. Automated testing allows code to be tested before being
pushed into production. Testing ensures correct operation, and that new
or modified code does not break any other code that is currently in pro-
duction. Thus testing is a critical component of serious IT companies.
The idea of automated tests is to create more value for both the company
and the customer. The customer gets a reliable product, and the company
can more easily maintain their product since the automated tests notify
the developers if changes to the codebase have broken some part of the
software.
This project is done with the company Knowit in Sundsvall, Sweden.
Knowit is in the process of incorporating automated testing and wants
to know what current research says about automated testing and how the
tool Xray can help to manage tests, both automated and manual.
1
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
1.3 Scope
This project examines current research on testing when you can move
manual testing to automated testing and how to prioritise tests. There
exist several strategies for prioritising tests. For test case prioritisation the
focus is on coverage-based and risk-based strategies. Another focal point
of the project is the technical challenges of automated testing, but a few
administrative challenges relevant to test management are also consid-
ered. Furthermore, the project examines current research to explore the
benefits and possible drawbacks of automated testing. As for tools, the
project is limited to the Jira server platform and examine Xray integra-
tion with Jira server and how Xray can help to manage different types of
tests, both manual and automated. The analysis of Xray is restricted to
the Maven integration and the REST API services of Xray
2
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
1.5 Outline
Chapter 2 introduces the theory needed to understand the result. This
chapter contains more detailed information about the concepts and ideas
that are presented in the result. Chapter 3 talks about the methodology
used to achieve the result and complete this project. Chapter 4 presents
the construction of the software that was later tested with Cucumber tests
in Xray. Chapter 5 shows the result of the litterateur study and the evalu-
ation of Xray. Chapter 6 analyses the result of the external examination of
Xray and the result of the survey. Chapter 7 discusses the research study
along with future work and the goals of the project.
3
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
2 Theory
This chapter presents the theory that is relevant for the understanding of
the result and the conclusion.
4
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
generally used to test the whole system instead of some specific part. Or
how the system integrates with another system.
2.3 Jira
Jira [7] is a software platform which supports the addition of plugins. A
plugin can be connected to Jira and change the way Jira functions. The
idea of Jira is to help manage teams and projects. Some common uses of
Jira are planning, issue tracking, reports and work management, Jira itself
it does not support tests. However, Jira defines a Representational State
Transfer application programming interface (REST API) to allow applica-
tions created by independent developers to interact with the Jira platform.
REST [8] is an architecture style that sets up rules for how web services
can safely communicate. API [9] is the endpoints that software can use
to get data or post data. APIs allows for software specialised in other
things such as testing to display and report the result of the tests to the
Jira platform[10] .
5
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
project is this GET and POST request. When a GET request is executed,
it requests a transfer of data from some destination. In contrast, when
a POST request is executed, it requests that the destination processes its
payload.
2.5 Xray
Xray [12] was created to manage tests and integrate with Jira. Xray sup-
ports both manual and automated testing. Xray defines several REST API
endpoints which can be used to export tests created in Jira or import test
results to Jira [13]. An example of this is shown in figure 1.
6
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
When setting up a test suite, the following issues are defined as follows:
1. Pre-condition
A pre-condition [16] is something that needs to be true before a test
can be executed. For example, the user might need to be authenti-
cated before using some service.
2. Test issue
Xray defines a test issue [17] that support both automated and man-
ual tests. For automated tests, there exist two types Cucumber and
generic. Cucumber is described in 2.6. Manual tests require a guide-
line for how the test should be performed. Similar to Cucumber, the
test issuer defines a set of steps for the tester to go through. The Test
issue in Jira can be used for both automated and manual tests.
3. Test Set
A test set [18] is a Jira issue that handles the organising of tests. It
is a way to group two or more tests into a logical collection. For
example, a test set called "security" might contain all tests that deal
with security.
4. Planning tests
The idea of the test plan [19] issue is to help the user manage their
test suite. A test plan can contain several test executions, tests and
test sets.
5. Test Execution
A test execution [20] issue provides a context for tests that have
been or should be executed. When a test belongs to a test execu-
tion, that test becomes a test run. A test run is then an instance of
a test within the context of a test execution. The definition of a test
can be changed without changing the test run. By keeping the test
run and the test definition separate the test runs become consistent
with the test execution. An example of this is shown in figure 3
7
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
2.6 Cucumber
Cucumber [21] allows a user to write tests in plain text. Cucumber then
reads each step of the test and verify that it executes correctly . An exam-
ple of a Cucumber test is shown below.
1 Feature: Add two integers
2 Scenario: User wants to calculate a sum
3 Given the application is running
4 When the user input integer A
5 And the user input integer B
6 Then calculate the sum A+B
The feature [22] keyword gives a high-level overview of some system fea-
ture. In this example, the feature is adding two integers. One feature can
contain several scenarios. A scenario is an example of software usage. The
example above shows an example of a user wanting to calculate a sum.
A scenario [23] can contain several steps. Steps are keywords that describe
some event, context or outcome. The example above contains four steps.
Given is a step that initiates the system. When defines some action or event
that occurs. For example, a user interacting with the system. Then is a step
that should describe the expected outcome of the previous steps. And is a
helper step that makes the scenario read more fluidly.
These steps are part of Gherkin[21]. Gherkin is a language that defines
the grammar rules that the scenario must follow such that Cucumber can
understand the scenario.
8
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
2.7 JUnit
JUnit [24] is a test framework for writing tests. JUnit consists of three
main pillars the first is Assertion. Assertions enable testers to assert that
some function or statement produces an excepted result. Next is the test
fixtures, these are used to share test data. The final pillar is test runners.
The runner executes all tests in the same package as the runner itself.
2.9 OpenClover
OpenClover [26] is a tool that measures code coverage in Java. The code
coverage report supports different formats such as XML or HTML[27].
OpenClover combines three types of coverage [28] statement, branch and,
method coverage:
• Statement - Checks if a statement in the code is executed or not.
• Branch - Measures if the flow control branches. For example, if state-
ments. This type then checks if the tests cover all paths.
• Method - Analysis if a method was executed or not during execu-
tion.
2.10 Postman
Postman [29] is a platform that allows users to analyse REST APIs. The
idea is to streamline the API development process so that developers do
not have to write any code to test an API. Instead, developers can directly
test the API with for example GET or POST requests in Postman.
9
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
2.14 Confluence
Confluence [33] is a tool that exists within the Jira platform to share knowl-
edge and documentation. Documentation for Jira plugins such as Xray is
available in the Confluence workspace [12].
2.16 OAuth
OAuth [35] is an open-source protocol that uses public-key cryptography
for user authentication. The idea is to use OAuth to transfer user privi-
leges to some client, such as a REST API client. That client is then allowed
to make requests on behalf of the user.
10
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
2.17 Maven
Maven [36] is a tool based on the Project Object Model(POM). POM [37]
is an XML file that contains project information and configurations that
are needed to build the Maven project. The idea of Maven is to simplify
and uniform the build process. Maven also helps developers share and
publish there project information and configuration [38].
11
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
3 Methodology
This chapter describes the workflow of the project. The workflow in-
cludes how the project divides into phases, how the software was anal-
ysed, evaluated and finally, the tools used to complete the project.
3.2 Procedures
The project follows the funnel model described in [44], which defines a
funnel where the top of the funnel is the most general relevant data, and
as the project moves through the funnel, it gets more specific.
The project was divided into four phases. A pilot study, research, con-
struction and analysis of the software.
3.2.2 Research
In this phase, current academic research is studied with a systematic liter-
ature examination to gain knowledge about manual and automated test-
ing. This project follows the information retrieval process suggested in
12
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
[44] so that the process can be effective and correct. The process defines
six steps that are summarised in figure 4.
13
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
14
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
3.4 Survey
Reliable survey questions were designed by following three primary prin-
cipals defined in [45]. Adequate wording, consistent meaning and well-
defined terms. The idea is that the questions posed in the survey should
mean the same thing to all participants. Also, the words should be chosen
such that they are relevant and understandable by the participants.
To create an electronic survey and get data from participants, the online
service Qualtrics was used. The survey has seven open questions regard-
ing Xray that would take participants with some experience with Xray
about 5-10 minutes to answer. This survey was sent as an electronic mail
and distributed to different companies who are in the process of moving
from manual to automated testing.
3.6 Tools
The tools used to achieve the result are presented below.
15
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
16
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
4 Construction
This chapter demonstrates Xray integration with Maven and the REST
API. Furthermore, this chapter presents an implementation of the algo-
rithm found for prioritising automated test cases in chapter 5.1.3. Finally,
this chapter shows how prioritised test cases can be uploaded to Jira with
the Xray API.
In order to run all the tests and then upload the results, the following
command can be used:
1 mvn clean package surefire:test com.xpandit.xray:xray-maven-plugin:xray
Tests result can be uploaded to a specific test execution and / or test plan
by specifying the Xray properties xray.projectKey and xray.testPlanKey in
the pom.xml file
To create a new issue with custom values in Jira, a user can use the mul-
tipart endpoint can be used. Before running the command, a JSON file
needs to created. This JSON file contains the issue field values that are
needed by Jira. See appendix A.1 for details on an example configuration.
Furthermore, the following lines need to be added to the pom.xml file
1 <xray.testExec-fields.path>${basedir}/info.json</xray.testExec-field.path>
The edit specifies the path to the JSON file. Now the user can run the
following command to create a new Jira Issue with predefined values for
the issue fields:
1 mvn clean package surefire:test
,→ com.xpandit.xray:xray-maven-plugin:xray_multipart
17
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
The algorithm consists of four major steps. The first step is the initiali-
sation step. Variables and data containers are set to their initial state. In
the second step, the algorithm finds any not previously selected test case
tk . After tk is found, the algorithm checks the number of occurrences of
each unit covered by tk . If a unit m is covered by tk then the value f p is
normalised in the range 0.6 <= f p <= 0.95 and used to calculate the
probability that tk contains any undetected faults. In the third step, the
algorithm looks through the remaining test cases and searches for a test
case tl that has a higher probability of containing undetected faults than
tk . If it finds such a test case, tl then tl is set to have the highest priority.
Then the probability that a unit covered by tl contains an undetected fault
is updated. The algorithm then restarts at step two and finds the test case
with the second-highest priority. The process continues until all test cases
have been evaluated. The flow chart for the algorithm is shown in figure
5 and for full implementation details see appendix B.2
18
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
19
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
A requirement for the Scenario Outline is too have a data table filled with
test data.
20
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
In table 1 the "nr" column will replace the <nr> variable in the test sce-
nario. Same goes for "key" and "units". This test case parses an XML file,
extract test cases and then check if those test cases are valid.
For the prioritisation algorithm, an additional test issue is created and
added to the test execution created previously.
1 Feature: Prioritisation algorithm
2 Scenario: Test the prioritisation algorithm
3 Scenario Outline: As a user, I want to be able to priorities my
,→ tests.
4 Given That the XML has been loaded test cases correctly.
5 Then A test case "<key>" should have a <priorityWeight> after
,→ being prioritised
The prioritisation algorithm needs input data, so a mock XML was cre-
ated in order to supply it with input. The XML is then parsed and test
cases extracted. The test cases are then prioritised with the prioritisation
algorithm. If successful, the test case with the mentioned keys in table 2
should have a corresponding priority weight.
To test the JRJC a pre-condition was constructed. This pre-condition gets
valid user credentials from a file. Then a test for the JRJC was created and
added to the test execution previously created.
1 Feature: Jira REST Client.
2 Background:
3 Given That there exists a file for user credentials
4 Then fetch the credentials.
5
6 Scenario: Test that the Jira REST Client can change the priority
,→ of an XRAY issue
7 Scenario Outline: As a user, I want to be able to update my Xray
,→ issues.
8 When A user wants to give a test a new priority.
9 Then A <priorityWeight> should be mapped to a <XrayPriority>
10 And A test case "<test key>" should be given a <XrayPriority>
21
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
In table 3 in the column "Xray priority" a 5 represent the lowest Xray pri-
ority and a 1 represents the highest priority.
Testing the JRJC was done by creating a, a mock user and having the mock
users credentials stored in a file. Those credentials were fetched in the pre-
condition and authenticated to the Jira server. The two tests, DEMO-1 and
DEMO-2, were updated with new priorities with data from the data table.
Finally, a test was created for the test case container class. This test re-
quired no mock data since all the data from table 4 could be used in order
to test if the class functions correctly. Implementation of the class can be
found in appendix B.3.
1 Feature: TestCase container
2 Scenario: Tests the TestCase container class
3 Scenario Outline: As a developer, I want to be able to store test
,→ cases in a container class
4 Given that a developer wants to create a test case with a
,→ "<key>", "<units>", <coveredStatements> and a <priorityWeight>
5 Then A developer should be able to retrieve the test case
,→ "<key>".
6 And A developer should be able to see how much <priorityWeight> a
,→ test case have.
All tests were then exported from Jira in there corresponding .feature files
and implemented.
22
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
5 Results
This chapter shows the result of the literature study and the examination
of Xray. The aim of the sub-chapter 5.1 is to present the findings regard-
ing what the role of automated testing is. Sub-chapter 5.2 shows the result
from testing implementation of the prioritisation algorithm. Sub-chapter
5.3 gives the result of the examination of Xray and a survey done on prac-
titioners that are moving from manual to automated testing and using
Xray as a test management tool.
23
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
24
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
the help request threads, the two most common requests were: Requests
wanting help with developing the test script or tool usage covered 91.5 %
of all help requests, 3.3 % wanted information about configuration for the
test framework, the remaining 5.2% where miscellaneous help requests.
Summary of benefits
Improved software quality: Automated tests allows developers to get no-
tified if modified code have stopped the software from working.[46],
[49] , [50], [52]
Reliable software: Automated tests can act as a proof that the software
is free from a percentage of bugs.[49], [46], [50]
Summary of limitations
High inital cost: The codebase might be untestable, and in need of sig-
nificant refactoring, automated tests have to be created. Developers
also require training and experience with the tools that automated test-
ing requires.[49], [50], [53]
25
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
26
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
second-highest priority and so on. After all the failing tests have been
assigned the successful tests from the previous release are append to the
highest priority cluster and the successful tests from the release before to
the second-highest priority cluster if they do not already exist in the high-
est priority cluster and so on. Several Test Case Prioritisation (TCP) tech-
niques to prioritise test cases within a given cluster exist. A more recent
one is diversity-based TCP which tries to obtain maximum test diversity
by prioritising tests that uniquely covers as much code as possible. This
technique was noted as the most efficient and reliable when prioritising
manual test cases in the above study.
A common algorithm for white-box testing is the Additional Coverage
Strategy (ADC) this is a greedy algorithm. When the algorithm selects a
test case, it takes into consideration how much coverage previously se-
lected test cases have already covered. The algorithm then selects the test
case that covers the most units not previously covered. A unit can be a
statement, method or complexity. That is, a unit should be something
that can indicate coverage. The processes repeats until all units have been
covered by at least one test case. Once all units have been covered, all
coverage information is reset, and the algorithms process the remaining
test cases. [57]
Several studies [58], [59], [60], [57] have shown that the additional strat-
egy is close and sometimes even with an optimal coverage-based solution
that is measured using the Average Percentage of Faults Detected (APFD)
metric.
A study from 2013 [61] suggested that there exists a weakness in generic
ADC. Suppose a test case t that covers a fault f. If t can not detect f then
the there is a significant delay before ADC considers a test case t’ that
can detect f. To solve this, the author suggests combining additional with
total coverage. The Total Coverage Strategy (TCS) does not share the pre-
viously stated weakness since for every test case t it considers all units.
However, the total coverage strategy only counts the number of units each
test covers and does not consider units covered by other test cases. The
algorithm that the author suggests was revised and improved in 2014 in
the paper [62].
The algorithm suggested in [62] unifies the ADC and TCS. This is done
by defining a parameter f p . The parameter is updated for every unit in
order to instruct the algorithm how close it should run to pure ADC or
pure TCS. f p = 1 is the ADC and f p = 0 is the TCS. The authors suggests
that the f p parameter should have a value in the range 0.6 <= f p <= 0.95
for optimal APFD. This was according to the empirical study carried out
in the report.
27
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
28
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
29
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
tools within Jira. Xray also provides the users with an overview of the
testing suite with the Xray Report, which lets the user analyse status and
success rate of tests in the testing suite. Another Xray feature in Jira is the
Test Plan Board. This feature aims to help the user create plans for there
testing. The planning board does this by letting the user organise tests in
directories. A summary report is presented to the user when a directory
is clicked. The Xray test repository is similar to the test plan board instead
of organising test plans a user can organise regular test cases.
Xray test issues can have three different types of manual, Cucumber and
generic. These types enable both automated testing and manual testing.
Xray allows its user to set a test priority manually for the following issues:
Test, Test Plan, Test Execution, and Test set. Since Xray provides a REST
API, the algorithms presented in 5.1.3 can be used together with a POST
request to the REST API to create a test and set a priority automatically.
5.3.2 Reliability
• Recoverability
The responsibility of storing and backing up data falls on the user.
Jira can enable a user to create a backup of the application data. This
backup does not cover attachments, Jira configurations or Jira plu-
gin installation files. The backup is by default, a manual process.
However, the user can create a "Backup Service" which automates
the process and creates backups at specified intervals. A stored
backup can then be imported to the Jira server to recover from fault
or loss of data.
5.3.3 Usability
• Learnability
The main documentation for the Xray plugin exists in Confluence.
A user can not view the documentation from the Jira platform but
must instead navigate away from Jira to read the documentation.
The Xray issue types do have a short description in the Jira platform,
but it provides little information. For example a test set is described
as follows "Test Set - Represents a Test Set"
The documentation at Confluence contains step-by-step guides for
installation and usage. Here a user can get a more rich explanation
of the different issue types that the Xray plugin adds to the Jira plat-
form.
• Operability
From the perspective of the Jira platform, a user can navigate it and
30
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
31
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
Page Score
Dashboard 93
Projects -> Summary 93
Projects -> Issues 88
Projects -> Issues -> Test Execution Details 84
Projects -> Xray Reports 81
Projects -> Xray Test Repository 84
Projects -> Xray Test plan 88
Projects -> Add-ons -> Tests 81
Projects -> Add-ons -> Test Sets 81
Projects -> Add-ons -> Tests Executions 80
Projects -> Add-ons -> Tests Plans 81
From the table, the average score for pages related to Xray is 85.
5.3.4 Portability
• Adaptability
Xray interacts with the Jira platform and adds new issues that the
user can manage. Jira can generate reports and chart with data from
the Xray issues. The user can also choose a plugin for Jira that in-
teracts with Xray issues. All Xray issues can be exported from the
Jira server to XML, Word and HTML. For the Test and Test execu-
tion issue, they can also be exported to CSV and Cucumber. A test
set can be exported to Cucumber as well. Xray issues can also be
exported using the REST API or the Maven integration. A Jira user
can also choose to customise visual fields, such as the navigation
bar, changing colour or contrast.
• Installability
To install Xray on a Jira server, the user must first have a Jira account.
The user can then download the installer for the server and launch
it. The installer follows a basic installation process and prompts
the user for basic configuration choices. Once the server has been
installed, Jira offers to help set up the servers configuration. The
setup involves creating an administrator account, language options
and showing a sample project to help the user get started. Once
that’s done, a user can head to the Jira market place and download
the Xray plugin. The installation process for Xray manages itself.
The user is presented with a short tutorial for how to use it once the
installation is done.
32
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
5.3.5 Security
Before connecting to the Jira server, a user has to tell the Jira server who
they are. Once the user has authenticated themselves, they need the nec-
essary authorisation to perform actions. To help with user integrity, a
user can authenticate to the Jira server with OAuth, basic authentication
or cookie-based authentication. The REST API can use any of these three.
The maven integration and default login to the Jira server is restricted to
basic authentication.
If a user fails to authenticate three times, a CAPTCHA is displayed. The
CAPTCHA prevents the REST API and maven integration from working.
The user needs to manually login to the server completing the CAPTCHA.
During the examination, there was no indication that the data on the Jira
server was encrypted. A member of the Atlassian team said the following
about encryption on Jira servers: "Natively, Jira is not able to encrypt data
such as issues/attachments. Jira does have the ability for you to use issue-level
security in order to further restrict users from seeing specific issues and their
attachments beyond the scope that the standard permission schemes encompass
on a per-project basis. But this isn’t truly encryption, but rather an additional
layer of permissions." [63]
While Jira does not offer encryption, plugins [64] for Jira do. For example,
a user can install the "Encryption for Jira" which provides well-known
encryption techniques.
33
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
Q5: Four out of five participants felt that they didn’t have enough expe-
rience to answer this question. However, one participant said that man-
agement might have high expectation on automated tests and are not con-
sidering the negative aspects of moving to automated testing. The partici-
pant then goes on to say that Xray can help demonstrate both the negative
and positive aspects and thus help managers gain a clearer picture of the
testing situation.
Q6: Three out the five participants thinks that automated testing im-
proves productivity, regression testing and reduces the time spent on test-
ing. Two participants were not sure what benefits to expect from auto-
mated testing.
Q7: Three out of the five participants noted minor usage problems that
they attributed to having little experience with Xray and expected it to
get better with time. Two participants said that the reporting feature for
tests could use some improvement, and it was not always easy to see the
desired information.
Creating a link between Confluence and Xray such that an Xray issue can
be created and its description is directly linked from Confluence instead
of having to copy it.
34
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
6 Analysis of Xray
This chapter analyses the result presented in chapter 5.3
One of the limitations of automated tests shown in 5.1.1 is that proper
team management is required as well as the difficulty to main automated
tests. Since the Xray issues are Jira issues, this can help test leaders and
test managers manage their teams by assigning issues to developers when
something requires maintenance. Priorities can also be set for these issues,
and having test data and test status integrated with scrum boards can help
facilitate agile development.
As mentioned in 5.1.2 when a company moves to automated testing, man-
ual testing still plays an important role. Xray supports both so project
teams can manage both their manual and automated testing in Xray.
While Jira did offer the option to backup data, it was not on by default. If
this feature were to be a part of the introduction to Jira, user data becomes
more securely stored.
In the survey presented in chapter 5.3.6, Q7 participants attributed many
problems to their lacking experience with Xray. One of the issues partici-
pants found in Q8 were that documentation was lacking. If Xray were to
work towards integrated documentation in Jira, users might have a better
experience. Integrated documentation would enable a user to remain in
the Jira platform and have relevant documentation for the specific feature
they’re trying to use instead of having to look the feature up at another
web-page.
As shown in 5.3.3, the Xray pages in Jira got an average accessibility score
of 85. The score got a bit lower because the navigation bar was present
for all sub-pages and the audit tool noted on every test that the "create"
button had poor contrast ratio. Another note from Lighthouse was that
names and labels were missing from buttons, forms and links, making it
harder for a screen reader to assist the user.
In chapter 5.3.4, the adaptability of Xray is shown. The result shows one
of Xrays strengths. A user can call the REST API to manage almost every
Xray feature that exists in the Jira platform. Xray and Jira are customis-
able to individual user need increasing their accessibility. Such as making
test prioritisation automated as shown in 4.3.Since Xray supports several
different types of exports, a user can make custom graphs or charts en-
hancing customizability.
The installation for Xray and Jira was straightforward. There was al-
most no user interaction, and the installation process managed most of
the work, creating a plug & play experience.
35
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
Chapter 5.3.5 shows that there exist three types of authentication meth-
ods. The choice of authentication is up to the user, making it possible for
the user to make a bad decision. The Xray documentation is written for
basic authentication with only a brief mention of the OAuth. The docu-
mentation in its current state can cause some users to ignore the OAuth
since there exist no tutorials or guides for it with Xray. To improve this
Xray could provide documentation for different authentication methods
and inform the user about the strengths and weaknesses of each.
Furthermore, in chapter 5.3.5, the Jira server only encrypts passwords and
does not inform the user that the stored data is not encrypted. Unen-
crypted data brings to light some ethical aspects, such as when a customer
trust a company with there information. The company then uses the Jira
Server to create some product for the customer. Sensitive customer infor-
mation might be inferred from names, summaries or description of issues.
This leakage of information can violate the customer’s trust in the com-
pany. To better the user experience, Jira should be more clear about that
the user data is stored unencrypted. Thus it might be in the interest of
companies and customers for Jira to officially provide encryption.
36
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
7 Discussion
This chapter discusses the goals, research study, survey, prioritisation al-
gorithm implementation and future work.
7.1 Goals
The goals of the project have been successfully achieved. In chapter 1.4
six questions were asked. The project answers question one to four by
conducting a research study. Question five and six were answered by
examining the different parts of Xray and suggesting implementations of
test prioritisation.
37
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
are written and in the case of manual testing, executed by humans and
humans make errors and inefficient decisions. Consequently, the effec-
tiveness of these algorithms might be less in a real-world application then
presented by scientific research in a controlled environment.
38
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
access to proprietary information. Even though only five out of the eighth
characteristics could be evaluated, the ISO/IEC 25010:2011 standard still
indicates the quality of Xray from the perspective of the user. Other meth-
ods for evaluation could have been combined with the ISO/IEC 25010:2011
standard to make up for the missing characteristics. But, there where not
enough time to research those methods and apply them to Xray.
The survey only had five responses. Unfortunately, it was harder than
expected to find companies willing to complete the survey. Given more
time, a more extensive survey could have been conducted, providing
more reliable results. Another improvement would be to replace the sur-
vey with interviews so that the responses of the participants could be im-
proved.
39
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
40
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
References
[1] Dror G Feitelson, Eitan Frachtenberg, and Kent L Beck. “Develop-
ment and deployment at facebook”. In: IEEE Internet Computing 17.4
(2013), pp. 8–17.
[2] Sten Pittet. The different types of software testing. URL: https://www.
atlassian.com/continuous-delivery/software-testing/types-
of-software-testing (visited on 2020-03-24).
[3] Deepak Parmar. Exploratory testing. URL: https://www.atlassian.
com / continuous - delivery / software - testing / exploratory -
testing (visited on 2020-04-06).
[4] Jerry Gao, H.-S. J. Tsao, and Ye Wu. Testing and Quality Assurance for
Component-based Software. Artech House, 2003.
[5] Anirban Basu. Software Quality Assurance, Testing and Metrics. Asoke
K. Ghosh, PHI Learning Private Limited, 2015.
[6] Gregg Rothermel, Roland H Untch, Chengyun Chu, et al. “Test case
prioritization: An empirical study”. In: Proceedings IEEE International
Conference on Software Maintenance-1999 (ICSM’99).’Software Mainte-
nance for Business Change’(Cat. No. 99CB36360). IEEE. 1999, pp. 179–
188.
[7] Atlassian. A brief overview of Jira. URL: https : / / www . atlassian .
com/software/jira/guides/getting- started/overview#jira-
software-hosting-options (visited on 2020-03-24).
[8] Roy Thomas Fielding. Representational State Transfer (REST). URL:
https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_
arch_style.htm (visited on 2020-03-27).
[9] Red Hat. What is an API? URL: https : / / www . redhat . com / en /
topics / api / what - are - application - programming - interfaces
(visited on 2020-03-27).
[10] Atlassian. JIRA Server platform REST API reference. URL: https : / /
docs . atlassian . com / software / jira / docs / api / REST / 8 . 5 . 4/
(visited on 2020-03-24).
[11] R. Fielding and J. Reschke. Hypertext Transfer Protocol (HTTP/1.1): Se-
mantics and Content. URL: https://tools.ietf.org/html/rfc7231
(visited on 2020-04-08).
[12] Bruno Conde. Xray Cloud Documentation Home. URL: https://confluence.
xpand-it.com/display/XRAYCLOUD/Xray+Cloud+Documentation+
Home (visited on 2020-03-24).
[13] Bruno Conde. REST API. URL: https : / / confluence . xpand - it .
com/display/XRAYCLOUD/REST+API (visited on 2020-03-27).
41
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
[14] Max Rehkopf. Working with issues in Jira Software. URL: https : / /
www.atlassian.com/agile/tutorials/issues (visited on 2020-03-
24).
[15] Bruno Conde. Test Process. URL: https://confluence.xpand- it.
com/display/XRAYCLOUD/Test+Process (visited on 2020-04-07).
[16] Bruno Conde. Pre-Condition. URL: https : / / confluence . xpand -
it.com/display/XRAY360/Pre-Condition (visited on 2020-04-07).
[17] Bruno Conde. Test. URL: https : / / confluence . xpand - it . com /
display/XRAY360/Test (visited on 2020-04-07).
[18] Bruno Conde and Isabel Moreira. Test Set. URL: https://confluence.
xpand-it.com/display/XRAY35/Test+Set (visited on 2020-04-07).
[19] Bruno Conde and António Melo. Test Plan. URL: https://confluence.
xpand-it.com/display/public/XRAY/Test+Plan (visited on 2020-
04-08).
[20] Bruno Conde and Diamantino Campos. Execute Tests. URL: https:
/ / confluence . xpand - it . com / display / public / XRAY / Execute +
Tests (visited on 2020-04-08).
[21] Cucumber. What is Cucumber? URL: https://cucumber.io/docs/
guides/overview/#what-are-step-definitions (visited on 2020-
03-27).
[22] Cucumber. Gherkin Reference. URL: https : / / cucumber . io / docs /
gherkin/reference/#example (visited on 2020-03-27).
[23] Cucumber. Gherkin Reference. URL: https : / / cucumber . io / docs /
gherkin/reference/#steps (visited on 2020-03-27).
[24] JUnit. Frequently Asked Questions. URL: https://junit.org/junit4/
faq.html#faqinfo_1 (visited on 2020-03-24).
[25] OpenClover. About Code Coverage. URL: https://openclover.org/
doc/manual/latest/general-- about- code- coverage.html (vis-
ited on 2020-04-14).
[26] OpenClover. OpenClover. URL : https : / / openclover . org / index
(visited on 2020-04-14).
[27] OpenClover. Configuring reports. URL: https://openclover.org/
doc/manual/4.2.0/maven-- configuring- reports.html (visited
on 2020-04-14).
[28] OpenClover. Features. URL: https : / / openclover . org / features
(visited on 2020-04-14).
[29] Postman. The Postman API Platform. URL: https://www.postman.
com/api-platform (visited on 2020-03-31).
42
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
[30] Wojtek Seliga. JIRA REST Java Client Library. URL: https://ecosystem.
atlassian.net/wiki/spaces/JRJC/overview?homepageId=27164679
(visited on 2020-04-27).
[31] iso. STANDARDS. URL: https:/ /www.iso.org /standards.html
(visited on 2020-04-27).
[32] International Standard ISO: ISO/IEC 25010–2011. “Systems and soft-
ware engineering — Systems and software Quality Requirements
and Evaluation (SQuaRE) — System and software quality models”.
In: 1 (2011).
[33] Atlassian. Confluence. URL: https://www.atlassian.com/software/
confluence (visited on 2020-04-27).
[34] Google. Lighthouse. URL: https://developers.google.com/web/
tools/lighthouse (visited on 2020-04-30).
[35] Atlassian. OAuth. URL: https://developer.atlassian.com/server/
jira/platform/oauth/ (visited on 2020-04-30).
[36] The Apache Software Foundation. Welcome to Apache Maven. URL:
https://maven.apache.org/index.html (visited on 2020-03-31).
[37] The Apache Software Foundation. Introduction to the POM. URL:
https://maven.apache.org/guides/introduction/introduction-
to-the-pom.html (visited on 2020-03-31).
[38] The Apache Software Foundation. What is Maven? URL: https://
maven.apache.org/what-is-maven.html (visited on 2020-03-31).
[39] The Apache Software Foundation. Introduction to Build Profiles. URL:
https://maven.apache.org/guides/introduction/introduction-
to-profiles.html (visited on 2020-04-15).
[40] The Apache Software Foundation. Maven Surefire Plugin. URL: https:
//maven.apache.org/surefire/maven-surefire-plugin/ (visited
on 2020-04-15).
[41] Max Rehkopf. What is Continuous Integration. URL: https : / / www .
atlassian.com/continuous- delivery/continuous- integration
(visited on 2020-03-31).
[42] Johannes Gmeiner, Rudolf Ramler, and Julian Haslinger. “Auto-
mated testing in the continuous delivery pipeline: A case study of
an online company”. In: 2015 IEEE Eighth International Conference on
Software Testing, Verification and Validation Workshops (ICSTW). IEEE.
2015, pp. 1–6.
[43] Kristina Alexanderson. Källkritik på nätet. URL: https://internetstiftelsen.
se/guide/kallkritik-pa-internet/kallkritik-pa-natet/ (vis-
ited on 2020-03-27).
43
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
44
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
45
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
A Appendix A
The pom.xml that used in 4.1
10 <properties>
11 <maven.compiler.source>11</maven.compiler.source>
12 <maven.compiler.target>11</maven.compiler.target>
13 <junit.version>4.13</junit.version>
14 <xray.projectKey>MAV</xray.projectKey>
15 <xray.testEnvironments>Java</xray.testEnvironments>
16 <xray.revision>Build-1.0</xray.revision>
17 <xray.resultsFormat>JUNIT</xray.resultsFormat>
18
,→ <xray.surefire.location>${basedir}/target/surefire-reports</xray.surefire.location
19 </properties>
20
21 <build>
22 <pluginManagement>
23 <plugins>
24 <plugin>
25 <groupId>org.apache.maven.plugins</groupId>
26 <artifactId>maven-surefire-plugin</artifactId>
27 <version>2.19.1</version>
28 <configuration>
29 <testFailureIgnore>true</testFailureIgnore>
30 </configuration>
31 </plugin>
32 </plugins>
33 </pluginManagement>
34 </build>
35
1
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
36 <reporting>
37 <plugins>
38 <plugin>
39 <artifactId>maven-surefire-report-plugin</artifactId>
40 </plugin>
41 <plugin>
42 <groupId>com.xpandit.xray</groupId>
43 <artifactId>xray-maven-plugin</artifactId>
44 <version>1.1.0</version>
45 </plugin>
46 </plugins>
47 </reporting>
48
49 <pluginRepositories>
50 <pluginRepository>
51 <id>xpand-plugins</id>
52 <name>xpand-plugins</name>
53 <url>http://maven.xpand-it.com/artifactory/releases</url>
54 </pluginRepository>
55 </pluginRepositories>
56 <dependencies>
57 <dependency>
58 <groupId>junit</groupId>
59 <artifactId>junit</artifactId>
60 <version>${junit.version}</version>
61 <scope>test</scope>
62 </dependency>
63 </dependencies>
64
65 </project>
2
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
11 "assignee":{
12 "name": "Siber92"
13 },
14 "issuetype": {
15 "name": "Test Execution"
16 }
17 }
18 }
3
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
B Appendix B
B.1 Implementation of the Jira REST client
1 import static utility.IssuePriority.*;
2 public class JiraClient {
3 private final String username;
4 private final String password;
5 private final String URL;
6 private final JiraRestClient restClient;
7 public JiraClient(String username, String password, String URL){
8 this.username = username;
9 this.password = password;
10 this.URL = URL;
11 this.restClient = getJiraRestClient();
12 }
13
18 /**
19 *
20 * @return A Jira rest client that can handle Jira requests.
21 */
22 private JiraRestClient getJiraRestClient() {
23 return new AsynchronousJiraRestClientFactory()
24
,→ .createWithBasicHttpAuthentication(getJiraUri(),username,password);
25 }
26
27 /**
28 * Updates the priority of a issue
29 * @param issueKey key to identify the issue to update.
30 */
31 public String updatePriority(String issueKey, Long priority){
32 try {
33 IssueInput input = new IssueInputBuilder()
34 .setPriorityId(priority)
35 .build();
36 restClient.getIssueClient()
37 .updateIssue(issueKey, input)
38 .claim();
4
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
39 }catch(RestClientException e){
40 if(e.getStatusCode().get().intValue() == 401){
41 System.out.println(username + " " + password + " " +
,→ URL);
42 return "error";
43 }
44 else{
45 System.out.println(e);
46 }
47 }
48
52 /**
53 * Maps the priority weight from the prioritisation algoirthm to an
,→ Xray priority.
54 * @param prioWeightMax The priority weight of the test with the
,→ highest priority weight.
55 * @param testPrioWeight The priority weight of the current test.
56 * @return an Xray priority
57 */
58
5
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
75 return HIGHEST.toLong();
76 }
77 return -1L;
78 }
18
19
6
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
31
40 /**
41 * Normalise the f_p to be in the range lowEnd <= highEnd
42 * @param testCaseMetric the metric used,
43 * in this example the number of statements a method covers is
,→ used.
44 * @return a normalised f_p
45 */
46 private double normalizeF_p(int testCaseMetric){
47 double numerator = testCaseMetric - metricMin;
48 double denominator = metricMax - metricMin;
49 if(denominator == 0){
50 denominator = 1;
51 }
52 double lowEnd = 0.6; //recommended range from the study is 0.65
,→ <= f_p <= 0.95
53 double highEnd = 0.95;
54 return 1 - ((highEnd-lowEnd) * (numerator / denominator));
55 }
56
57 /**
58 * Main loop for test case prioritization.
59 * @return a prioritised vector.
60 */
61 public Vector<TestCase> prioritize() {
62 for (int testCase = 0; testCase < nrOfTestCases; testCase++) {
63 findUnchosenTestCase();
64 checkForBetterFit();
65 updatePriority();
66 }
67 return priority;
68 }
69
70 /**
71 * Finds a previously not chosen test case and calculates the
,→ probability that the units covered by
7
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
91 /**
92 * Checks the remaining test cases if there exist a test case with
,→ higher probability, then the one first chosen
93 * to contain undetected faults.
94 */
95 private void checkForBetterFit() {
96 for (int otherTestCase = testCaseIndex + 1; otherTestCase <
,→ nrOfTestCases; otherTestCase++) {
97
8
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
108 }
109
118 /**
119 * Updates the priority vector and sets new probabilities for already
,→ covered units
120 *
121 */
122 private void updatePriority() {
123 TestCase current = input.get(testCaseIndex);
124 current.setPriorityWeight(sum);
125 priority.add(current);
126 selected.set(testCaseIndex, true);
127 for (unit = 0; unit < nrOfUnits; unit++) {
128 String currentUnit = methods.elementAt(unit);
129 int nrOfOccurrences = current.occurrence(currentUnit);
130 if (nrOfOccurrences != 0){
131 f_p =
,→ normalizeF_p(current.getUnitStatementCoverage(currentUnit));
132 double prob = probability.get(unit) * Math.pow((1 -
,→ f_p),nrOfOccurrences);
133 probability.set(unit, prob);
134 }
135 }
136 }
137 }
9
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
10
25 /**
26 *
27 * @param unit unit to check.
28 * @return occurrences for the given unit
29 */
30 public int occurrence(String unit){
31 if(units.get(unit) != null){
32 Pair<Integer, Integer> temp = units.get(unit);
33 return temp.getFirstValue();
34 }
35 return 0;
36 }
37 /**
38 *
39 * @param unit
40 * @return the statement coverage for the given unit.
41 */
42 public int getUnitStatementCoverage(String unit){
43 if(units.get(unit) != null){
44 Pair<Integer, Integer> temp = units.get(unit);
45 return temp.getSecondValue();
46 }
10
Examination of automated testing and Xray as a test management tool
Simon Bertlin 2020–06–08
47 return 0;
48 }
49 public String getName() {
50 return name;
51 }
52 public void setPriorityWeight(double priorityWeight){
53 this.priorityWeight = priorityWeight;
54 }
55 public double getPriorityWeight(){
56 return priorityWeight;
57 }
58 }
11