You are on page 1of 4

International Journal of Scientific & Engineering Research, Volume 11, Issue 7, July-2020

ISSN 2229-5518

Test Driven Development of Automotive


Software Functionality
Yogesh T1, Dr.Vimala P2, Prathap Augustin3, Vishal I M4
1
MTech, VLSI design and embedded systems, Department of ECE, Dayananda Sagar College of Engineering, Bangalore, India
2
Professor, Department of ECE, Dayananda Sagar College of Engineering, Bangalore, India
3
Principal ESW Application Engineer, Volvo Group India private limited, Bangalore, India
4
Software Developer, TATA Consultancy Services Limited, Bangalore, India

Abstract— The increasing complexity of automotive software makes it highly difficult to develop the software with high quality in a small
span of time. The late detection of early errors, such as requirement inconsistencies and ambiguities, often increases software
development life cycle costs. In this approach, we discuss the Test-Driven Development (TDD) process for Automotive Software, which
introduces agile practices into the early phases of development, significantly reducing the risk of requirement inconsistencies and
ambiguities, and thus reducing development costs.TDD is one of the practical approach for improving the quality and reliability of software.
In this proposed methodology the tests are automated, the bugs are recognized and fixed, which in turn reduces the software development
life cycle costs and improves software reliability.

Index Terms— Test Driven Development, Automotive Software, Unit Testing, Automation.

—————————— ◆ ——————————

1 INTRODUCTION
A good software is very important for the proper function-
ing of the system. The increasing complexity and variations in
2 METHODOLOGIES
the automotive software has increased the burden on the de-
velopers to give quality software within a short interval of 2.1 Test Driven Development
time.[1] This has in turn led the developer to adapt Test Driv- TDD is an agile methodology that goes through these recur-
en Development methodology in the software development ring steps:-
process.

TDD is one of the software development process in which


the test cases are written solely based on the requirements,
then the code is refactored i.e. the code is modified until all the
test cases pass. This is a reversed way of software develop-
ment wherein usually the test cases are developed after the
code is completed and then tested against the unit test cases.

Unit Testing is a software testing method wherein individ-


ual modules of a software are tested. The sole intention of this
test is to check if each functionality of the software code per-
forms as per the requirements specification. These tests might
check an individual object, module, procedure, method or a
function. These tests separate a section of the code and check if The steps are illustrated below:
the code is working as per its intended functionality. 1. The requirements are analyzed for a given system and unit
test cases are written based on the requirements.
A good software is very crucial in the automotive industry, 2. Develop a software which passes all the unit tests created in
and their rising complexity must not only be handled, but the previous step.
their prudent behavior must also be taken care of. The nimble Until all the requirements are met through the software these
release cycles and the competition globally enforce efficiency two steps will be repeated.
and cost improvement continuously, hence heading towards Fig 1: Test Driven Development [3]
TDD is the key as the bugs will be identified in the early stages
of development of the software. TDD was popularized and rediscovered in 2003.This tech-
nique provides more confidence in the software developed
resulting in a simple design [2].

IJSER © 2017
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 11, Issue 7, July-2020
ISSN 2229-5518

It must be noted that TDD is a design and development


technique and not a testing technique. Production code is writ-
ten after the test cases. During the implementation of the code
the tests are added alongside until the test is passed, the codes
are refactored to improvise the code. Until the functionality is
fully implemented this cycle repeats as shown in figure 1.

Fig 2: Impact of TDD on the Code Complexity [3]

TDD also increases productivity in the long run, also TDD


decreases defect density in the long run or sometimes even
immediately.

The figure 2 shows that TDD approach does not have any
significant impact on the code complexity based on survey [3]

3 THE WORKFLOW to maintain, easy to add new features and easy to maintain it
in the long run. By running all the test cases again, the devel-
3.1 TDD Workflow oper can gain confidence that is not altering any functionality
which is already existing. [4]
The fundamental steps of TDD are:-
1. A test will be written for a functionality based on the
requirement.
2. The tests will be run and see if the new test code fails.
3. Codes will be developed to pass the tests. Fig 3:-The TDD Flowchart [7]
4. The tests will be run and passed after verification.
5. Code refactoring. 3.2 Automation
6. Regression testing needs to see if no functionality has
been affected. The increasing complexity of automotive software’s
brings the need to use automation methods for performing
In the beginning a small code will be written to test the in- tasks which are repetitive in nature. The main challenge in
tended functionality. In the second step the test will be vali- automating the unit test cases is it requires the knowledge
dated to test the correctness of the code, it must be noted that of the programmer and tester. Sometimes the data for the
the test must not pass at this point of time because our code is test cases can be inferred from the system requirements or
still not functional yet. The third procedure is that of develop- the code the proper validation and preparation of unit test
ing the code. Next, the desired implemented functionality is cases demands a lot of various multiple activities.
tested by running all the test cases. Next regression testing
needs to be done to check if all the functionality is working as Automating unit test cases mainly involve the following
intended. [3] steps:-

Passing the tests shows the correct behavior telling that the 1. Creation of requirement template which identifies output
code is working. But the developer has to keep the code clean and input parameters. Fields are mapped to the parameters
and well-structured for future modifications if any. Refactor- with the unit test cases.
ing is changing the structure of the program without altering 2. Fulfillment of the requirement template by setting certain
its behavior. The sole purpose is to create a code which is easy rules which gives us the information about the initial val-
IJSER © 2017
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 11, Issue 7, July-2020
ISSN 2229-5518

ues and return values of the corresponding parameters. 8 }


3. Re-verifying of the complete requirements with respect 9 }
to logical errors.
4. Generating the test cases as per the complete require- We can see how the code was refactored here and at this
ments. The set of generated test cases is stored as testing point the code is compiling and getting executed.
code. This code shows how the process of code is created and
5. Executing the tests based on the generated test file. [5] refactored under the TDD development process.
3.3 Unit Testing
5 CODE COVERAGE
Unit testing is the practice of software development
wherein the slightest testable parts of an application named
as units are independently and individually checked for its The standard of test cases can be decided by how much
proper working. To sum up the main intention is to sepa- code coverage has been completed. It is a measure of what
rate a written code to test and check if the functionality is part of the developed code is executed and what part has not
working as intended.If it is not working properly the code been exercised during testing. But reports show that there is a
will be refactored until all the unit cases passes in TDD. moderate to low correlation between code coverage and effec-
These tests are always undergoing revision control and is tiveness of test suite when the test suites size is controlled. It
an integral part of the developed code. should be noted that code coverage is just a measure of test
suites thoroughness. [6]

4 TDD INSTANCE
6 COMPARISON OF TDD AND TRADITIONAL TESTING
Consider an example wherin we are creating an string
element to be added in a list and checking if we are getting In TDD the test cases are written first and then refactoring
the same string from the respective class. of the code is carried out, in essence it is a code to solve a test
which is going to fail. Hence referred as Test First.
1 public void testElementList()
2 { But in traditional testing the code is written first and then
3 ElementList input = new ElementList (); the test code is written and executed. Hence referred as Test
4 input.addElements ("TDD"); Last.
5 assertEquals ("TDD", input.addElements ("TDD"));
6 } It must also be noted that refactoring is used slightly in
terms of Traditional Testing but it is not omitted .Refactoring
Consider the above test case which will throw an error as occours less frequently when programmers are addressing the
the ElementList class is still not created.The code developer code defects. [3]
will solve this error by determining the cause of the error i.e.
creating a class. 7 ADVANTAGES AND DISADVANTAGES OF TDD
Upon creating a class named ElementList the error will be
solved upon compiling, this is the first step to refactor our TDD has a major contribution to the software development
code. Methodology such as:-
1. Reduced the efforts of the developers
1 public class ElementList 2. Unit tests communicate how the software should be-
2 { have without any ambiguities.
3 } 3. Developers gain confidence of making changes to the
code any time during the development cycle and it
However, line 4 will still give an error since addElements keeps the software simple.
Method is still not created.We will solve this error by creat- 4. The software bug rates are drastically reduced.
ing a method named addElements as shown below.
While the major draw backs are:-
1 public class ElementList 1. It reduces the testers work and builds more pressure on
2 { the developer.
3 private List<String> ElementList = new ArrayList 2. The initial test writing is a tiresome process.
<String> ( );
4 public String addElements (String args) 8 CONCLUSION
5 {
6 this.ElementList.add (args);
In this paper we have discussed about the Test Driven
7 return this.ElementList.toString ();
Methodology and its various advantages in implementing it in
IJSER © 2017
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 11, Issue 7, July-2020
ISSN 2229-5518

the automotive software.TDD helps the developers write bet-


ter test cases that improves the software and covers more
branches. TDD is very useful in improving the productivity of
the software in the long run and contributes majorly in reduc-
ing the error density of the developed automotive software.
TDD has helped the developer’s gain deeper logical under-
standing of their code and has helped them improve their de-
velopment skills.An insight about TDD was presented in this
paper.

REFERENCES
[1] Carsten Wiecher, Joel Greenyer, Jan Korte,”Test-Driven Scenario Specification
of Automotive Software Components”, 2019 ACM/IEEE 22nd International
Conference on Model Driven Engineering Languages and Systems.
[2] John W. Burris,” Test-Driven Development for Parallel Applica-
tions”, 2017 Second International Conference on Information Systems
Engineering
[3] Shaweta Kumar, Sanjeev Bansal,”Comparative Study of Test Driven
Development with Traditional Techniques”, International Journal of
Soft Computing and Engineering (IJSCE) ISSN: 2231-2307, Volume-3
Issue-1, March 2013.
[4] James W. Grenning ,"Test Driven Development for Embedded C"
(2011, Pragmatic Bookshelf)
[5] Nalepa G.J., Kutt K., Kaczor K. (2014),"Can the Generation of Test
Cases for Unit Testing be Automated with Rules ,Artificial Intelli-
gence and Soft Computing. ICAISC 2014. Lecture Notes in Computer
Science, vol 8468. Springer, ChamD.S. Coming and O.G. Staadt, "Ve-
locity-Aligned Discrete Oriented Polytopes for Dynamic Collision
Detection," IEEE Trans. Visualization and Computer Graphics,
vol. 14, no. 1, pp. 1-12, Jan/Feb 2008,
doi:10.1109/TVCG.2007.70405. (IEEE Transactions )
[6] Ayse Tosun, Muzamil Ahmed, Burak Turhan, Natalia Juristo"On the
Effectiveness of Unit Tests in Test-driven Development", ICSSP '18:
Proceedings of the 2018 International Conference on Software and
System Process May 2018.
[7] Myint Myint Moe,"Unit Test using Test-Driven Development
Approach to Support Reusability", International Journal of Trend in
Scientific Research and Development (IJTSRD), Volume: 3, Issue: 3,
Mar-Apr 2019.

IJSER © 2017
http://www.ijser.org

You might also like