Skip to content

Instantly share code, notes, and snippets.

@krishnadey30
Last active November 9, 2024 14:43
Show Gist options
  • Save krishnadey30/046d21a16ff0f2f19bc4d4a608a608d6 to your computer and use it in GitHub Desktop.
Save krishnadey30/046d21a16ff0f2f19bc4d4a608a608d6 to your computer and use it in GitHub Desktop.
GSoC 2019 Unit Test Framework

img

Organization: CHAPEL

Google Summer of Code, 2019


Krishna Kumar Dey

Email: [email protected]
Phone: +91-7780744336

Index

  1. Introduction
  2. UnitTest Framework
  3. Outcome of contributions
  4. Code Contribution
  5. Further Work

Introduction

Deployment is the last stage in application development process and before that, any application undergoes a comprehensive testing process to validate that the system meets its functional and non-functional requirements.

An application comprises several functions, classes, procedures which are referred to a unit. The objective in unit testing is to isolate each unit of the system and validate its precision by identifying and fixing the defects and bugs and benefit of unit testing is that issues can be identified on earlier stages.

UnitTest Framework:

Module UnitTest provides support for automated testing in Chapel. Any function of the form

proc funcName(test: borrowed Test) throws {}

is treated as a test function. These functions must accept an object of Test Class

Test Class

Object of Test Class is passed to Test functions to manage test state and support formatted test logs.

This class also provides several assert methods to check for and report failures. Eg:

  • skip
  • skipIf
  • assertTrue
  • assertFalse
  • assertEqual
  • assertNotEqual
  • assertGreaterThan
  • assertLessThan

Apart from these methods, several other methods are defined for specific needs.

Specifying locales

You can specify the num of locales of a test using these method.

  • addNumLocales
  • maxLocales
  • minLocales
Specifying Dependencies
  • dependsOn

Outcome of contributions

  • Designed and implemented a UnitTest Framework.
    • Implemented multiple assertion types. Gives detailed info on failing assert statements.
    • Supports multi-locality, test dependencies
  • Created multiple primitives for gathering test functions and accessing them.
    • Automatically Gathers test functions
  • Creating a Launcher. Currently, this is a standalone application built separately.

Code Contribution

Documentation

Further Work

Integrating the unit test launcher into mason test which is being tracked in this github issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment