• Stars
    star
    1
  • Language
    Ada
  • Created about 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Supports functional testing using Tcl scripts.

Scripted Testing

Introduction

To set the scene, the Ada software under test (SUT) forms part of a system. Generally, the system will be constructed using a layered approach, and the other parts of the system that interact with the SUT are higher-level (which can call interface subprograms presented by the SUT) or lower-level (whose interfaces can be called by the SUT, or which can provide callbacks to the SUT).

This package is intended for testing at a level between unit testing (using, for example, AUnit) and integration testing (using real hardware). Unit testing tends to be fragile, requiring a lot of rework for even minor functional changes in the requirements.

The scripting language supported is Tcl, and specifically the Ada binding Tash. The reason for choosing Tcl rather than Python or Lua is that Tcl's interface is entirely string-based; this is important, considering the need to specify values of enumerated types.

Genesis

The project from which this project is derived is the author's ColdFrame; see that project's stubbing facilities.

ColdFrame is a code generation framework, and has its own approach to stubbing (mocking) subprograms. This package has a different, but related, approach.

Facilities

The package provides facilities to write new commands in Tcl to

  • call the interface subprograms presented by the SUT,

  • set up values to be returned by calls the SUT makes to lower-level system components,

  • call callbacks provided by lower-level system components,

  • delay for appropriate periods, and

  • check that the proper calls have been made to lower-level system components, with the required values.

It's assumed that the interface subprograms of the lower-level subsystems are stubbed so that:

  • in and in out parameters can be recorded for later checking,

  • out (and in out) parameter values and function return values can be provided to be returned to the SUT,

  • exceptions can be raised when required,

  • the number of calls to the subprogram can be checked.

The components of the package are Commands, Actions, and an Action Queue.

Commands

A Command implements a Tcl command.

It creates an Action to be executed at run time, and posts it on the Action Queue.

Some commands are provided by this package. Other commands are to be provided to support the specific application to be tested: typically, call_procedure param1 param2 ... (where the parameters are those required by procedure) and check_subprogram parameter value (to check the value passed to procedure in parameter on the last call).

Commands have to be Registered with this package, because once Tcl has been started (using Start, which doesn't return) no more Commands can be added. Registration would normally be done during elaboration of the package in which the Command is defined (see test/test-first.adb).

Actions

An Action carries the data required to enact the command at run time.

When it is executed, it performs the required action.

  • If all is well, it completes normally.

  • If some condition fails, it raises an exception (Execution_Failure) with a message stating the problem.

  • Any other exceptions are propagated.

Action Queue

When the Action Queue is started (using the go command), it repeatedly picks the next Action and executes it, until either the end of the queue is reached (which implies that the script has succeeded) or an exception is propagated (which implies that the script has failed).

The commands provided by this package are

echo "string"
outputs string to the terminal at run time. Useful to report the script's progress.
wait duration
delays for duration.
mark name
notes the time at which the command was executed.
wait_from_mark name duration
delays until duration after the named mark. It is an error if the indicated time has already passed. The mark can be re-used.
go
start executing the script.

Building

This is an Alire crate; to build, say alr build.

See a worked example in the demo/ directory.

More Repositories

1

cortex-gnat-rts

This project contains various GNAT Ada Run Time Systems (RTSs) targeted at Cortex boards: so far, the Arduino Due, the STM32F4-series evaluation boards from STMicroelectronics, and the BBC micro:bit (v1)
Ada
60
star
2

distributing-gcc

Binary releases of GCC (native and cross) on macOS; also, the scripts/Makefiles used for producing them.
Makefile
29
star
3

building-gcc-macos-native

Scripts for building GCC on macOS
Shell
11
star
4

ews

The Embedded Web Server is designed for use in embedded systems with limited resources (eg, no disk). It supports both static (converted from a standard web tree, including graphics and Java class files) and dynamic pages. It is written in GCC Ada.
Ada
11
star
5

stack_usage

Calculates the maximum stack depth required by GCC-compiled code
Python
10
star
6

analytical-engine

An Ada 2012 emulation of Charles Babbage’s Analytical Engine
Ada
9
star
7

ACATS

The Ada Conformity Assessment Test Suite, customised for GCC.
Ada
9
star
8

ASIS

Supports building the Ada Semantic Interface Specification library and tools for FSF GCC variants. Tracks AdaCore CE releases.
Ada
8
star
9

tcladashell

Ada binding to Tcl/Tk. Note, the copyright is GPL 2.0 + GMGPL
Ada
8
star
10

coldframe

ColdFrame generates Ada framework code and documentation from UML models.
Ada
7
star
11

nuweb.py

Literate programming in LaTeX; programming languages of your choice
Python
5
star
12

xia

An Ada implementation of XPath 1.0.
Ada
4
star
13

dhondt

Ada implementation of D’Hondt electoral result calculator
Ada
4
star
14

building-gcc-macos-arm-eabi

Scripts for building GCC on macOS as a cross-compiler to arm-eabi
Shell
3
star
15

adagoop

Generator of object-oriented parsers in Ada
Ada
3
star
16

libadalang2xml

Generates an XML representation of Ada source using libadalang.
Ada
2
star
17

asis2xml

Converts Ada sources’ ASIS representation to XML, so as to make it easier to develop reporting and transformational tools using (for example) XSLT.
Ada
2
star
18

leak_detector

Reports memory leaks in Ada programs.
Ada
2
star
19

alire-index.mac

Index of Alire crate versions catering for macOS idiosyncrasies
2
star
20

Quaternions

An Ada library to support using quaternions.
Ada
2
star
21

macos-sdks-vs-gcc

Provides GCC 'specs' files to cope with macOS SDK policy changes
Ada
1
star
22

synchronized_output

Supports text logging from multiple tasks
Ada
1
star
23

gnat_util

Provides access to GNAT compiler internals for AdaCore utilities
Makefile
1
star
24

xcode_15_fix

Xcode/CLT version 15 introduced problems for Ada programming on macOS.
Ada
1
star
25

ACATS-grading

Tools for grading ACATS results, modified for Unix-like systems
Shell
1
star
26

minimal_containers

Just enough containers for ColdFrame.
Ada
1
star
27

trace_utilities

Support for presenting traceback information.
Ada
1
star
28

parallelize

Reads commands and executes them in parallel.
Ada
1
star