UT-Assert Library Presented by Charles Zogby, NASA-GSFC

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Test Logging and Automated Failure Analysis Why Weak Automation Is Worse Than No Automation Geoff Staneff
ITEC113 Algorithms and Programming Techniques
VBA Modules, Functions, Variables, and Constants
CS 201 Functions Debzani Deb.
The Program Design Phases
Reusable Code For Your Appx Processes Presented By: Gary Rogers.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Chapter 06 (Part I) Functions and an Introduction to Recursion.
Subprograms CE 311 K - Introduction to Computer Methods Daene C. McKinney.
Oracle Data Integrator Procedures, Advanced Workflows.
Computer Programming I Hour 2 - Writing Your First C Program.
Introduction to Perl Yupu Liang cbio at MSKCC
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
MuSL Builder Handcrafting custom Mu Scenarios. MuSL in the Mu Scenario Editor.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Getting Started with SIDL using the ANL SIDL Environment (ASE) ANL SIDL Team MCS Division, ANL April 2003 The ANL SIDL compilers are based on the Scientific.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Debugging COMP T1.
 Problem Analysis  Coding  Debugging  Testing.
cFS Platforms OSAL and PSP
ifstreams and ofstreams
3.1 Fundamentals of algorithms
Build Automation with Gradle
A Guide to SQL, Seventh Edition
Software Testing.
Open Source Software Product Status
cFE FSW at APL & FSW Reusability
cFS Workshop Introduction
Intro to Python Programming – Part II
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Fundamentals of Programming I Design with Functions
The Selection Structure
LESSON 20.
Introduction To Flowcharting
SECTION 3 MACROS: OVERVIEW.
Microsoft Access Illustrated
Microsoft Visual Basic 2005 BASICS
Unit testing C# classes
Lab 2 : Structures Muhammad Zaigham Abbas Shah DIGITAL INSTRUMENTATION SYSTEMS.
cFS Workshop Product Management
Some Basics for Problem Analysis and Solutions
Unit# 9: Computer Program Development
Some Basics for Problem Analysis
Program Design Introduction to Computer Programming By:
Lecture 09:Software Testing
Testing and Test-Driven Development CSC 4700 Software Engineering
Introduction to Classes and Objects
Introduction to Primitive Data types
Chapter 15 Introduction to Rails.
Design and Implementation
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Functions Christopher Harrison | Content Developer
GSFC cFS Product Status
ECE 103 Engineering Programming Chapter 56 Runtime Errors
CHAPTER 17 The Report Writer Module
Algorithms and Problem Solving
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
A programming language
Creating Computer Programs
Topics Introduction to Functions Defining and Calling a Function
Introduction to Programming
ifstreams and ofstreams
Carthage ios 8 onwards Dependency manager that streamlines the process of integrating the libraries into the project.
Creating Computer Programs
ICS103 Programming in C 1: Overview of Computers And Programming
Introduction to Primitive Data types
Presentation transcript:

UT-Assert Library Presented by Charles Zogby, NASA-GSFC charles.a.zogby@nasa.gov The Johns Hopkins University Applied Physics Laboratory core Flight System Workshop December 12, 2016

Agenda 1.) UT-Assert Overview 2.) Benefits of Using UT-Assert 3.) UT-Assert Library Components 4.) Test Cases 5.) Test Output 6.) How to Get the UT-Assert Library

UT-Assert Overview Used for unit testing cFS applications and tasks through the use of assert statements An assert statement evaluates whether a condition is true or false and returns PASS or FAIL. Each test case is self-verifying, rather than needing to be manually verified after running Used to test functionality and code coverage of every function in an application, one at a time Each test should be completely independent from other tests All cFS API library functions (OSAL, PSP, and cFE) are automatically substituted with UT- Assert stub and hook functions Every cFS API library function has a corresponding UT-Assert stub function Tests can set individual stub functions to behave in 3 different ways: 1.) Return its default return value (usually CFE_SUCCESS) 2.) Return a specified custom value 3.) Execute a specified custom hook function and then return the resulting return value Some cFS API library functions have corresponding hook functions that are called by default Can be substituted for a custom hook function or a custom return value

Benefits of Using UT-Assert Predefined stub functions simplify testing of code that uses cFE, OSAL, and PSP No need to worry about how these functions work No need to set up complicated inputs to these functions Each test case is self-verifying, rather than needing to be manually verified after each run No need to compare output to an expected output Lends itself to good unit test coding practices Each test case only tests its designated function/operation Only results of function under test are verified – not results of subfunctions Facilitates testing of code coverage Keeping tests short and simple makes it easier to know exactly which lines you’re trying to cover

UT-Assert Library Components Contents: utassert.c /.h – defines the standard assert function, along with a few related functions utlist.c – defines functions to create linked lists, which are used elsewhere in the library uttest.c – defines the functions used to add and run test cases uttools.c – defines miscellaneous functions that are useful for unit testing ut_cfe_***_stubs.c – defines the stub functions for a particular cFS component, and supporting functions ut_cfe_***_hooks.c – defines the default hook functions for a particular cFS component

Test Cases Written by the user Tests a single condition, branch of code, etc, using assert statements Tests functionality and code coverage of each function in an application, one at a time Only needs to test the designated section of code Sub-functions are tested in separate test cases

Test Case Flowchart

Test Case Example Set Up Test Case Execute Function Under Test Verify Results

Test Output Line-by-line code coverage detailed in .gcov files generated when gcov is run Terminal Window Output example: Running Test: FM_InvokeChildTask_Test_WriteIndexEqualsQueueDepth PASS: FM_GlobalData.ChildWriteIndex == 0 PASS: FM_GlobalData.ChildQueueCount == 1 PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 Running Test: FM_AppendPathSep_Test PASS: strncmp(Directory, 'directory/', OS_MAX_PATH_LEN) == 0 Tests Executed: 178 Assert Pass Count: 679 Assert Fail Count: 0 gcov: '../src/fm_tbl.c' 100.00% 52 gcov: '../src/fm_child.c' 100.00% 481 gcov: '../src/fm_app.c' 100.00% 120 gcov: '../src/fm_cmds.c' 100.00% 285 gcov: '../src/fm_cmd_utils.c' 100.00% 174

How to Get the UT-Assert Library cFS NASA wide community Babelfish git repository Sourceforge https://sourceforge.net/projects/cfs-ut-assert/