Code Structure for Unit Testing

2019 ◽  
Author(s):  
Bill Mårtensson
Keyword(s):  
2017 ◽  
Vol 23 (2) ◽  
pp. 659-686
Author(s):  
Gábor Márton ◽  
Zoltán Porkoláb

In C++, test code is often interwoven with the unit we want to test. During the test development process we often have to modify the public interface of a class to replace existing dependencies; e.g. a supplementary setter or constructor function is added for dependency injection. In many cases, extra template parameters are used for the same purpose. All existing solutions have serious detrimental effects on the code structure and sometimes on the run-time performance as well. In this paper, we overview existing dependency replacement techniques of C++ and we evaluate their advantages and disadvantages. We introduce our non-intrusive, compiler instrumentation based testing approach that does not have such disadvantages. All non-intrusive testing methods (including our new method) require access to an object’s internal state in order to setup a test. Thus, to complement our new solution, we also present different approaches to conveniently access private members in C++. To evaluate these techniques, we created a proof-of-concept implementation which is publicly available for further testing.


1995 ◽  
Vol 10 (6) ◽  
pp. 245 ◽  
Author(s):  
Gang Luo ◽  
Robert L. Probert ◽  
Hasan Ural
Keyword(s):  

2019 ◽  
Vol 2 (3) ◽  
pp. 164-169
Author(s):  
Mohammed Faza ◽  
Maulahikmah Galinium ◽  
Matthias Guenther

An energy supply system consists of a system of power plants and transmission anddistribution systems that supply electrical energy. The present project is limited to the modellingof the generation system. Its objective is the design and implementation of a web-basedapplication for simulating energy supply systems using the Laravel framework. The projectfocuses on six modules representing geothermal energy, solar energy, biopower, hydropower,storage, and fossil-based energy that are allocated to satisfy a given power demand. It isexecuted as a time series modelling for an exemplary year with hourly resolution. Thedevelopment of the software is divided into four steps, which are the definition of the userrequirements, the system design (activity, use case, system architecture, and ERD), the softwaredevelopment, and the software testing (unit testing, functionality testing, validity testing, anduser acceptance testing). The software is successfully implemented. All the features of thesoftware work as intended. Also, the software goes through validity testing using three differentinput data, to make sure the software is accurate. The result of the testing is 100% accuracy withrespect to the underlying model that was implemented in an excel calculation.


2021 ◽  
Author(s):  
James E. McDonough
Keyword(s):  

Biosystems ◽  
2021 ◽  
Vol 210 ◽  
pp. 104528 ◽  
Author(s):  
Konrad Pawlak ◽  
Małgorzata Wnetrzak ◽  
Dorota Mackiewicz ◽  
Paweł Mackiewicz ◽  
Paweł Błażej

Sign in / Sign up

Export Citation Format

Share Document