100% found this document useful (6 votes)
42 views

(Ebook) Artificial Intelligence Methods for Optimization of the Software Testing Process: With Practical Examples and Exercises (Uncertainty, Computational Techniques, and Decision Intelligence) by Sahar Tahvili, Leo Hatvani ISBN 9780323919135, 0323919138 download pdf

The document provides information about various eBooks available for download on ebooknice.com, including titles related to artificial intelligence, software testing, and educational resources. It highlights the book 'Artificial Intelligence Methods for Optimization of the Software Testing Process' by Sahar Tahvili and Leo Hatvani, which includes practical examples and exercises. The document also lists other eBooks with their respective authors and ISBNs, along with links for instant download.

Uploaded by

albiehvieper
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
42 views

(Ebook) Artificial Intelligence Methods for Optimization of the Software Testing Process: With Practical Examples and Exercises (Uncertainty, Computational Techniques, and Decision Intelligence) by Sahar Tahvili, Leo Hatvani ISBN 9780323919135, 0323919138 download pdf

The document provides information about various eBooks available for download on ebooknice.com, including titles related to artificial intelligence, software testing, and educational resources. It highlights the book 'Artificial Intelligence Methods for Optimization of the Software Testing Process' by Sahar Tahvili and Leo Hatvani, which includes practical examples and exercises. The document also lists other eBooks with their respective authors and ISBNs, along with links for instant download.

Uploaded by

albiehvieper
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

Download the Full Ebook and Access More Features - ebooknice.

com

(Ebook) Artificial Intelligence Methods for


Optimization of the Software Testing Process: With
Practical Examples and Exercises (Uncertainty,
Computational Techniques, and Decision
Intelligence) by Sahar Tahvili, Leo Hatvani ISBN
https://ebooknice.com/product/artificial-intelligence-
9780323919135, 0323919138
methods-for-optimization-of-the-software-testing-process-
with-practical-examples-and-exercises-uncertainty-
computational-techniques-and-decision-intelligence-44502300

OR CLICK HERE

DOWLOAD EBOOK

Download more ebook instantly today at https://ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;


Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT


II Success) by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

ebooknice.com

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena


Alfredsson, Hans Heikne, Sanna Bodemyr ISBN 9789127456600,
9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com

(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master


the SAT Subject Test: Math Levels 1 & 2) by Arco ISBN
9780768923049, 0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094

ebooknice.com
(Ebook) Cambridge IGCSE and O Level History Workbook 2C -
Depth Study: the United States, 1919-41 2nd Edition by
Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

ebooknice.com

(Ebook) Software Engineering, Artificial Intelligence,


Networking and Parallel/Distributed Computing (Studies in
Computational Intelligence, 1012) by Roger Lee (editor)
ISBN 9783030923167, 3030923169
https://ebooknice.com/product/software-engineering-artificial-
intelligence-networking-and-parallel-distributed-computing-studies-in-
computational-intelligence-1012-38451900
ebooknice.com

(Ebook) Managing the Testing Process: Practical Tools and


Techniques for Managing Hardware and Software Testing by
Rex Black, Rex Black ISBN 9780471223986, 9780471449348,
0471223980, 0471449342
https://ebooknice.com/product/managing-the-testing-process-practical-
tools-and-techniques-for-managing-hardware-and-software-
testing-1739536
ebooknice.com

(Ebook) Data Driven Decision Making using Analytics


(Computational Intelligence Techniques) by , , ISBN
9781032058276, 1032058277
https://ebooknice.com/product/data-driven-decision-making-using-
analytics-computational-intelligence-techniques-36082578

ebooknice.com

(Ebook) AI*IA 2016 Advances in Artificial Intelligence:


XVth International Conference of the Italian Association
for Artificial Intelligence, Genova, Italy, November 29 –
December 1, 2016, Proceedings by Giovanni Adorni, Stefano
https://ebooknice.com/product/ai-ia-2016-advances-in-artificial-
Cagnoni, Marco Gori, Marco Maratea (eds.) ISBN
intelligence-xvth-international-conference-of-the-italian-association-
for-artificial-intelligence-genova-italy-
9783319491295, 9783319491301, 3319491296, 331949130X
november-29-december-1-2016-proceedings-5696676
ebooknice.com
ARTIFICIAL
INTELLIGENCE
METHODS FOR
OPTIMIZATION OF THE
SOFTWARE TESTING
PROCESS
Uncertainty, Computational Techniques, and
Decision Intelligence Book Series
Series Editors

Tofigh Allahviranloo, PhD


Faculty of Engineering and Natural Sciences, Istinye University, Istanbul,
Turkey

Narsis A. Kiani, PhD


Algorithmic Dynamics Lab, Department of Oncology-Pathology &
Center of Molecular Medicine, Karolinska Institute, Stockholm, Sweden

Witold Pedrycz, PhD


Department of Electrical and Computer Engineering, University of
Alberta, Canada

For more information about the UCTDI series, please visit: https://www.elsevier.
com/books-and-journals/book-series/uncertainty-computational-techniques-
and-decision-intelligence
ARTIFICIAL
INTELLIGENCE
METHODS FOR
OPTIMIZATION OF THE
SOFTWARE TESTING
PROCESS
With Practical Examples and
Exercises

SAHAR TAHVILI
Product Development Unit, Cloud RAN, Integration and Test
Ericsson AB, Stockholm, Sweden
Division of Product Realisation
School of Innovation, Design and Engineering
Mälardalen University, Eskilstuna, Sweden

LEO HATVANI
Division of Product Realisation
School of Innovation, Design and Engineering
Mälardalen University, Eskilstuna, Sweden
Academic Press is an imprint of Elsevier
125 London Wall, London EC2Y 5AS, United Kingdom
525 B Street, Suite 1650, San Diego, CA 92101, United States
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, United Kingdom
Copyright © 2022 Elsevier Inc. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or any information storage and
retrieval system, without permission in writing from the publisher. Details on how to seek
permission, further information about the Publisher’s permissions policies and our arrangements
with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency,
can be found at our website: www.elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the
Publisher (other than as may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience
broaden our understanding, changes in research methods, professional practices, or medical
treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in
evaluating and using any information, methods, compounds, or experiments described herein. In
using such information or methods they should be mindful of their own safety and the safety of
others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors,
assume any liability for any injury and/or damage to persons or property as a matter of products
liability, negligence or otherwise, or from any use or operation of any methods, products,
instructions, or ideas contained in the material herein.

ISBN: 978-0-323-91913-5

For information on all Academic Press publications


visit our website at https://www.elsevier.com/books-and-journals

Publisher: Mara Conner


Editorial Project Manager: John Leonard
Production Project Manager: Swapna Srinivasan
Designer: Mark Rogers
Typeset by VTeX
I would like to dedicate this book to my sister Sara and my niece Nilsa, who
have always stood by me every step of the way with unconditional love and
support.

– Sahar

I would like to dedicate this book to my parents who have always encouraged
me on my science journeys.

– Leo
This page intentionally left blank
Contents

List of figures xiii


List of tables xix
Biography xxi
Preface xxiii
Acknowledgments xxv

PART 1 Software testing, artificial intelligence, decision


intelligence, and test optimization

1. Introduction 3
1.1. Our digital era for a better future 3
1.2. What is in this book? 4
1.2.1. What is in the practical examples and exercises? 5
1.2.2. What you will need 6
1.3. What is missing? 6

2. Basic software testing concepts 7


2.1. Software development life cycle 7
2.2. Software testing 11
2.2.1. The procedure of software testing 11
2.2.2. Software testing life cycle 12
2.2.3. The levels of software testing 14
2.3. Test artifacts 16
2.3.1. Requirements specification 17
2.3.2. Test specification 19
2.3.3. Test script 22
2.3.4. Software test report 23
2.3.5. Traceability matrix 24
2.4. The evolution of software testing 27
References 30

3. Transformation, vectorization, and optimization 35


3.1. A review of the history of text analytics 35
3.1.1. Text analytics sub-disciplines and applications 39
3.2. Text transformation and representation 47
3.2.1. String distances 47

vii
viii Contents

3.2.2. Normalized compression distance 49


3.3. Vectorization 50
3.3.1. Text vectorization 51
3.3.2. Machine learning 58
3.3.3. Neural word embeddings 65
3.3.4. Log vectorization 67
3.3.5. Code vectorization 69
3.4. Imbalanced learning 71
3.4.1. Random under-sampling 72
3.4.2. Random over-sampling 72
3.4.3. Hybrid random sampling 73
3.4.4. Synthetic minority over-sampling technique for balancing data 74
3.5. Dimensionality reduction and visualizing machine learning models 74
3.5.1. t-Distributed stochastic neighbor embedding 76
3.5.2. Uniform manifold approximation and projection 77
References 78

4. Decision intelligence and test optimization 85


4.1. The evolution of artificial intelligence 85
4.2. Decision-making in a VUCA world 87
4.3. Multi-criterion intelligent test optimization methodology 91
4.4. Static and continuous test optimization process 93
4.4.1. Test case selection 96
4.4.2. Test case prioritization 97
4.4.3. Test suite minimization 97
4.4.4. Random, exploratory, and parallel test execution 98
4.4.5. Intelligence test scheduling 100
4.4.6. Test automation 101
References 103

5. Application of vectorized test artifacts 107


5.1. Test artifact optimization using vectorization and machine learning 108
5.2. Vectorization of requirements specifications 110
5.2.1. Unit of analysis and procedure for analyzing the requirements
specifications 111
5.2.2. Case Study 1: Topic identification for the requirements
specifications analysis using text vectorization and clustering 112
5.2.3. Optimization strategy and industrial application 115
5.2.4. Case Study 2: Splitting up requirements into dependent and
independent classes using text vectorization and classification 117
5.2.5. Applications of dependency detection between requirements 119
Contents ix

5.3. Vectorization of test case specifications 120


5.3.1. Unit of analysis and procedure for analyzing the manual test cases 122
5.3.2. Case Study 3: Similarity and dependency detection between
manual integration test cases using neural network embeddings
and clustering 123
5.3.3. Applications of dependency and similarity detection between
manual integration test cases 125
5.3.4. Case Study 4: Dividing manual integration test cases into
dependent and independent classes using neural network
embeddings and classification 128
5.4. Vectorization of test scripts 129
5.4.1. Unit of analysis and procedure for analyzing the test scripts 131
5.4.2. Case Study 5: Similarity detection between integration test
scripts using neural network embeddings and classification 132
5.4.3. Case Study 6: Clustering high-dimensional data points using
HDBSCAN, t-SNE, and UMAP for similarity detection between
integration test scripts 134
5.4.4. Applications of similarity detection between test scripts 136
5.5. Vectorization of test logs 138
5.5.1. Unit of analysis and procedure for analyzing the test logs 140
5.5.2. Case Study 7: Classifying log entries based on the failure
causes using word representations and troubleshooting action
classification 140
5.5.3. Case Study 8: Log vector clustering using the HDBSCAN algorithm 144
5.5.4. Applications of the test log vectorization 147
5.6. Implementation 147
5.6.1. Scripts, modules, packages, and libraries 148
5.6.2. Text vectorization 153
5.6.3. Code vectorization 155
5.6.4. Log vectorization 155
5.6.5. Random over-sampling, under-sampling, and SMOTE 156
5.6.6. Visualization implementation 158
References 160

6. Benefits, results, and challenges of artificial intelligence 161


6.1. Benefits and barriers to the adoption of artificial intelligence 161
6.2. Artificial intelligence platform pipeline 164
6.2.1. Dataset generation 166
6.2.2. Model development 168
6.2.3. Model deployment 168
6.3. Costs of artificial intelligence integration into the software development
life cycle 169
x Contents

References 171

7. Discussion and concluding remarks 173


7.1. Closing remarks 173

PART 2 Practical examples and exercises

8. Environment installation 177


8.1. JupyterLab installation 177
8.1.1. JupyterLab on pre-installed Python 178
8.2. GitHub labs 179
8.2.1. Download 179
8.2.2. Loading the exercises into JupyterLab 179

9. Exercises 181
9.1. Python exercises and practice 181
9.2. Exercise 1: Data processing 182
9.3. Exercise 2: Natural language processing techniques 182
9.4. Exercise 3: Clustering 183
9.5. Exercise 4: Classification 183
9.6. Exercise 5: Imbalanced learning 184
9.7. Exercise 6: Dimensionality reduction and visualization 184
References 185

A. Ground truth, data collection, and annotation 187


A.1. Ground truth 187
A.1.1. The conducted ground truth for Case Study 1, requirements
specifications analysis – The Singapore Project at Alstom Sweden
AB 187
A.1.2. The conducted ground truth for Case Study 2, splitting up
requirements into dependent and independent classes – The
Singapore R151 Project at Alstom Sweden AB 188
A.1.3. The conducted ground truth analysis for Case Study 3, similarity
and dependency detection between manual integration test
cases – The BR490 Project at Alstom Sweden AB 190
A.1.4. The conducted ground truth analysis for Case Study 4, dividing
manual integration test cases into dependent and independent
classes – The Singapore R151 Project at Alstom Sweden AB 191
A.1.5. The conducted ground truth analysis for Case Study 5 and Case
Study 6, similarity detection between integration test scripts –
Ericsson AB 192
Contents xi

A.1.6. The conducted ground truth analysis for Case Study 7 and Case
Study 8, grouping log files based on failure causes – Ericsson AB 194
References 196

Index 197
This page intentionally left blank
List of figures

Figure 2.1 A customized version of a software development life cycle


(SDLC). Source: Authors’ own contribution, inspired by the
original model of the software development life cycle. 8
Figure 2.2 A customized version of a software testing life cycle model.
Source: Authors’ own contribution, inspired by the original
model of the software testing life cycle. 13
Figure 2.3 The V-model in software testing. Source: Authors’ own
contribution, inspired by the original V-model. 15
Figure 2.4 A Venn diagram of the software test artifacts. The red zone
represents a manual testing process, whereas the green zone
indicates an automated (or semi-automated) testing process.
Source: Authors’ own contribution. 16
Figure 2.5 An example of a test summary report. Source: Authors’ own
contribution. 25
Figure 2.6 Test execution analysis using the test summary report.
Source: Authors’ own contribution. 25
Figure 2.7 A summary of the evolution of software testing. Source:
Authors’ own contribution. 27
Figure 3.1 The stages of the text analytics practice from World War II
until the 1990s. Source: Authors’ own contribution. 36
Figure 3.2 The key concepts and rules of transformational grammar (also
called transformational-generative grammar [TGG]). Source:
Authors’ own contribution inspired by Adetuyi and Fidelis [4]. 37
Figure 3.3 The structure of symbolic modeling. Source: Authors’ own
contribution. 38
Figure 3.4 The stages of text analytics in the artificial intelligence
era. Source: Authors’ own contribution, inspired by
Krippendorff [3]. 39
Figure 3.5 An overview of the sub-disciplines and aspects of text
analytics and how they relate. Source: Authors’ own
contribution, inspired by Miner et al. [1]. 40
Figure 3.6 An example of the inverted index structure using the
segment “Set the critical relays status into the ATP-ATO
Propulsion and Brake screens” from the presented test case in
Table 2.3. Source: Authors’ own contribution. 41
Figure 3.7 Sub-disciplines of web mining. Source: Authors’ own
contribution, inspired by Shah and Pandit [19]. 41

xiii
xiv List of figures

Figure 3.8 An example of text classification. The model is used to flag


incoming emails as spam. Source: Authors’ own contribution. 42
Figure 3.9 An example of hard and soft text clustering, where C1 is an
example of hard clustering and C2 and C3 are two examples
of soft clustering. Source: Authors’ own contribution. 43
Figure 3.10 Process of concept extraction. Source: Authors’ own
contribution, inspired by Tulkens et al. [25]. 43
Figure 3.11 An example pipeline of natural language generation.
Source: Authors’ own contribution, inspired by the proposed
frameworks by Reiter and Dale [32] and Banaee et al. [30]. 44
Figure 3.12 An example information extraction template for the
D ISCOTEX approach. Source: Authors’ own contribution. 47
Figure 3.13 Representation of the TF-IDF calculation for the individual
words of a text. Source: Authors’ own contribution. 53
Figure 3.14 The structure of the continuous bag of words (CBoW) model.
Source: Mikolov et al. [81]. 54
Figure 3.15 The structure of the distributed bag of words (DBoW) model.
Source: Le and Mikolov [83]. 55
Figure 3.16 The structure of the skip-gram (SG) model. Source: Mikolov et
al. [81]. 56
Figure 3.17 An overview of partitioning data into training, validation, and
testing sets. 58
Figure 3.18 The three main categories of machine learning approaches. 59
Figure 3.19 A schematic diagram of a machine learning-based approach
for text mining. 60
Figure 3.20 A framework of some of the text data pre-processing
approaches. 61
Figure 3.21 Text comparison between the original and tokenized versions
of the presented test case in Table 2.3 and Table 3.3, using the
Levenshtein equality. 62
Figure 3.22 The neural system architecture of word embeddings. The
words need to be pre-processed first using tokenization,
stemming, lemmatization, and/or stop word removal. Source:
Thanaki [95]. 66
Figure 3.23 The customized system architecture of the Log2Vec model.
Source: Liu et al. [97]. 68
Figure 3.24 Customized version of the neural system architecture of code
embeddings. Source: Alon et al. [98]. 70
Figure 3.25 Example of balanced and imbalanced datasets for dividing
test cases into dependent and independent and similar and
non-similar classes. 71
List of figures xv

Figure 3.26 A schematic overview of the random under-sampling


approach. 73
Figure 3.27 A schematic overview of the random over-sampling approach. 73
Figure 3.28 A schematic overview of a hybrid sampling model for
imbalanced datasets. 74
Figure 3.29 A schematic overview of the synthetic minority over-sampling
technique (SMOTE). Source: Chawla et al. [104]. 74
Figure 4.1 A cut of the evolution of artificial intelligence (the Fourth
Industrial Revolution). Source: Authors’ own contribution. 86
Figure 4.2 A custom version of an iterative decision-making process. 88
Figure 4.3 The steps of an intelligent decision-making process. Source:
Authors’ own contribution inspired by the proposed model
by Fawkes [14]. 90
Figure 4.4 An illustration of a multi-criterion decision-making problem
with several criteria, different alternatives, and constraints.
Source: Tahvili et al. [23]. 92
Figure 4.5 A continuous test optimization process using artificial
intelligence. Source: Authors’ own contribution. 95
Figure 4.6 An overview of the serial test execution for testing five radio
base stations (RBSs) at Ericsson AB. The X -axis represents the
products (RBSs). The numbers inside the bars are the number
of required test cases. Source: Landin et al. [40]. 99
Figure 4.7 An overview of the parallel execution process for testing five
radio base stations (RBSs) at Ericsson. The X -axis represents
the required test cases and the Y -axis shows the number of
the test stations. Source: Landin et al. [40]. 100
Figure 4.8 Machine learning tasks, sub-disciplines, and applications in
software testing. Source: Authors’ own contribution. 102
Figure 5.1 The proposed pipeline for vectorization of requirements
specifications. 111
Figure 5.2 The clustered requirements specifications using the SBERT
model for vectorization and the agglomerative algorithm for
the clustering, where C represents the cluster number and
n indicates the size of each cluster. The embeddings were
dimensionally reduced using the t-SNE model. 113
Figure 5.3 The clustered requirements specifications using SBERT for
vectorization and the K-means algorithm for the clustering,
where C represents the cluster numbers and n indicates the
size of each cluster. The embeddings were dimensionally
reduced using the t-SNE model. 114
xvi List of figures

Figure 5.4 The clustered requirements specifications using SBERT for


vectorization and the K-medoids algorithm for the clustering,
where C represents the cluster numbers and n indicates the
size of each cluster. The embeddings were dimensionally
reduced using the t-SNE model. 114
Figure 5.5 The spiral graph shows the dependencies between
requirements, where the blue nodes represent requirements
and the black lines indicate the dependencies between each
requirement. 118
Figure 5.6 A visualized summary of the presented results in Table 5.6 for
classifying the requirements specifications into dependent
and independent classes against the ground truth. 120
Figure 5.7 The proposed pipeline for vectorization of test case
specifications. 121
Figure 5.8 The clustered test case specifications for the BR490 project
using the Doc2Vec model and HDBSCAN, where C0
represents independent (or non-similar) test cases and n
indicates the size of each cluster. The embeddings were
dimensionally reduced using the t-SNE model. 124
Figure 5.9 The classified test case specifications into independent and
dependent classes using Doc2Vec and the AutoKeras model.
This figure corresponds to the results presented in Table 5.9. 129
Figure 5.10 The proposed pipeline for vectorization of test scripts. 130
Figure 5.11 The obtained results of employing a supervised learning
approach for classifying the test scripts. Those test scripts
which are in the same class have the same main function. 132
Figure 5.12 The clustered test script using Code2Vec and HDBSCAN,
where C0 represents non-clusterable data points and
n indicates the size of each cluster. Embeddings are
dimensionally reduced using the t-SNE model. 135
Figure 5.13 The clustered test script using Code2Vec and HDBSCAN,
where C0 represents non-clusterable data points and
n indicates the size of each cluster. Embeddings are
dimensionally reduced using the UMAP model. 136
Figure 5.14 The proposed pipeline for vectorization of test logs. 139
Figure 5.15 Results of supervised classification of log entries using the
Log2Vec model and AutoKeras. 143
Figure 5.16 The clustered log entry using Log2Vec and the HDBSCAN
algorithm using Survey 3, where C0 represents non-
clusterable data points and n indicates the size of each
cluster. Embeddings are dimensionally reduced using t-SNE. 145
List of figures xvii

Figure 5.17 The clustered log entry using Log2Vec and HDBSCAN is
based on Survey 3, where C0 represents non-clusterable data
points and n indicates the size of each cluster. Embeddings
are dimensionally reduced using UMAP. 147
Figure 5.18 A synthetic dataset before and after SMOTE over-sampling. 159
Figure 6.1 A segment of the impact of artificial intelligence in software
development during 2020–2021. Sources: World Quality
Report [2] and Gartner’s special report [1]. 162
Figure 6.2 Some of the common artificial intelligence challenges.
Source: Author’s own contributions. 164
Figure 6.3 An artificial intelligence platform solution. Source: Author’s
own contributions. 165
Figure A.1 The corresponding ground truth for requirement
vectorization in Case Study 1, presented in Section 5.2.2. The
Singapore R151 project at Alstom Sweden AB is utilized for
conducting this ground truth analysis. 188
Figure A.2 The corresponding ground truth for requirement
vectorization in Case Study 2, presented in Section 5.2.4.
This figure shows a segment from the software architecture
designed for the Singapore R151 project. 189
Figure A.3 The corresponding ground truth for test case vectorization in
Case Study 3, presented in Section 5.3.2. This figure shows a
cut from a testing platform for the BR490 project at Alstom
Sweden AB, where the input–output signals, requirements,
and test cases are visualized. 190
Figure A.4 An example of an embedded directed graph of dependencies
for five test cases. 191
Figure A.5 The corresponding ground truth for test case vectorization
for Case Study 4, presented in Section 5.3.4. This figure
shows a cut from the software architecture designed for the
Singapore R151 project. 192
Figure A.6 Dependencies between test cases and requirements in
the Singapore R151 project. The red nods represent the
requirements and the blue nodes are the test cases. 193
Figure A.7 Classifying test cases into two main classes: dependent and
independent. 193
Figure A.8 The corresponding ground truth for similarity detection
between test scripts in Case Study 5 and Case Study 6,
presented in Section 5.4.2 and Section 5.4.3, respectively. This
xviii List of figures

figure shows a representation of the similarities after the


majority-voting across three expert datasets. The filled-in
squares indicate that these two test scripts are functionally
similar. 195
List of tables

Table 2.1 Comparison of automated and manual software testing in six


aspects. 12
Table 2.2 A requirements specification example for testing a train
system, extracted from the DOORS database at Alstom
Sweden AB. 18
Table 2.3 A test case specification example, designed for testing the
presented requirements specification in Table 2.2. The test
specification has been extracted from the DOORS database at
Alstom Sweden AB. 20
Table 2.4 An example of the resulting view of a traceability matrix
extracted from the DOORS database at Alstom Sweden AB.
Source: DOORS database. 26
Table 2.5 A summary of some conducted research for employing
artificial intelligence techniques in the software testing field. 29
Table 3.1 Measuring the TF for one test step from the presented test
case in Table 2.3. 52
Table 3.2 One-hot encoded data representations of “Set the critical
relays status into the ATP-ATO Propulsion and Brake screens”
and “Set all relays status critical.” 57
Table 3.3 The tokenized version of the presented test case in Table 2.3,
using the “Action” and “Expected result” columns. 62
Table 3.4 Some popular evaluation metrics in machine learning. 64
Table 3.5 The imbalanced dataset range from mild to extreme. 71
Table 3.6 Details of utilized techniques for dimensionality reduction
and data visualization. 78
Table 4.1 VUCA, opposites, and examples. 87
Table 5.1 A brief summary of the provided industrial case studies in this
book. 109
Table 5.2 Parameters and versions of packages used for Case Study 1. 112
Table 5.3 The obtained results for Case Study 1, where the requirements
specifications are employed for the proposed machine
learning pipeline in Fig. 5.1 against the ground truth. 113
Table 5.4 Some examples of the designed sub-level functional groups
(SLFGs) at Alstom Sweden AB. 115
Table 5.5 Parameters and versions of packages used for Case Study 2. 119
Table 5.6 Summary of the obtained results for classifying the
requirements specifications into dependent and
independent classes against the ground truth. 119

xix
xx List of tables

Table 5.7 Parameters and versions of packages used for Case Study 3. 123
Table 5.8 A summary of the performance evaluation against ground
truth for clustering the dependent and independent test case
specifications, using the BR490 project at Alstom Sweden AB. 125
Table 5.9 The obtained results for classifying the test case specification
into dependent and independent classes employing the
proposed machine learning pipeline in Fig. 5.7 against the
ground truth in the Singapore R151 project. 129
Table 5.10 Some examples of different functions within individual test
scripts. 133
Table 5.11 A summary of the performance evaluation for classifying the
test scripts against the labeled data using the over-sampled
dataset. 134
Table 5.12 The performance metrics for evaluating the efficiency of
the proposed pipeline for similarity detection between test
scripts using Code2Vec and HDBSCAN. The performance of
the utilized model is evaluated against the labeled data on
both the original subsampled datasets. 136
Table 5.13 Some examples of the detected synonyms by the Log2Vec
model for the test logs. 141
Table 5.14 Some examples of the detected antonyms by the Log2Vec
model for the test logs. 141
Table 5.15 A sample of the obtained vectors for the log entries. In total
32 dimensions are derived for each log entry. 142
Table 5.16 An example of the high-level troubleshooting causes for each
class of the log entries. Class 0 is assigned for the unknown
failure causes. 142
Table 5.17 The results of the performance evaluation on the 25% of the
dataset for classifying log entries against the labeled data. 144
Table 5.18 A summary of the performance metrics on the full and
subsampled dataset against the labeled data. 146
Table A.1 A sample of the employed questionnaire at Ericsson AB for
detecting the similarities between test scripts written in Java.
We asked the testers to insert 1 if two test scripts have at least
one similar function and insert 0 if there is no similar function
between two test scripts. 194
Table A.2 A sample of the employed questioner at Ericsson for
detecting the failure causes and thereby the required
troubleshooting activities. 195
Biography

Sahar Tahvili is an operations team leader


in the product development unit, Cloud
RAN, integration and test at Ericsson AB,
and also a researcher at Mälardalen Uni-
versity, Sweden. Sahar holds a PhD in
software engineering; her doctoral thesis
entitled “Multi-Criteria Optimization of
System Integration Testing” was named one
of the best new Software Integration Test-
ing books by BookAuthority. She earned
her BS and MS degrees in Applied Math-
ematics with an emphasis on optimization.
Sahar’s research focuses on artificial intelli-
gence, advanced methods for testing com-
plex software-intensive systems, and designing decision support systems
(DSSs). Previously she worked as a senior researcher at the Research In-
stitutes of Sweden and as a senior data scientist at Ericsson AB.

Leo Hatvani is a lecturer at Mälardalen


University, Sweden. Leo holds a Licenti-
ate degree in the verification of embed-
ded systems from Mälardalen University.
His current research focuses on artificial in-
telligence and advanced methods for test-
ing complex software-intensive systems. His
teaching is focused on improving Industry
4.0 production processes and product devel-
opment by integrating artificial intelligence
and augmented and virtual reality. He is
working closely with Mälardalen Industrial
Technology Centre (MITC), which coop-
erates with a number of regional companies
to introduce Industry 4.0 practices into the Swedish industry.

xxi
This page intentionally left blank
Preface

The story of writing this book started after we tried to conclude our re-
search in the fields of artificial intelligence and software testing. From 2015
to 2020, we published our research results in several conferences, journals,
and also Sahar’s PhD thesis. Then it was time to move on to the next chap-
ter in our careers. But we found ourselves seeking out a conclusion to this
research.
During this time we changed homes, cities, domains, and jobs, the
coronavirus outbreak started, and our homes became our offices, but our
research always stayed with us. We were always on the lookout for the next
step of our research. How we can find some new use cases? Is this research
applicable in other domains? How can we facilitate the testing effort in
today’s technology?
We still remember our first days in the industry as young researchers
with a heightened pressure to impress the testing team. The first time we
went to the Bombardier Transportation offices in Västerås (the company’s
name changed to Alstom Sweden AB), we met the integration testing team
and they showed us a comprehensive presentation about the testing process.
We found out how different real-world industrial software testing can be
from the theoretical descriptions and toy examples used in academia.
At that time, many concepts were unclear to us. Either due to our lack
of knowledge in the testing domain or the slight differences between theory
and practice. We still remember the complexity of the test configuration
figures, traceability matrix, testing pipelines, and numerous acronyms. We
did not even know from which point we should start. However, we trusted
in the process and that “hard work will pay off.” Then we started from
scratch.
After some time, we began to understand the testing process in the
industry. Also, the testing team began to understand our intentions and
ideas. During our research, we did not just focus on different artificial
intelligence-based solutions; we also developed a common understanding
between us and the stakeholders in the industry.
Within our daily close collaboration with engineers and testing teams at
Alstom Sweden AB and Ericsson AB, we realized that there is potential and
need for our research. On the other hand, continuously learning from the
testing experts pushed our limits and forced us out of our comfort zones.

xxiii
xxiv Preface

Finally, we are here now, presenting our book, discussing our experi-
ences, and sharing our challenges and discoveries with the readers. This
book is a beginning of a story, not just about artificial intelligence applica-
tions in the software testing domain, but also about overcoming the weak
points, fears, and restrictions by not giving up, asking questions, and always
learning. We are still at the beginning of an endless learning process. Sup-
port us and each other to be better; each one of us can make a difference.
Together we can make a massive change in both science and the world.
Acknowledgments

Our sincere thanks go to Pontus Östling, Gunnar le Grand, Dr. Sigrid Eldh,
Yulin Cui, Cristina Landin, and Anders Caspar at Ericsson AB, who have
invested their valuable time and always been supportive to us throughout
the work on this book.
We would like to express our sincere gratitude to the integration testing
teams at Alstom Sweden AB for their patience, motivation, and immense
knowledge. A very special thank you goes to Dr. Ola Sellin and Henrik
Jonsson at Alstom Sweden AB for their support during the research that
built the foundation of this book.
Our deepest gratitude goes to our families, friends, and also our col-
leagues: Dr. Nima Dokoohaki, Jonas Österberg, Dr. Hessam Shadman,
Dr. Anita Simhag, Iraj Mesdaghi, Professor Markus Bohlin, and Shahab
Darvish, who have always been there for us. Without them, we could have
never reached this far.

Sahar Tahvili and Leo Hatvani

Stockholm
June 2022

xxv
This page intentionally left blank
PART ONE

Software testing,
artificial intelligence,
decision intelligence,
and test optimization

1
This page intentionally left blank
CHAPTER ONE

Introduction
“Learning is a profoundly important part of what makes us human. It is also
something good old-fashioned artificial intelligence struggled with.”
Luke Dormehl

1.1. Our digital era for a better future


Nowadays, not a single day goes by without receiving news about the
digital world. We are somehow surrounded by social media, algorithms,
cryptocurrencies, cyber-attacks, and artificial intelligence. In fact, we are in
an age of rapid technological progress, although some of the news about our
digital world and advanced technologies is still fiction and wishes. Despite
all the progress and positive effects of the digital era, we are still struggling
to handle and be prepared for unforeseen global risks. Monitoring the im-
pact of the COVID-19 pandemic on our daily lives, mental health, and
economy is a good example of evaluating our capabilities and today’s tech-
nologies. However, even with modern technology, some unforeseen events
happen due to software glitches. The big demand for new devices and ap-
plications, competitors, and market share can directly impact the quality
of new technologies. While the technology’s demand is continuously em-
powering the enterprises, numerous records of cheating in the test process
are reported. Sometimes paying no attention to the test result and product
quality can cause a penalty of millions of dollars, and a single overtly minus-
cule bug in an aircraft system can cause a fatal crash. Additionally, today’s
technology is in danger of being overestimated, which might mislead con-
sumers with respect to its capabilities and applications. For instance, when
we discuss artificial intelligence today, it sounds like artificial intelligence is
the cure for all diseases, which can easily be applied and implemented in
different areas and save more and more lives. Well, this statement is both
true and false.
Today’s version of artificial intelligence mostly refers to a device or an
application that can make decisions based on the received information like
human intelligence. Artificial intelligence has a wide range of applications,
from simple GPS navigation system to the control of COVID-19 and even
recognizing cancerous tumors in computed tomography scans. The daily

Artificial Intelligence Methods for Optimization of Copyright © 2022 Elsevier Inc. 3


the Software Testing Process All rights reserved.
https://doi.org/10.1016/B978-0-32-391913-5.00012-9
4 Artificial Intelligence Methods for Optimization of the Software Testing Process

wide and critical application of artificial intelligence makes it an impor-


tant factor in computer science research and also a buzzword in the digital
marketplace.
Adaptation of new artificial intelligence technologies in the software
development process is still at its infancy level compared to self-driving or
voice-assisted control systems. Although most tech companies are focusing
more and more on artificial intelligence, the problem of data availability and
lack of artificial intelligence explainability is still preventing new startups or
even large industries from easily employing new artificial intelligence tech-
nologies. After spending several years working in industrial research in the
software testing domain, we can conclude that explainable artificial intelli-
gence is the most critical factor for implementing artificial intelligence in
industries. Presenting artificial intelligence as a black box1 learning system
to industries can be a huge barrier to entry and growth. On the other hand,
employing artificial intelligence as an assistive tool and engaging the test-
ing team for improving the quality of the dataset has helped us to present
a white box2 version of artificial intelligence. Although increasing soft-
ware quality and reducing the unpredictable risks is vital, still, the most
demanded usage of artificial intelligence in the software testing domain is
test automation. In fact, most enterprises are aiming to reduce the amount
of mundane and tedious tasks in the testing process. During our research
with several industries, we had the opportunity to show how employing
artificial intelligence technologies at different stages of the software testing
process can help enterprises to increase the quality of the software product
and optimize the testing process.

1.2. What is in this book?


This book consists of two main parts. The first part provides an intro-
duction to the overall work on the use of artificial intelligence, including
challenges, issues, and needs, in the software testing domain. Chapter 2
explains the background of the software testing concept and its history.
Chapter 3 focuses more on transformation, vectorization, and optimization.
In Chapter 4 we review the history of text analytics and we analyze text

1 In the context of this book, a black box is a system that can be viewed in terms of its
inputs and outputs, and its exact inner function remains hidden.
2 In contrast to the black box, white box systems can be fully inspected and their function-
ality can be observed.
Introduction 5

transformation and representation, vectorization, machine learning, deep


neural network models, and also imbalanced learning. The topic of de-
cision intelligence, multi-criterion decision-making, and test optimization
techniques are exhaustively discussed in Chapter 4.
The structure and pipeline of the proposed solutions for optimization of
the testing process are depicted in Chapter 5. Moreover, several industrial
case studies from Ericsson AB and Alstom Sweden AB are presented in
Chapter 5, which are focused on the telecommunication and safety-critical
systems domains, respectively. We also review some available methods for
implementing the proposed solutions in Python in this chapter. Chapter 6
clarifies some points of test artifact vectorization benefits and also discusses
some major barriers to artificial intelligence adoption in industries. Finally,
Chapter 7 concludes this part by discussing the presented contributions.
The second part of this book is mainly focused on practical examples
and Python exercises. It also offers an introduction to the Python language,
the data sources, additional source codes, and the utilized ground truths
and data collection and annotation methods.
Since all the provided optimization solutions in this book are exempli-
fied by at least one industrial case study, this book can be used by testers,
troubleshooters, and also test managers in the industries for reproducibil-
ity. Moreover, this book provides a solid background and structure for all
the proposed solutions. As mentioned above, Part 2 provides some practical
examples and Python exercises that can be utilized by advanced undergrad-
uate and graduate students in mathematics, statistics, computer science, any
engineering field, and operations research and as a reference for profession-
als.

1.2.1 What is in the practical examples and exercises?


Part 2 consists of two chapters. Chapter 8 provides all required information
for the environment installation and packages. The intent of Chapter 9 is to
provide some Python exercises for the readers. Moreover, all the exercises
are mapped with the information and industrial cases studies in Chap-
ter 5. Readers will learn about computational approaches for a range of
challenges, including searching high-dimensional spaces, handling problems
where there are multiple competing objectives, and accommodating uncer-
tainty in the metrics. Figures, examples, and exercises convey the intuition
behind the proposed solutions. The text provides concrete implementations
in the Python programming language.
6 Artificial Intelligence Methods for Optimization of the Software Testing Process

1.2.2 What you will need


The exercises in this book are designed with the programmers in mind.
However, the readers are able to take their own ideas for solving the ex-
ercises. Please do not forget the role of curiosity in innovation; innovation
happens where ideas flourish. At an early stage of our research, we worked
on an industrial project with a great team but no data was available at that
time. During our research, we learned how to overcome the obstacles that
are holding our goals hostage! In this book, we share some of our experi-
ences with the readers about how artificial intelligence can be applied step
by step in industries and how we can overcome the barriers. Being humble
and patient is key!

1.3. What is missing?


This book is mainly about the application of different artificial intel-
ligence models, e.g., machine learning, deep learning, and natural language
processing, with a focus on test optimization. This book is written at an
intermediate to advanced level for master level students and also software
testing experts in industries. Moreover, we aimed to design this book to
be comprehensive, where the proposed optimization solutions can be em-
ployed in other domains such as social media analytics. In this regard, we
have included certain topics and subjects and excluded others. Our main
criteria to select a topic were applicability and reproducibility. Therefore, a
few subjects were omitted because they did not fit within the overall struc-
ture of this book. Although we are tried to address the problem of industrial
large datasets, the proposed solutions in this book might not be sufficient for
solving big data problems such as accumulating data from different sources.
CHAPTER TWO

Basic software testing concepts


Chapter points
• This chapter provides background information on the basic concepts and
preliminaries in the area of software development.
• Comprehensive background information on software testing is provided.
• Several industrial examples of test artifacts are given.
• A brief history of software testing is provided.
• A brief overview of the conducted research on the application of artificial
intelligence in the software testing domain is presented.

“Verification: Are we building the product right?


Validation: Are we building the right product?”
Barry Boehm

2.1. Software development life cycle


Even though the question “What is software testing?” may result in
multiple answers, for the moment no one can doubt that software testing is
an important and valuable phase in the software development life cycle.
The process of software testing has two main missions. First, one must
evaluate the functionality of a software application to check whether the
developed software meets the specified requirements [1]. Second, to ensure
quality, one must strive to identify the defects to ensure that the product is
bug-free. Software testing can also be considered as an investigation into the
quality perspectives of both software products and services. Since software
testing can interact with other phases of the software development life cycle,
it can also be considered as the risk identification process in the software
implementation phase.
Before diving into the process of software testing, its benefits, and the
interaction with other development phases, it is important to understand
what the term “software development life cycle” means.

Definition 2.1. The software development life cycle is a process that aims
to design, develop, and test a software product [2].

Artificial Intelligence Methods for Optimization of Copyright © 2022 Elsevier Inc. 7


the Software Testing Process All rights reserved.
https://doi.org/10.1016/B978-0-32-391913-5.00013-0
8 Artificial Intelligence Methods for Optimization of the Software Testing Process

The software development life cycle can mainly be divided into three
main activities: design, development, and evaluation. Each of the mentioned
activities can be further divided into several phases or steps. Fig. 2.1 shows
a customized version of a software development life cycle provided by us
through monitoring different software development life cycle processes at
several Swedish companies.

Figure 2.1 A customized version of a software development life cycle (SDLC). Source: Authors’
own contribution, inspired by the original model of the software development life cycle.

As highlighted in Fig. 2.1, to complete each main step, several activities


need to be done. Moreover, the customized version of the software devel-
opment life cycle process in Fig. 2.1 is also mapped with a DevOps model.
Generally, a DevOps model is a combination of cultural philosophies, prac-
tices, and tools that increase a company’s ability to deliver applications or
services at high velocity [3]. The main goal of employing the DevOps
model is to improve products at a faster pace compared to the traditional
software development and also infrastructure management processes [4].
The following paragraph provides distilled information regarding each step
for the provided customized version of the software development life cycle
in Fig. 2.1.
Basic software testing concepts 9

1. Design. During the design phase, several parameters such as stake-


holder requirements, business rules, project planning, process diagrams,
and technical architectures need to be analyzed. In this regard, the de-
sign phase can be done by performing the following activities:
- Analysis. Generally, analysis refers to the requirement analysis
which aims to capture all details of each requirement and analyze how
each requirement is going to be satisfied. Moreover, the requirements
also can be grouped into user (also known as non-functional require-
ments) and functional requirements. The user requirement explains the
client requirements for the system [5], whereas a functional requirement
describes a particular service that must be offered when certain condi-
tions are met [6]. In this step, the stakeholders discuss both mentioned
requirements of the software that needs to be developed.
- Planning. Planning can be considered as a fundamental process
of realizing a software program should be built [7]. Additionally, in the
planning step, the feasibility of technical ideas, business, and organiza-
tion should be assessed. The result of the feasibility assessment needs to
be approved later by the steering committee to make sure the project
supports business goals and objectives.
- Ideation. When the team has a common idea of the requirements
and the software project’s foundations, a proper solution needs to be
created that satisfies customers’ needs, requirements, and also expecta-
tions [8]. However, in the ideation process, besides generating a broad
set of ideas, some unexpected needs that are not anticipated before
should be considered.
- Architecture. Architecture illustrates a blueprint for a software sys-
tem, which describes a structured solution, the major components, and
also the interactions among species at each component. Furthermore,
some common quality attributes such as performance and security need
to be analyzed and optimized in this step [9]. The architecture step also
includes a set of significant decisions related to software development
that should be aligned with the business objectives and the organization.
2. Development. The development phase can mainly be grouped into
implementation and testing steps. The main goal of the development
phase is to implement a formal and organizational information system
based on the designed prototype in the design phase [10]. If the in-
formation system addresses all functional and user requirements it will
enter the testing phase.
10 Artificial Intelligence Methods for Optimization of the Software Testing Process

- Implementation. After all mentioned design activities are com-


pleted, developers start implementation according to the requirements
and design to develop a rough prototype of the software product (see
the “Deployment” step in Fig. 2.1). Moreover, the required policies,
guidelines, procedures, and standards for the implementation step are
defined by the stakeholders. The implementation step usually includes
the following operational activities: creation of a database for gathering
the relevant data and creation of a graphical user interface which can
interact with the backend [11].
- Testing. Testing can be considered as the most critical step in the
development phase. The main objective of this step is to ensure that
all requirements are met. In this regard, the components and their in-
teractions should be tested. The testing step can be divided into the
following three main activities: test design, test creation, and test ex-
ecution. In the test design and creation steps, the requirements (both
functional and non-functional) need to be analyzed in order to create
a specific test case. Later, the created test cases will be executed gen-
erally into the following main testing levels: system testing, integration
testing, acceptance testing, and unit testing [1].
3. Evaluation. During this step, one aims to deploy the system while
identifying the system weaknesses [12]. Although the evaluation is the
final phase of the software development life cycle, in an agile process
evaluation should take place during all the mentioned phases. More-
over, the following two main decisions can be made based on the
evaluation process.
- Maintenance. Maintenance involves making changes in hardware
and software and also making adjustments to requirements and poli-
cies to improve the system’s performance [13]. Additionally, enhanced
security, identification of unanticipated needs, and addressing of user
requirements can be achieved in this step.
- Disposal. Disposal represents the end of the software development
life cycle when the system in question is no longer useful, needed,
or relevant [13]. Based on the decisions in this step, the information
system might be discarded, destroyed, or archived, or all arrangements
may need to be transmitted to a new system.
We need to consider that the mentioned phases, steps, and activities
can be changed, skipped, or merged in different software development life
cycles. Consequently, the provided information in Fig. 2.1 is mapped and
Basic software testing concepts 11

transferred from some large-scale software development projects which are


going to be analyzed as case studies in the upcoming chapters.

2.2. Software testing


As stated in Section 2.1, software testing can be considered as the
most vital step in the software development life cycle. The main objective
of testing is to ensure the highest possible quality in the final product in
order to avoid a faulty product being delivered to the end-user. The lack of
adequate quality assurance might cause a loss of confidence in the company,
a bad reputation, or penalties worth millions of dollars. As is obvious now,
software testing is a complex process; therefore, testing a software product
is a time- and resource-consuming process which can take up to 50% of
the total development cost [14]. ANSI/IEEE 1059 standard defines the
software testing process as follows [15].
Definition 2.2. Software testing is a process of analyzing a software item
to detect the differences between existing and required conditions and to
evaluate the features of the software item.
In other words, software testing aims to check whether the actual soft-
ware product meets the expected (functional and user) requirements and to
ensure that the final software product is defect-free.

2.2.1 The procedure of software testing


Today, the process of testing a software product can be performed manually,
semi-automatically, and fully automatically, which all relate to the proce-
dure of executing a test case.
Definition 2.3. A test case is a specification of the inputs, the execution’s
pre-conditions and post-conditions, the testing procedure, and also the ex-
pected results which need to be analyzed in order to verify compliance
with a specific requirement [16].
In manual testing, a tester performs the tests step by step following a test
case (specification), whereas during automated testing, a test case (script)
is executed by employing test automation tools and frameworks. As the
name suggests, semi-automated testing is a combination of manual and au-
tomated testing procedures, where there are some limitations to automating
the entire testing process or advantages to keeping segments of the process
12 Artificial Intelligence Methods for Optimization of the Software Testing Process

Table 2.1 Comparison of automated and manual software testing in six aspects.
Parameter Manual testing Automated testing
Test design Does not require the coding Drives a test-driven develop-
process. ment design.
Setup Requires a more straightfor- Requires less complex test exe-
ward test execution and system cution and system setup.
setup.
Processing Time-consuming and requires Significantly faster than man-
time human resources and observa- ual testing, does not require hu-
tion. It has a higher risk of miss- man judgment and observation.
ing out on the pre-decided test Also, it has a lower risk of miss-
deadline. ing out on a pre-decided dead-
line.
Cost Not cost-efficient for a large Not cost-efficient for a small-
product with a high volume of size product with a low volume
test cases. of test cases.
Accuracy Has a lower accuracy due to the Has a higher accuracy, since
possibility of bias and error in there is no testing fatigue due
the human judgment. to the tools and scripts.
Knowledge Requires just domain knowl- Requires both domain knowl-
edge in testing. edge in testing and program-
ming knowledge.

manual. In a semi-automated testing process, the automation might be ap-


plied at the beginning of the testing process, in the end, or somewhere
in between. Selecting a proper testing procedure aligns with the size of
the software product, company policies, and the testing level, which are
discussed later in this section. However, each of the mentioned testing pro-
cedures has its own advantages, disadvantages, and limitations. Table 2.1
compares the differences between manual and automated testing using dif-
ferent parameters.

2.2.2 Software testing life cycle


As demonstrated in Fig. 2.1, the process of software testing can be divided
into several phases, activities, and steps, regardless of the testing procedure
(manual, semi-automated, or fully automated). Therefore, it can be de-
scribed as a cycle known as the software testing life cycle.
In other words, a software testing life cycle is a testing strategy that
encompasses a sequence of different activities performed by the testing
team to ensure that all features are tested and that all the project’s require-
Basic software testing concepts 13

Figure 2.2 A customized version of a software testing life cycle model. Source: Authors’ own
contribution, inspired by the original model of the software testing life cycle.

ments are met [17]. However, in such as software development life cycle
some common activities are usually defined in a software testing life cycle
framework, based on the software product size, complexity, and company
policies. Fig. 2.2 provides an overview of a typical software testing life cycle,
including the following activities:
1. Requirement analysis. Requirement analysis refers to the analysis of
client and stakeholder system requirements. In this step, the test team
analyzes the requirements from a testing perspective. Since this step is
the first step of a software development life cycle, some business re-
quirements specification documents need to be shared in advance by
the stakeholders. Moreover, the testing team needs to check if all the
requirements are testable or not. The decision (e.g., mitigation strat-
egy) about the non-testable requirements and the automation feasibility
should be made in this step.
2. Test planning. In this step, the required resources (e.g., manpower,
tools), cost, and deadline need to be estimated based on the analyzed
requirements in the previous step.
3. Test development. The required activities in this step are directly
related to the testing procedures (manual, semi-automated, or fully au-
tomated). Test case specifications and test scripts will be created and
generated for the manual and automated testing procedures, respec-
tively. In some testing processes, a requirement traceability matrix needs
14 Artificial Intelligence Methods for Optimization of the Software Testing Process

to be designed in this step [18]. A typical requirement traceability ma-


trix can guide the testing team to verify whether the requirements are
fulfilled via tracking the connections between the requirements, test
cases, and test results.
4. Environment setup. In this step, the environment information, hard-
ware limitations, and software requirements need to be identified.
However, this step can also be performed in an early stage of the testing
cycle parallel with the test planning and design.
5. Test execution. In this step, all designed test cases need to be executed.
Generally, the result of a test case execution can be Pass, Fail, Partly Pass,
or Not Executed. In some testing cycles, just the Pass result is acceptable
and all other test results will be reported as Fail. Based on the test
execution results, several decisions should be made such as bug tracking,
troubleshooting, re-execution, or software change request.
6. Test cycle closure. Test cycle closure can be considered as the fi-
nal step where the entire testing cycle should be evaluated based on
several criteria, e.g., requirement coverage, time, testing resources, and
the achieved quality. Moreover, analyzing each testing cycle might pro-
vide some clues to improve the testing cycle (e.g., removing the process
bottlenecks) in the future. Usually, a test closure report including a mea-
surement of the mentioned criteria should be prepared and archived.

2.2.3 The levels of software testing


All mentioned activities inside a software testing life cycle can be done
at different levels of testing. The following four main levels of testing are
applicable to almost all testing processes:
1. Unit testing. All individual units (e.g., individual function, compo-
nents, modules, or objects) of a software product need to be tested.
Moreover, the unit tests are usually automated tests, which isolate a
section of code and verify its correctness [19].
2. Integration testing. Integration testing occurs after unit testing and
before system testing, where individual units are combined and tested as
a group. In some testing processes, most of the hidden bugs in a software
product can only be detected when the units are interacting with each
other, which makes the integration testing more complex [20].
3. System testing. System testing is performed to validate the complete
and fully integrated software product. The entire system needs to be
tested as a whole at this level, in order to verify if the system works as
expected [21].
Basic software testing concepts 15

4. Acceptance testing. A system should be tested for acceptability and


delivery. Moreover, the system’s compliance with the business require-
ments needs to be evaluated in this step [22].
Furthermore, “regression testing” is another important concept in the
software testing domain, which is not a separate level of testing. In fact, re-
gression testing is a type of testing that can be performed during any of the
four mentioned software testing levels. The main purpose of performing
regression testing is to check if the existing features are affected by code
changes [23].
We need to consider that all the four main mentioned testing levels
can be fulfilled in different orders. Therefore, several testing models and
approaches, such as the waterfall model, V-model, agile model, spiral model, and
iterative model, are proposed in both state of the art and practice. However,
selecting a proper testing model is aligned with the project deliverables and
the complexity of the project.

Figure 2.3 The V-model in software testing. Source: Authors’ own contribution, inspired by the
original V-model.

Fig. 2.3 shows the structure of a typical V-model for testing a software
product. As we can see in Fig. 2.3, the verification (development) and vali-
dation (test execution) activities are performed side by side in downhill and
uphill shapes. Furthermore, the unit testing is the first level where the ac-
ceptance testing must occur as a final level of testing in the V-model. The
V-model is a popular approach especially in large industries because it saves
time by detecting the defects in an early stage of the testing process. Due
to the mentioned advantages, the conducted industrial case studies in this
book are mapped with the V-model.
16 Artificial Intelligence Methods for Optimization of the Software Testing Process

2.3. Test artifacts


Test artifacts are generally referred to as a set of documents (in various
formats) that are generated or manually created during the software testing
phase in the software development life cycle. Test artifacts should be con-
sidered as integral parts of each software testing process that can help the
testers track the changes and the recent progress of test activities from the
requirements, up to test execution records [24]. Test artifacts can be sum-
marized into the following types: requirements specification, test specification,
test script, software test report, and traceability matrix.

Figure 2.4 A Venn diagram of the software test artifacts. The red zone represents a manual
testing process, whereas the green zone indicates an automated (or semi-automated) testing
process. Source: Authors’ own contribution.

However, the mentioned test artifacts are going to be manually created


or automatically generated based on the testing procedure. Fig. 2.4 shows a
general overview of the mentioned software test artifacts. As we can see in
Fig. 2.4, the red zone represents a manual testing process, whereas the green
zone indicates an automated or semi-automated testing process. Moreover,
the requirements specification and software test report are held in common
in both testing procedures (see the joint part of Fig. 2.4).
Additionally, the presented software test artifacts in Fig. 2.4 also demon-
strate a visualized overview of a typical traceability matrix, where the
Basic software testing concepts 17

connections between the test artifacts are represented by the arrows. As


we can see in Fig. 2.4 the requirements specifications are going to be em-
ployed for both creating manual test specifications (see the red zone) and
generating the automated test scripts (see the green zone). The dashed ar-
row in Fig. 2.4 indicates a common way of generating a test script. In some
testing processes, the test specifications are going to be utilized for gener-
ating the test script. However, there are some tools that just employ the
requirements specifications for test script generation. Finally, regardless of
the utilized testing procedure, the software test reports need to be created
manually (in the text format) or automatically (in a log report format) after
each test execution. In order to allow readers to have a better overview of
the mentioned test artifacts, some running examples are provided in the
upcoming subsections.

2.3.1 Requirements specification


In this subsection, we present a set of requirements specification examples.
Requirements specification would normally be performed by a require-
ments engineer in the team.
Definition 2.4. A requirements specification is a textual document that
describes the features and the behavior of a software application [15].
An example of a requirements specification that is extracted from the
DOORS database1 at Alstom Sweden AB2 is presented in Table 2.2.
As we can see in Table 2.2, information such as requirement ID, name
and description, action type, and module number is provided in a require-
ments specification.
The inserted information in a requirements specification highly depends
on the testing domain. For instance, the Requires and Provides columns in
Table 2.2 represent the names of the signals in a train system. Furthermore,
through analyzing a requirements specification, in this case, we can derive
the signal dependencies between different signals and thereby between the
requirements. For instance, signal 273965 is dependent on signal 273957

1 The IBM Rational DOORS Next Generation database is a leading requirements manage-
ment tool that makes it easy to capture, trace, analyze, and manage changes to information.
2 Alstom Sweden AB is the largest player in the Swedish railway market, with over 1000
trains delivered. Alstom is a multinational rolling stock manufacturer operating worldwide
in rail transport markets, active in the fields of passenger transportation, signaling, and lo-
comotives, with products including the AGV, TGV, Eurostar, Avelia, and New Pendolino
high-speed trains, in addition to suburban, regional, and metro trains and Citadis trams.
18
Artificial Intelligence Methods for Optimization of the Software Testing Process
Table 2.2 A requirements specification example for testing a train system, extracted from the DOORS database at Alstom Sweden AB.
ID Name Description Action type Link: Requires (>) Link: Provides (<) Module
280191 Critical GIVEN: TCMS receives critical relays Functional Signal: 273957 Signal: 273965 4967
relays status status from CTC Signal: 239030
THEN: TCMS-VDU shall display the
critical relays status on car level. Critical
relays are shown in ATP-ATO,
Propulsion and Brake screens.
Discovering Diverse Content Through
Random Scribd Documents
exchange a few ideas that to strangers might have the merit of
novelty.
So at eight bells, 8 p.m., as her lights were seen stationary abeam
about a mile away, a boat was lowered from the Eliza Adams into
which the captain and C. B. with the boat’s crew descended, and
pulled away into the darkness until the dim black hull of the vessel
they are bound to suddenly loomed huge and threatening from the
darkness.
“Ship ahoy!” roared the skipper. “Here’s Captain Taber of the Eliza
Adams come a gamming.”
“Welcome, Captain Taber, I knew it was you as soon as I heard ye
hail. This is the Matilda Sayer of Dartmouth, Captain Rotch.”
“Good lad,” yelled Captain Taber delightedly. “Pull two, stern three,
ah! unrow there;”—and as the boat ranged alongside he gripped the
man ropes and ascended the side ladder of rope like a goat climbing
a precipice.
While the two old friends greeted each other there was a whirring of
sheaves and down came the mate’s boat into the water. Dark forms
leapt into her and she pushed off, immemorial custom having
decided that in gamming when the captain visits a ship the mate of
that ship goes a visiting his fellow on board the other vessel. As they
pushed off into the darkness a voice was heard above, “Haul up and
hook on, chums,” and they did so, their boat being cheerily hoisted
into the position the other had left. For this was also a pleasant sea-
custom among whalers, being eminently practicable because of the
almost standard size of all whale boats.
Arriving on deck the four hands were immediately haled forrard, and
C. B. was welcomed in the half deck by the harponeers, where such
hospitality as they possessed was offered him and all hands crowded
around him eager to talk to him, and listen to what he had to say.
First of all with native courtesy they inquired what sort of a season
the Eliza Adams was having and other matters of that kind, but he
could not help noticing that they all looked curiously at him, as if
they could not quite make him out. At last the old carpenter, a fine
venerable Yankee, said—
“Whar d’ye hail from, mister?”
“I come from Norfolk Island,” replied C. B. pleasantly.
“Well, do tell,” ejaculated the cooper, “I didn’t know they was ever
any natives on Norfolk ’cept convicks from England, and I heerd that
they was done away with long ago. An’ yew don’ look like a Kanaka
neither.”
“Neither am I,” explained C. B. with gentle dignity. “Surely you must
have heard of the Pitcairn Islanders finding Pitcairn too small for
them, and a number of them being sent by the British Government
to Norfolk Island, which was given them to live in.”
A chorus of remembrance arose in a babel of voices until the old
carpenter, getting up, came close to C. B. and peered in his face
intently, at last remarking quietly, “Did your father ever go to sea in
a spouter, young feller?”
“Oh yes,” answered C. B.; “he was in the Rainbow and the Canton,
both New England whaleships, for a considerable time.”
“And what might his name be, if he’s still alive, as I hope?”
“Thank you, he’s still alive, or was three months ago, when I left
home, God bless him, and his name is Philip Adams!”
The effect upon the carpenter was electrical. He smote his thigh with
great violence and shouted—“Boys, thishyer fine specimen of a boy
is the son of the finest specimen of a man that ever trod God
Almighty’s earth. Nine months I was shipmates with him in the ole
Canton, and if ever a man was tried by a lot of ornery scalawags, he
was. He could a broke any one of ’em in pieces with his fingers; he
was as much above ’em at any kind o’ work as he was in strength
an’ good looks, yet that mis’ble gang used to chip him, poke fun at
him, play tricks on him, until I used to feel as if I could a killed ’em
myself, and I warn’t much better than they was. But never once did
anybody hear an angry word or a bad word of any kind outer his
mouth, never once did he miss a chance of doin’ even the worst of
his tormentors a good turn, and never once did anybody have real
cause of complaint about his work or anything that he did. And
when he left the ship to go home because his agreed time was up, I
never see such a carryin’ on, you’d a thought everybody on board
had lost father and mother and all their other relations. Young
man”—solemnly—“if you’re only one quarter as good a man as your
father was, the ship is entirely blessed by having ye aboard, and I’m
honoured at bein’ able to shake ye by the hand.”
There was a momentary pause as “Chips” sank down on his chest
again, and C. B.’s eyes glistened with heavenly pride at the honour
paid to that dear father whom he so fondly loved. Then he said—
“My dear dad is all you say of him, and all I am or ever likely to be
that’s any good I owe to him and mother. But he is a very quiet
man, especially about himself, and so we knew little of what he had
gone through. I understand it better now since I have been whaling
myself. I thank you with all my heart for what you have said about
him, it has done me more good than you can possibly imagine.”
There was rather an awkward pause after this, as if the other
members of the half deck hardly knew what to do with such a
prodigy as they now believed they had got in their midst. But the
carpenter came to the rescue by saying—
“Looky here, youngster, your father had a very tuneful voice of his
own, and although he didn’t talk much he would sing by the hour, all
about God and heaven and the like, and my! but it made me feel
right good. D’ye happen to take after him in that?”
C. B. flushed a little and replied—
“Since I’ve been to sea I’ve never sung a note except humming to
myself. But I used to sing at home a good deal, and I’ll be very glad
to try if you like. I only sing hymns, though.”
“That’s quite good,” hastily answered the carpenter, “your father
didn’t sing anything else either, an’ I don’t suppose any of us will
know the difference. We’re all more or less heathen, you know.”
So without further pressing C. B. lifted up his sweet tenor and sang
“O God of Bethel,” amid a silence that was positively painful in its
intensity of attention. And as soon as he had finished he was
disconcerted by a very tempest of applause and vociferous shouts of
“Same man sing agen. Bully for you, old hoss,” etc., etc. And nothing
loth C. B. sang again and again, his repertoire being tolerably
extensive and his memory as good as his bringing up would
naturally make it, until tired out he had to cry off. Then, and not till
then, it was found that all hands in the ship, forgetting the gam, had
crowded as near to the half deck as possible, charmed by the sweet
strains.
The whole incident brings forcibly to my memory an experiment of
my own once when gamming a ship called the Cornelius Howland off
the Three Kings, New Zealand. I was one of the visiting boat’s crew,
and after the usual topics of conversation flagged a song was called
for. I explained that I had some pretensions to a voice, but could
only sing hymns, for in the sect among whom I was converted it was
esteemed wrong to sing anything secular, and mortal sin to go to
any place of amusement whatever. It was immediately explained to
me that so long as I sang, the words did not matter in the least,
especially as scarcely anybody would understand me. So I piped up
instantly with a favourite of mine from Sankey’s book, “Through the
Valley of the Shadow I must go.” It was received with shouts of joy,
one man who was especially delighted saying, “Well, —— my eyes,
that’s what I call a —— good song, d’ye know. I could sit and listen
to that kind o’ singin’ all night.”
I humbly apologize for the blanks, but the reader will, I hope, feel as
I did, that the forcible expletives they represent meant nothing to
the speaker, who was only using his ordinary language. I only know
that I went on singing to the exclusion of everybody else, and was
quite hoarse the next day from the unaccustomed vocal exercise, for
we didn’t sing very much in my ship. After all, it was not much to be
wondered at, for the polyglot crowd met with in the forecastle and
half decks of a whaler has usually one gift in common—an intensely
musical ear, although the execution of pleasing music is denied them
in nearly every instance. And for instrumental music they usually
have that truly infernal instrument, the accordion, from which the
most ingenious musician that ever lived can draw nothing but noise.
So that a little real music is received with great joy.
At midnight the cry was heard, “Eliza Adams’ boat’s crew away,” and
C. B. sprang to his post, but not before his new-found friend “Chips”
had handed over to him his choicest treasure, a small parcel of well-
thumbed books, ragged copies of Dickens and Charles Reade, with
one or two others by less known authors, but all to C. B. a
storehouse of wonders, a treasure unlocked. Then with a warm
handshake they parted, C. B. feeling happier than he had done since
leaving home. Never before had he realized how much he had
craved for sympathy and the opportunity to express himself in terms
of love and admiration for his Father in heaven. And when they
presently reached the ship Captain Taber said to him—
“You seem to have had a pretty good time, Christmas. I heard you
singing away and remembered how your folks used to sing. It must
have been quite a treat to you to let loose again.”
C. B. said nothing, for he did not feel that any answer was required
of him, but he longed with greater desire than ever to be able to talk
about the matter that lay nearest his heart. No one who has not
been in a similar position can begin to realize what it means to be
dumb upon the one topic that interests you. To feel that if you
mention it to anybody you will not only not be understood, but your
words will be construed as an insult. But he gave a great sigh and
took the matter quietly to the Lord as was his wont, feeling much
comforted thereby, strengthened to wait and endure as long as he
should be called upon to do so. And all unknown to him relief was at
hand.
Two days after meeting with the Matilda Sayer the crow’s-nest
reported whale in the usual manner. But this time it was a lone
whale of very large size steadily making a passage across the
ground at a leisurely pace. Now a lone whale is always potentially
very dangerous, because his loneliness is due to the fact that he has
been cast out of the society of his kind. A big bull whale only
maintains his position as leader of the school as long as he is able to
beat all aspirants to the dignity. And as the young bulls growing up
are continually striving to attain that position, it will easily be seen
that to keep it the holder must be of exceptional strength and vigour,
while the day will surely come when in the natural order of events
he will have to abdicate, which does not mean that he may take an
inferior position in the school, but that he must leave it altogether
and from henceforth until the end, which may be many years
distant, he must roam solitary.
But this condition of existence for the whale naturally means that he
becomes morose, savage and wary. And if he should in addition
have been the object of attack by whalemen and have got away
from them, he becomes doubly dangerous because of the never-to-
be-forgotten lessons he has learned as to how to act, and also
because it usually happens that he carries with him, imbedded in his
flesh, some rankling fragments of bombs and certainly a galling
harpoon.
Now in consequence of these well-known facts concerning the lone
whale, it is usual to approach him with considerable caution. But
there are many whalemen to whom caution in dealing with their
gigantic quarry is a word of no meaning, they are reckless in the
extreme, and no amount of disaster ever seems sufficient to teach
them. Of such was Mr. Merritt: that strange composed man took fire
within when approaching a whale. He “saw red” as the saying is,
and although handling his boat and using his weapons with
consummate skill, he had not one iota of prudence in his whole
make up.
Now on this momentous occasion, because it was a lone whale,
Captain Taber ordered the chief and fourth officers away, keeping
the other boats in readiness to lower of course should there be any
necessity, but not anticipating that more would be needed. It was a
fine day, but the wind was high and the sea was correspondingly
heavy. According to etiquette Mr. Winsloe was first on the whale,
into which Pepe with his usual skill planted both irons right up to the
hitches. Mr. Merritt lay off a little with his boat, noting with some
surprise that no frantic wallowings and struggling followed the dart.
Assuming, as was most natural, that Pepe had failed to strike the
whale, he pulled up rapidly, having dowsed his own sail, to where
Mr. Winsloe’s men were busy getting their mast down.
When within a couple of boat’s lengths of them all were horrified to
see the huge black head of the whale suddenly rise ghost-wise on
the port bow of the boat, while the gleaming pointed lower jaw
emerged from the water on the starboard side. The view was only
momentary, for as they gazed horror-stricken they saw the great
jaws close, crashing through the flimsy sides of the boat as if she
were of so much paper, and with a yell that rang high above the roar
of wind and sea the crew sprang clear of the wreck for their lives.
But C. B.’s eagle eye noticed on the instant that the harponeer had
disappeared, and in a second he had leapt from the boat into the
vortex caused by the wallowing of the whale, dived and caught at a
black mass far beneath the surface, the body of Pepe entangled by
the whale line. Fortunately at that moment the whale, disdaining to
seek safety in flight, returned to the surface, and consequently there
was little difficulty for such a powerful expert as C. B. to bring his
prize to the surface, free him from the line, and assist him back to
the boat. I say assist, for Pepe, though grievously injured, had never
lost consciousness, and in consequence was able to make some
feeble attempts to help himself.
By the time he had been hauled inboard the rest of the crew had
been rescued and the bight of the line, which C. B. had dropped as
soon as he had cleared it from Pepe’s limbs, was picked up and
taken through the notch in the bows, displacing their own line. Now
Mr. Merritt was in his element, danger and difficulty of any kind
seemed to give the needed stimulus to his otherwise sluggish
nature. Charging the rescued crew to double bank the oars, and
placing the injured man in the bottom of the boat, he changed ends
with C. B. and awaited the onslaught of the whale.
That monster played the usual waiting game, just appearing for an
instant to spout, and then only exposing the point of the snout
where the spiracle or blow-hole is situated. He was waiting his
opportunity to perform the same operation on the second boat as he
had done on the first. But Merritt seemed to have placed himself in
absolute correspondence with the whale’s mind, for each time that
either the great flukes or the ponderous jaws appeared above water
the boat by a quiet order had been driven to a safe distance, and
the threatened blow or bite did not take effect. In fact the queer
yellow man was playing the waiting game also, knowing that the
whale’s exertions were rapidly tiring him out.
For, strange to say, vast as is the strength possessed by these
monsters, they tire very soon when they have to exert themselves
much. And it is only when they are allowed to take things easily, as
sometimes happens through cowardice or unskilfulness on the part
of the whalemen, that they are able to weary out their aggressors
and finally emerge the victors in the long fight. At last Merritt saw
with a chuckle of delight that the whale was going to rush him head
and head as we call it. He had his bomb gun ready to hand, and
laying down his hand lance he put it to his shoulder, crying—
“Now, stern all hard and keep her just as she heads, Christmas.”
With so much power at the oars the boat rushed swiftly astern as
the whale came rushing on, the great head rearing high out of water
and exposing the gleaming white cavern of the throat.
Coolly, as if ashore at some practising ground, Merritt took aim and
pulled the trigger. There was a splash, a report, and an appalling
commotion in the sea ahead of the boat, in the midst of which
another report was heard, the explosion of the bomb within the
whale’s body. “Way ’nough,” shouted Merritt, and the boat stopped a
cable’s length away from the place where the mighty mammal was
tearing up the deep in his Titanic death throes. For a few moments
the scene was appalling, almost akin to a submarine volcanic
eruption, then the uproar suddenly ceased and the magnificent
beast lay dead, listlessly tossing upon the waves which the exuding
oil from his wounds turned into smooth hummocks of water quietly
rising and falling around.
The tumult had hardly subsided when the second boat ranged
alongside with orders to Mr. Merritt to return at once with his
overmanned boat. And he obeyed cheerfully, because nothing is
more annoying than to try and work in a boat where the hands, by
reason of their being too many, get in one another’s way, this being
especially so when, as was now the case, one man grievously hurt
was lying in the bottom of the boat. They soon reached the ship and
climbed on board, Mr. Winsloe hastening to the skipper and
reporting the catastrophe, while all hands rallied on to the falls and
ran the boat up with Pepe’s unconscious body in it. He was tenderly
lifted out and carried aft on to a mattress, where his clothes were
removed, disclosing the severe nature of his injuries. The whale had
evidently nipped him sideways, for the great teeth of the lower jaw
had made eleven ghastly bruises, each four or five inches across,
and in three places the clothing was driven deep into the blackened
flesh. Three of the largest ribs were broken, and the right arm was
horribly lacerated by the whale line being twisted round it under a
great strain.
But owing to the bluntness of the teeth there had been no loss of
blood, except in so far as it had blackened and spread under the
skin, which of course was highly dangerous from the possibility of
mortification and the absence of any but the rudest surgery.
However, all that could be done for the poor wretch by way of
cooling lotions and bandages was done, and he regained
consciousness to fall into a refreshing sleep.
Meanwhile the crew had toiled fiercely under the direction of the
mate to get their prize alongside, finding as it was hauled near that
its dimensions were more imposing than they had imagined.
Measured along the rail it was roughly seventy feet in length, which
is as far as is accurately known about the limit of size for a cachalot,
while as it lay on its side, its jaw parallel to the ship, it looked as
imposing in size as a vessel of two or three hundred tons bottom up.
The fluke chain was passed without difficulty, and all the available
force of harponeers and officers that could get at it attacked it at
once with almost desperate energy, for it was getting late in the day,
the night promised to be very dark, and none relished the prospect
of pursuing that gigantic task without other light save that afforded
by the feeble cressets. To Mr. Merritt and C. B. fell the task of
severing the monstrous head, a labour which it is most difficult to
realize. There is but a slight crease in the place where a neck ought
to be, and here the carcass is nearly twenty feet through—a mass of
muscle and sinew with scarcely any soft parts, and right in the
centre of it the huge ball and socket joint of the vertebrae which is
composed of bones nearly two feet thick. And if those spades
plunging down into the depths of that mass darkly (for it is
impossible to keep the scarph open) should miss the joint, as it is
exceedingly likely they may, the additional work is tremendous. I
have seen this task occupy the labours of the whole of the officers
and harponeers of a ship, relieving one another at frequent intervals,
for a whole day.
But this huge toil is but little greater than that which is being
prosecuted at the same time by the others, all of whom are
balanced upon the precarious plank of the cutting in stage,
suspended far out over the side and springing to every roll of the
ship. There is the junk to be divided from the head, a mass weighing
eight to ten tons cut diagonally from the lower point of the upper
jaw, and there is also the huge oblong mass of the case, or really
half the remainder of the head, to be cut through, where a careless
lunge of the spade may cause the leakage of all the valuable
spermaceti which it holds in a liquid state. In this immense task
strength avails little unless allied to skill, and skill is of small use
without strength and endurance to keep driving the spade in the
right place.
In a small whale, as I have hinted before, these operations are much
simplified, because the head can be cut off and hoisted on deck,
where the work of severing junk and case is quite easy. But as now
the whale was of the largest size and most of the work had to be
done upon the huge masses rolling and tumbling in the unquiet sea
beneath, all the strength, patience, and endurance possessed by the
workers were needed to the very limit. At last the head came off,
and a great groan of relief went up from Merritt and C. B., whose
arms felt as if they would drop off through sheer weariness. But
there was no prospect of rest, the only relief they could hope for
was a change in their movements bringing a different set of muscles
into play. The blubber hook had long been in position affixed to the
eyepiece, and no sooner did the huge mass of the head surge astern
than the high clear voice of the captain rose—
“Heave away there cheerily now, I want to see how quick ye can
skin this whale.”
He was answered by an incessant clattering of the pawls as the
windlass brakes flew up and down, and the first blanket piece of
blubber, a foot thick and nine feet wide, rose majestically into the air.
As soon as the blocks of the tackle came together the windlass
stopped, while the captain, armed with a formidable boarding-knife
like a cutlass blade stuck in a long wooden handle, cut a big circular
hole in the centre of the blanket piece, thrust the strap of the
waiting tackle through it and secured it by a large wooden toggle,
shouting as he slipped it into its place, “Heave on yer whale, my
hearties, heave on yer whale: surge on yer piece!”
“Oh what a jargon,” I think I hear some reader say wearily. I’m
sorry, but it can’t be helped. It only means that the men at the
windlass heave on the second tackle and let the fall of the first slip
round the windlass barrel. Then as soon as the second tackle has
taken the strain “Vast heaving” is called, while the captain with his
boarding-knife cuts through the blanket piece high above the hole
he made for the securing of the second tackle and the mass, now
disengaged, is lowered into the blubber room.
It sounds like a lengthy process but really is not, for in the present
instance the captain’s appeal was answered so well that in twenty-
five minutes the whole of that vast carcass was denuded of its
blubber and had floated away, the centre of a ravening horde of
sharks.
CHAPTER XI
The Story of a Crime

Although it would be quite unfair to imagine from the immense


activity prevailing in the ship during the cutting-in that Pepe was
neglected, it is certain that according to a very well understood and
constantly acted upon rule in South Sea whalers, work connected
with whaling takes precedence of everything else. Nothing is allowed
to interfere with it as long as it is humanly possible to carry it on.
Remembering the quite scanty rewards to be obtained on an
average by the most ardent and successful whalemen, the absolute
impossibility of any supervision by the owners for three or four years
at a time, it is, I think, little short of marvellous to note the
extraordinary energy and perseverance manifested by these men, of
whatever grade above that of seaman, in the chief business of the
voyage.
Physical injury, lack of rest, incredible toil, privation suffered are all
made light of in the chase, capture, and disposal of the whale.
Charges are often brought against the leaders of gross inhumanity
to the men working under them in the absence of full restraint; but
as far as that cruelty consists in overwork, or work under desperate
conditions, I bear witness that if the sailor or foremost hand is not
spared, neither do those who drive him spare themselves. The
voluntary work that I have seen some of these men perform would
be taken as incredible if I were to relate it, and I therefore shrink
from giving instances. Besides, to the majority of those whom I hope
will read this book, the whole business would be unintelligible
because entirely out of the purview of a serene and quietly ordered
life.
This terribly energetic method of working was a most severe lesson
to C. B., hard to learn, harder still to understand. For in the gentle
life of the islanders, though great efforts were sometimes necessary
in an emergency, as we have seen, they had no ideas of hard work
as a habit, for the love of working hard, or for the greed of gain.
They were as far removed from being ascetics as they were from
being hypocrites. They loved their simple pleasures and heartily gave
thanks to God for them, and they could not understand why any
sane person should misuse his body in order to get more than
somebody else had—the last condition being an unthinkable one to
them where everything was held in common. But it had not taken C.
B. long to discover that in the new world of which he was now a
denizen, might and endurance, as well as ability to get and keep,
were the objects of praise and almost worship. That men were held
in esteem, not for what they were, but for what they had, and that
the easiest sneer to their lips was that a priest, a parson, or a
religious man of any kind was an individual who had found that the
easiest way of getting a living without work was gaining a hold over
the minds of your hard-working fellows by pretending that you were
in touch with the unseen world.
So he had early come to the conclusion that he must prove his
manhood by his eagerness to work, his indifference to fatigue, and
his ability to do all that was required of him, as well as by his
passive obedience to all the loving precepts of the Gospel. And this
kept him going sometimes when he would fain have sunk down with
fatigue, a generous pride and belief in God’s sustaining power as
being certainly no less able to uphold the Christian than the
mysterious force that kept Merritt, the man of no beliefs and
strangest origin, going apparently with ease when everybody else
was sinking with fatigue. Nobly he sustained his part, and nobody
suspected how near he was several times to giving up and declaring
that whatever happened he could work no more without rest.
This present business was really the severest he had gone through,
because his successful effort to save Pepe was made under the most
trying conditions, every ounce of his great strength as well as his
endurance of privation of air had been put forth, and then as soon
as the ship was reached work harder than ever had to be engaged
in. Consequently as soon as the last case had been strung up
alongside by the two main tackles and the business of baling it out
had commenced he was most thankful to hear the skipper say—
“Now, I’ll watch these fellows baling the case, an’ all the rest of ye
scoot, get a good skin full of grub and a rest. We’ll set blubber
watches at eight bells” (eight o’clock p.m.).
As they stepped away from the waist, with all its débris of quaint
fragments of blubber and bone, and the swish, swish of oil surging
from side to side of the deck, Merritt said to our friend—
“Christmas, me boy, I ain’t too sorry to knock off for an hour or two.
I believe I’m getting old; can’t work day in and day out ’thout
wantin’ a rest same as I used to.”
C. B. replied simply—
“I thought you could hardly be made of ordinary flesh and blood.
You seem to work like a machine and never to think of rest, while I
often find myself wondering how much longer I can hold out.”
“Ah, me boy,” responded Merritt, laying his hand most affectionately
on C. B.’s arm, “you forget the differences between our ages. You’re
only a boy just done growin’, ’bout twenty-two ain’t ye? while I—well
I don’t quite know how old I am, but I guess about thirty-five, have
got all my gristle hardened into man, and can plug along ’thout
showin’ it. But you shape better than any youngster I ever see.”
As Merritt finished speaking, C. B. suddenly bethought him of Pepe,
lying aft there in miserable pain, and slipped along to his side.
Finding the wounded man awake he dropped one knee beside him,
saying—
“How is it, Pepe? Can I do anything for you, get a pipe, a drink, or
move you?”
Pepe looked up at the fine eager face, and moistened his lips twice
or thrice before he replied with another question: “What made ye
save me? If I’d been in your place, I’d let ye die, an’ glad o’ the
chance. An’ I’d be best pleased if you’d let me go when I was three
parts gone. I don’t want t’ live cos you’ve beat me, you an’ yer
Chinaman. Go away; I hate ye, an’ if I could I’d kill ye now. What did
ye ever come aboard this ship for? Ye’ve made a hell of her for
better men than you are.”
C. B. knew better than to stay and talk to a man in that frame of
mind, a man too who, for all he knew, might be raving in delirium;
but he thought with some consolation of certain unclean spirits of
old who cried to the healing Lord, “Art thou come to torment us
before our time?” and turned away to his berth below, where he
found a good and ample meal awaiting him. He ate and drank
reverently, gratefully, and then, greatly refreshed, lay down in his
bunk and went fast asleep almost on the instant, having not a single
care of his own. And, as it happened that he was not in the first
watch, it was 2 a.m. before he was called, and then he sprang to his
feet at the word full of life and energy.
When he rushed on deck he found the machinery of oil-boiling in full
blast, the caldrons bubbling fiercely, the square iron funnels of the
try-works blazing like the squat chimneys of an iron foundry, and the
clatter of the mincing machine incessant. He had little imagination or
he would have thought what a picture she made, this tiny hive of
human energy with all her toilers, in the midst of that immense
stretch of lonely ocean, engaged in converting to human use the
treasure of the boundless deep ravished from its mightiest denizen.
But he only saw a little group of almost dead-beat men who had
been working mechanically for hours, only thought pityingly of the
ill-requited toil and what he considered to be the folly of it all.
Then he plunged into the work himself, while the second and fourth
mates prowled about the decks, keeping a vigilant eye upon possible
shirkers, seeing the great casks rolled away from the cooler as the
cooked oil was poured into them and they brimmed over. In fact the
ship was now just a floating factory from which, except to an
observant onlooker if such there had been, all romance had
departed to make way for the greasy heavy toil. No lookout was
kept, no hand at the wheel, which was lashed hard a lee; for, in case
any other ship should be wandering that way, the trying-out whaler
was a beacon in herself, visible for many miles. She certainly could
not run another ship down, and any one who run her down could be
little less than a criminal lunatic, at least quite unfit to have charge
of a ship.
So the heavy round of work went on without intermission until,
about 4.30, the darkest hour before the dawn, all hands on deck
were startled beyond measure by hearing a high clear voice crying—
“Ship ahoy! What ship is that? Do you need any assistance?” All eyes
were turned in the direction of the hail, and there close by them
rode a ship of war, her side crowded with men plainly visible in the
blue flare she was burning, but looking all corpse-like in that
unnatural light.
Loud and clear came the response from aft, for Captain Taber
seemed to be always on hand when wanted: “Ship Eliza Adams of
New Bedford, whaling, now engaged in trying out.”
“Thank you,” came the somewhat dissatisfied answer across. “I
thought you were on fire. Good-night and good luck. Go ahead,
please; forty revolutions, course S.80.W.”
It was only one of the police of the seas, a British man-o’-war
attached to the South American Squadron; but as she did not leave
her name or destination no one on board could guess who she was.
Captain Taber said sardonically, “That’s a Johnny Haul Taut, I bet;
thinks he owns the show. But I guess he’s ben sold a pup this watch.
Wonder what sort of guff he’ll enter up in his log about this.” It was
not generous, but characteristic of American captains in discussing
British seamen and their seamanship, and we can hardly quarrel or
bother with it to any good purpose. But what was entered in the log
was just this—
“Saw a glare to the eastward, looking like a ship on fire, altered
course at 3.55 a.m. to E.N.E. and ran down at full speed, twelve
knots. Discovered the glare to be the whaleship Eliza Adams of New
Bedford trying out a whale. Resumed course immediately, S.80.W.,
forty revolutions. Weather as before.”
By the next day at noon the deck was clear of all the filth, and the
factory-like work was proceeding with machine-like regularity, all
hands being now well rested. And as cask after cask was filled at the
cooler and rolled away to a secure temporary berth on deck, the
captain was heard to say something to this effect: “I thought so. I
guessed that whale to be about the biggest in all my experience, an’
now I’m gettin’ to be sure of it. Never saw a bigger whale nor yet
richer blubber.” By which he meant that the blubber was so full of oil
that when cut the clear fluid gushed almost like water and besides it
was full of cysts, small cells of about the size of peas, which were
filled with a bland substance of the consistency of cream, probably
almost pure spermaceti.
For although the great reservoir of spermaceti is in the head, in this
case yielding nearly fifty barrels or five tons of almost pure
spermaceti, this curious substance is found in the oil from any part
of the body, particularly the great dorsal hump. Why the head should
have so huge a quantity of this fluid contained in it is a mystery, the
only supposition concerning its use being that its very low specific
gravity brings the vast mass much more quickly to the surface than
would otherwise be the case, and brings it up too in such a position
that the spiracle or blow-hole is the first portion of the whale to
break water. This substance has nothing in it of the nature of brain
matter—the brains are quite small in proportion to the size of the
creature—but it has been held, in view of the high intelligence
shown by the whales and seals, all of which are noted for their
apparent paucity of brain, that this thought or intelligence matter is
distributed over the different nerve centres, or to put it more
colloquially, the creature has, like the telephone system in a large
town, several local exchanges, as well as one central exchange for
the transaction of general business.
And in the same way it has been supposed that the whales, huge as
they are, cannot possibly contain sufficient air for the needs of the
creatures during the prolonged period—often nearly an hour—during
which they remain under water, since they have no other means of
aerating the blood whatever. So it has been assumed that in some
mysterious way the vital principle of the air, oxygen, is in some way
secreted during the period that the whale is on the surface, a
supposition which is somewhat supported by the fact that the whale
upon coming to the surface must make so many respirations, always
the same in number, before he can seek the depths again, which
would point to some process going on in addition to ordinary
breathing. Also it would certainly be impossible for him to sink if he
inflated himself, as it were, by shipping a great reservoir full of air.
But this is probably enough of whale anatomy for one chapter, so I
will leave the subject for a while, merely recording that the captain’s
most sanguine expectations were fulfilled, the whale yielding one
hundred and sixty barrels or sixteen tons of oil and spermaceti,
which at the then high market-price of the day, £108 per ton, made
the handsome sum of over seventeen hundred pounds for less than
a week’s work. Of course the long spells of inaction and the heavy
outlay as well as upkeep must be borne in mind, and I do not
suggest that the great game was ever in the nature of a gold mine,
only that when a monster like the one we have just tried out was
obtained he made a very considerable addition to the profits of the
voyage.
All the oil having been run down, and the lavish application of lye
and sand to the decks and paintwork having made the ship look her
usual smart self, the monotonous old routine began again, but for
our hero at least its monotony was a thing of the past. For one thing
he began on his bundle of books, only reading a very little at a time
at first, but gradually getting absorbed in them and reading on to
the great loss of his sleep. But oh, to be able to read like him, to
drink with an entirely unsophisticated thirst at the fountain of good
literature believing every word as if it were directly inspired! Of
course he read his Bible as he had always done, from a genuine love
of it and a full appreciation of its living histories, not at all as a
religious duty, but as with his wonderful memory he knew it nearly
all by heart, it was entirely delightful to him to get hold of something
fresh.
At last his chief, Merritt, said to him one night, with just the slightest
shade of grievance in his voice, “’Pears to me you’re mighty busy
these days, too busy to have a yam even. What ’yer doin’ anyhow
with yer nose in a book all the time?”
For a moment the idea of the extremely taciturn Merritt wanting a
yam almost made C. B. smile, but he suppressed the impulse and
replied apologetically—
“I’m afraid I’ve been a bit selfish of late, but the fact is I’ve just
found my way into a new world. I never knew how much there was
in books before, and I forget everything else but the people that
seem to be all alive before me, doing and saying things that I never
dreamed of before. You see, I’ve missed very much the long talks
and pleasant society that I’ve been used to all my life till I came
here, for no one here seemed to care about anything that I like, and
I can’t listen to their yarns at all: they’re all dreadful to me because
of the bad language.”
Merritt looked at him keenly for the space of a minute, and then said
as if thinking aloud, “I wonder what Pepe thinks of ye now since you
saved his life. Don’t seem overnabove thankful ’s far ’s I can see.
Spoke t’ him yet?”
C. B. flushed dark red as he replied, “Yes, I asked him the next day
if I could do anything for him, and I found him as bitter as ever. He
knows all about the business—how, I don’t know, but he does—and
he seems to hate me worse for it. What it means I don’t understand,
but I can’t alter it, and so I must let him go his own way.”
“I know,” grunted Merritt; “he’s a bad man, eaten up with jealousy
of you. If you’d a ben a no ’count greenie that couldn’t keep your
end up, an’ had to knuckle down to him in the half deck same as his
other cronies do or did, you wouldn’t had no trouble with him. I got
no use for men like him except to make oil, for he’s a pretty fair
average whaleman—I’m not denying that.
“But what I like about you is that you’re not only a good whaleman,
but you’re a good man. An’ now I want to tell you somethin’. I ben
achin’ to get it off my chest for a long time past, ever since I took
such a shine t’ ye at the first lowerin’. I told yer I had a chum once,
didn’t I? Yes; well, I picked him up on the beach at the Bay of
Islands. He’d swum ashore from the Guidin’ Light, a whaleship that
had the reputation in her day of being the worst of all the bad ships
that ever went a spoutin’. He was pretty desperate, but he knew
enough not to try and skip while she was anchor: the standin’
twenty dollars reward would ha’ put every Maori in the
neighbourhood on his track in a fluke-twist. So he waited till she was
under weigh, and then when she was well off the heads he slipped
down a rope and put for shore.
“Well, he’d fetched round to Russell, an’, mind I’m telling ye, they
were pretty hard crowd there those days, so if a poor devil had no
money he stood a gaudy chance of starvin’. Well, I was in a good
homely ship, the Mornin’ Star, the skipper’s boat-header at that, an’
we come into the Bay of Islan’s to wood and water up an’ give
liberty as usual. I come ashore with the skipper as soon as the
kellick was down, and while he was up at the store I strolled along
the beach an’ I finds Dick, the chap I’m talkin’ about, lyin’ on the
sand half dead. I gives him a kick just to let him know he was liable
for a sunstroke, and he gets up halfway and looks at me just like a
dog I had once. That was enough for me. I gets him up, takes him
to old Rowsell’s store, and fills him full of good grub an’ beer, and
then when the skipper come along I puts in a word fer him an’ he’s
taken aboard.
“We happened to be a couple of hands short, so the old man wasn’t
sorry to have him, and I—well, I don’t know what it could ha’ been,
but I got so fond of that fellow you can’t think. When he got into
decent rig, and had two or three square meals, he was a different
chap, quite handsome and a regular Jim Dandy. He was a white man
too, some sort of an Englishman I guess, an’ he could talk like a hull
box o’ books. We was only about nine months out from New Bedford
when he came aboard, an’ before another three months he’d so
twisted himself around me, one that had never had a pet before
since I first knew myself, that I’d ha’ died for him. He was after
oarsman in my boat an’ smart too, but, though I wouldn’t see it
then, he was a coward an’ a sneak of the worst kind. I was in hot
water the whole time takin’ his part, for he was always in rows, an’
used to run to me like a kid. I think I liked him all the more for that,
an’ beside a row has always ben a sort o’ tonic to me.
“Looking back now I can’t understand the hold that fellow had over
me, for he was always playing some dirty trick or another, not on
me, but other fellows, an’ I had to get him out o’ them. An’ if ever I
went for him real angry, he could always salve me over in a few
minutes with that soapy tongue of his. At last I found him out. We
went into Callao, an’ it was the days when shanghaiing was carried
on wuss there than anywhere else. No one was allowed out of the
ship except on such business as takin’ the skipper ashore, an’ then
we was forbid to leave the boat. But he had ben there before, an’
knew Buck Murphy, the big shanghai boss, who used ter come down
on the quay an’ yam with him very quiet. One afternoon while we
was waitin’ for the skipper, Dick persuades me to come up to a
house not above two ships’ lengths away an’ have a drink with him,
bringin’ two hands out of the boat with us and leavin’ a Kanaka in
charge. It was only to be for a minute.
“Even t’ this day I don’t know what made me go. I knew better, o’
course, an’ I never did care much fer drink anyway. But that fellow
could make me do anythin’ he liked, I believe, an’, so I went, like a
silly goat as I was. I smelt somehow that all wasn’t right when I got
in, for there was as tough a lookin’ crowd as ever I see sittin’ about,
an’ half of ’em looked ready to begin on anybody they didn’t sorter
just cotton to. But I had my drink, three fingers of aguardiente, an’
so did the two chaps as was with us, two Yanks they was. Just as I
puts my glass down I sees Dick lookin’ at me curious, an’ in that
moment I knew that he had sold me. I never want to feel like that
again. The bottom seemed to have fell out of everything. I jumped
up, knockin’ the big table over; I heard an’ awful crashin’ an’ bangin’
an’, then nothin’.
“When I came to agen I was bein’ hauled along a deck by the neck,
an’ I was feelin’ wuss nor ever I had felt in my life. I heard
somebody yell ‘up with ye, dirt; an’ loose that maintgallant s’l,’ an’ I
started, the sailor in me, I s’pose. But as I got on the sheer pole I
looked around, for my head was gettin’ clearer, and there, not
more’n a mile away was the Mornin’ Star at anchor, an’ we flyin’ past
her at the rate o’ knots before a fresh breeze under topsails fore and
aft. Just one look was enough for me. I slued round and dived,
comin’ up headin’ straight for the ole ship. And the skunk in charge
o’ that hooker that I’d ben shanghaied into stood on his poop an’
took pot shots at me from a Winchester as long as he could see me.
But he dassent heave to where he was ’n I played the ole islan’
game on him, boy, long swim under water, bob up an’ a guts full of
air, then down agen. Why, I’d run the blockade of forty ships if only
the water was rough enough.
“Presently the old man sees me, he’d ben disturbed by the noise o’
the shootin’, an’, as he afterwards told me, he ups with his glass an’
makes out who it was. An’ then he was that excited he couldn’t keep
still; but he had too much savvy to lower a boat until the ship that
I’d jumped from was outer gunshot. Then they come an’ picked me
up. I was feelin’ real good, for that swim had put new life inter me.
When I got aboard the ole man was that delighted t’ see me I
thought he’d a cried, an’ I was some glad t’ get back. I told him all I
knew, an’ he says, ‘Why that chum o’ yours is wuss an’ what even I
thought him, an’ you know I never did like him. He got down inter
my cabin that day somehow and stole about two hundred dollars in
money an’ some bits o’ julery as I prized, an’ I hain’t heard nothin’ of
him since.’
“I didn’t say nothin’, I couldn’t, but I reckoned that if ever I met Mr.
Dick agen, no matter where or how, it’d be his last meetin’ with
anybody.
“I went an’ had a good sleep an’ a feed, an’ that night as soon as it
was dark I goes t’ the skipper an’ says I: ‘I’m goin’ ashore, sir, with
your permission, but I don’t want no boat, I’ll swim.’ He knew me an’
he says, ‘Well, if you must you must. But I don’t want t’ lose ye, try
an’ get back agen.’ An’ I says, ‘You bet I’ll be back before mornin’.’
So I puts my ole bowie in my belt, slips down over the side, an’ puts
for the shore. It was only a couple o’ miles off, so I was as fresh as
paint when I lands, an’ then I starts off on my search. I knew, of
course, that my joker calc’lated on me bein’ a good many miles away
by this time, so I didn’t dodge about, I went straight to the rum mill
he’d lured me to. An’ when I shoved open the door, there he is, a
settin’ with a big drink afore him, and Buck Murphy with two other
boys o’ the same class sittin’ around with cards in their hands. They
were playin’ bluff.
“I wasn’t: I made one jump at him like a cougar. I knew I could a
had him out o’ the middle of a regiment of soldiers, an’ as I went I
knocked the kerosine lamp over that was on the table so that the
only light that there was came from the burnin’ ile lappin’ around the
wooden shanty. I got him by the neck, with my left hand. With the
other I pulls my knife an’ as I choked him I felt for anythin’ touchin’
me an’ cut at it. The flame burst up high an’ showed me the rest o’
the crowd clearin’, so I pulls up quickly an’ has a good look at him. I
thought he was dead, but I makes sure an’ then has a peep round.
An’ in the corner of the room I sees a big hole. Bein’ as clear in my
mind as I am now I makes a breach for it, guessin’ what it was,
drops through it an’ finds myself in the harbour which was all right.
“So I takes a little journey, lands and get my bearin’s on, then
paddles off quietly to the ship feelin’ quite easy in my mind. I got
aboard agen at midnight, and was very near shot by the mate who,
seein’ me climb inboard in the dark, thought I was some pirate or
another. I jollied him a bit about his shootin’, not much, because I
ain’t big on the shoot myself, then turned in, tellin’ him I’d give the
cuffer t’ the skipper in the mornin’.
“I was middlin’ tired, an’ I had to be called at two bells, an’ as soon
as I come on deck the ole man says, ‘So you got back all right,
Merritt?’ ‘Yes, sir,’ I says, ‘an’ I’ve squared the account. Mister Dick
won’t sell any more men, his pleasant little game is stopped for a full
due.’ ‘Why, you surely didn’t kill him, did you, Merritt?’ says he,
holdin’ up both han’s as if he was scared like. ‘Well, if I didn’t,’ says
I, ‘it’s a funny thing to me. But I don’t think there’s much doubt
about it;’ an’ I went on to give him the story. Would you believe it,
he looked at me as if I hurt his eyesight, an’ from that out I don’t
think he really ever liked me. Some men is like that, ye know. They
know you’ve done the right thing, yet they hate ye for doin’ it. But
that didn’t trouble me any.”
All through the long recital C. B. had listened with mingled feelings
of admiration and horror, and when Merritt had finished he held out
his hand and said—
“Mr. Merritt, I feel that your deed was terrible, but I can’t find it in
my heart to blame you, except that you acted in revenge. But that
man was a danger and needed killing, I know, and I feel that you
were only the instrument in doing a necessary work. I couldn’t think
any less of you, for I believe you acted according to the light you
had, and anyhow I love and admire you.”
CHAPTER XII
C. B.’s Great Temptation

From that eventful evening the friendship between these two most
strangely assorted chums deepened in force until every man in the
ship knew certainly, what he had only suspected before, that
whoever took it in hand to do despite to one of them would surely
have to reckon with the other. And that knowledge had a wholly
quietening and sweetening effect upon all hands. Every one knew by
this time, knew intimately, that C. B.’s principles were of a high and
noble kind, that he would always be on the side of the good and
true, and would be ready to put up with much trouble and
annoyance from anybody rather than assert himself. But they all
knew also that his chum Merritt was of a totally different stamp.
They felt that, given what he considered cause, he would as soon kill
a man as eat an orange, and they were afraid that if they offended
C. B. and Merritt got to know of it, he might suddenly apply his own
method of chastisement to the offender.
And so the Eliza Adams became a most eminently peaceful as well
as hard-working ship. Captain Taber used to gaze admiringly upon
the quiet gangs working here and there, with never a voice upraised
in anger, and say to his mate, “Winsloe, I’ve often said that the day
of miracles was long past, but I ain’t so sure now. You and me
always looked upon the old hooker as a good ship, an’ by jingo, she
was a good ship compared with lots that we’ve known, a perfect
little galley of angels, but they was a good deal of rough house at
times in order to keep her good, now wasn’t they?”
“True ’nough, captain,” sententiously assented Winsloe, “men must
be kep’ in hand.”
“That’s just my point, Winsloe,” eagerly interrupted the skipper.
“Ever since the weltin’ that Merritt gave Pepe she ain’t wanted no
keepin’ in order, she’s been an abode of peace; y’ haven’t had t’
raise yer voice above a whisper to get everything done on the
instant. Whatever is it in this young fellow that makes such a change
in everybody that comes near him? Some fellows hate him like
pizen, others freeze to him like Merritt, an’ yet he doesn’t do or say
anythin’ except his plain duty.”
“I guess I don’t know, sir,” yawned Winsloe as if tired of the subject.
“S’long as a man does his work ’thout giving trouble I ain’t usin’ my
brains on his character. Don’t make no sort o’ difference t’ me.”
“Ah, I see,” murmured the skipper, and turned away, fully convinced
in his own mind that Mr. Winsloe did not view C. B. with any favour,
in fact, was a man of that strange mind calibre, that praise of any
other man, whether affecting him or not, acted upon him like a
personal affront.
Thereafter for a space of three months, during which they continued
to cruise the off-shore ground with fair success, taking altogether
some four hundred barrels of oil, no incident occurred worth making
special mention of here. Only it could not escape the notice of any
unbiassed observer like the skipper, how, with the exception of the
other boat steerers and the three officers above Merritt, all the crew
seemed to worship C. B.; their faces brightened whenever they saw
him. And then there came another explosion with Pepe again, who
seemed to have grown moodier and more sullen, although he was
just as good a whaleman as he had ever been.
It was during the trying out of some oil, just at the change of
watches, that one of C. B’s boat’s crew, coming hurriedly on deck,
charged into Pepe, who stood wiping his hands by the mincer,
having just relinquished the baler to C. B., standing on the try-works
platform. It was a pure accident, due to the quantity of oil on deck.
And besides, the man, a Yankee from Vermont, was not in the best
of health, for he was suffering from a severe outbreak of painful
boils. But Pepe sprang to his feet and seized the unfortunate fellow
by the throat, forcing him against the rail, and had already struck
him a heavy blow in the face, when C. B. leaped from his place on
the platform, and snatching Pepe’s just descending arm cried, “Let
the man alone!”
Pepe turned like a baffled tiger, all teeth and snarl, and grappled C.
B., everything forgotten but his present desire to do harm to the one
who had got in his way.
A serious smile was on C. B.’s face as he easily held the furious man
who, lost to all sense of danger, strove to get at his knife. Seeing or
rather feeling this, C. B. lost his temper and, freeing his right arm,
struck at Pepe’s face once, twice, with crushing force; then as if
maddened beyond endurance he clasped Pepe in his arms and
dashed him against the bulwarks where he lay limp and motionless.
C. B.’s anger passed as rapidly as it had kindled, and falling on his
knees in the oil by the side of the unconscious man he tore open the
breast of his shirt and felt his breast, finding to his immense relief
that his heart was beating, though feebly.
Then rising, he lifted the limp body in his strong arms and bore it aft
out of the way of the oil. He was about to get some restoratives
when a hand was laid on his arm, and turning he saw Merritt who
said—
“Looky here! no more foolin’ with that nigger. He ain’t hurt any
worth speakin’ of, an’ you’re only spoilin’ him. ’Sides, your pot wants
lookin’ after. Get back t’ yer work and leave him t’ learn his lesson.”
C. B. obeyed mechanically, but with a dull feeling of regret at his
heart, for he was afraid of that demon that had so suddenly arisen
within him, remembering keenly as he did the last occasion when it
had done so. And as he went on with his baling, he prayed fervently
to be delivered from what he felt was the awful danger of taking a
fellow-creature’s life in anger.
All the while he was thus accusing himself the rest of the watch,
with the exception of Mr. Spurrell, who was asleep and heard
nothing of the fray, were almost beside themselves with joy at the
thought that the gentle kindly fellow whom they all loved could on
occasion use the great strength they knew he possessed not only in
self-defence but for the defence of others. The man whom he had
rescued, in particular, was from thenceforward his devoted slave; no
one could say a word even remotely disparaging C. B., but he was
upon them like a faithful dog in defence of his master. And strangest
of all, C. B. never heard another word about it from anybody. Pepe
was all right to all appearance at the change of watches, and if the
captain knew he never mentioned it.
Now I fear that there are many good people who will feel that C. B.
was woefully lacking in what they consider should be the first
attribute of the Christian—the ability and grace to submit not only to
any violence offered to themselves, but to witness any shameful
oppression of others with the same meekness of spirit. I verily
believe, I must believe, judging from what I read written by these
people and what I have heard them say, that if they saw the last
extremity of murderous outrage being offered to their nearest and
dearest they would only drop upon their knees and pray that God
would pardon the perpetrators; they would not dare to interfere,
actively, nor if they were able would they allow others to do so. Nay
more, if any person did interfere, and in defence of their children
happened to shed the blood of the aggressors, they would be the
first to call him or them murderers.
It is an attitude of mind which I do not pretend to understand, but
one that is all too common and widespread to ignore. It is far
removed from the spirit of the ancient martyrs, in that its professors
are usually the very first to cry out for protection of their own bodies
and property by the forces of the law. And I can only characterize
such people by the plain old name of coward. More, I do not believe
that God saves a man to make him a coward, but to make him as
brave as was the Gentle Saviour when he scourged the infamous
rabble out of the Temple, alone and unaided. But our curious
weaklings would have reserved their wrath for the scourge wielder,
their pity for the scoundrels. Would! nay do so every day, as the
columns of our newspapers bear witness.
And now the time approaches when C. B. is to endure the heaviest
temptation of all. The season was over on the off-shore ground, and
the good ship was put under all sail for the Sandwich Islands, it
being the captain’s intention to visit Honolulu to refit there and
replenish with wood and water. As soon as the news became known
all hands went nearly wild with delight, for in those days Honolulu
was a place where, in spite of the efforts of the missionaries, scenes
of the wildest licence and debauchery took place upon the arrival of
a whaleship whose captain was kindly disposed enough to give his
crew liberty and money. Reminiscences of former excesses were now
on everybody’s tongue, even the taciturn Merritt became almost
garrulous in describing to his chum what he considered to be the
attractions of Honolulu and its environs.
In his innocence and ignorance C. B. listened greedily to these tales,
and asked many questions, which made Merritt grin and wonder
loudly that any man should be so fresh and green as he put it. And
there was no one to warn, nothing to give any hint as to the
foulness of what was coming. More than that, there was an uneasy
sense in C. B.’s mind of being gradually estranged from the high and
holy thoughts which had always been his precious possession, even
his prayers were becoming perfunctory as the scenes so vividly
depicted by the conversation of his fellows rose before his mental
vision and his curiosity with regard to them grew stronger.
They made a very fine and uneventful passage to the islands,
arriving off Honolulu in the early dawn of a perfect day, and working
into the harbour, where four other whaleships were lying at anchor,
in the usual easy seaman-like fashion of those ships. The vessel was
moored smartly, and the order given to furl all sail, and in carrying
out this order an incident occurred which brings into my story for a
little while a man who has not received any but cursory mention and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like