Code Monkey home page Code Monkey logo

smoketesting's Introduction

Smoke Testing

This repository contains an attempt to implement smoke-testing of a CLI application. The application (xtractor) itself is simple: Given input data in the form TIMESTAMP, VALUE and number of outputs X, it extracts the TIMESTAMPs of the X input data entries with greatest VALUE. Input data could be supplied via file or via stdin.

The focus is on testing the application, both with unit tests as well as smoke-tests of the resulting binary (testing the user interface). Bazel is used to resolve the external dependencies and provide a clean and cacheable implementation.

General

Requirements:

  • C++17

The code was tested on the following system:

  • Ubuntu 20.04.1 LTS
  • g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
  • bazel 4.1.0 (it's highly recommended to use bazel!)

The Bazel way

Build

Bazel builds automatically before running/testing.

Run

Run the main target and provide required arguments to the binary after the double-dash (--). For input via filename (path to data must be absolute):

bazel run //xtractor:main -- 3 $(pwd)/xtractor/testdata/sample_data.txt

For input via stdin, use --run_under to prepend a command:

bazel run //xtractor:main --run_under="cat $(pwd)/xtractor/testdata/sample_data.txt |" -- 3

Test

Run all tests via

bazel test //...

Or run tests individually via

bazel test //xtractor:unit_tests
bazel test //xtractor:smoke_tests

The traditional way

Build

Build from the workspace root (the directory that contains this README.md) and provide the correct include path for headers:

g++ -std=c++17 -I$(pwd) xtractor/main.cpp

Run

Call the compiled binary (e.g. a.out) with at least one parameter (size X). Data input must be provided either via stdin or as filename:

./a.out 3 xtractor/testdata/sample_data.txt
cat xtractor/testdata/sample_data.txt | ./a.out 3

Help is shown when running without parameters:

./a.out

Test

Tests have some dependencies (e.g. GoogleTest for the C++ unit tests, or assert.sh for the shell smoke-tests). Bazel will fetch these automatically (see above). In the traditional way, these dependencies have to be provided manually.

smoketesting's People

Contributors

leosh64 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.