Skip to main content

pistar: functional testing with Python

Project description

The pistar is a simple and lightweight function testing tool, using pistar testing framework can quickly complete the development and execution of test cases.

Basic introduction

Command entry:

$ pistar
usage: pistar [options] <command> <args>

positional arguments:
  run          Execute test cases
  generate     Generate interface test cases

optional arguments:
  -v, --version  Show the version of pistar
  -h, --help     Show help message

Simple test example:

from pistar import BaseTestCase, teststep


class ExampleTestCase(BaseTestCase):
    def setup(self):
        print('ExampleTestCase setup...')

    @teststep
    def step_basic_assert(self):
        self.assert_that(100).is_type_of(int, float).is_less_than(200)
        self.assert_that([1, 2, 3]).contains(4)

    def teardown(self):
        print('ExampleTestCase teardown...')

Execution and output:

$ pistar run /test/example.py
collecting...
collected 1 test case

--------------------------------------------------- ExampleTestCase start ---------------------------------------------------
ExampleTestCase setup...
[2021-08-23 16:57:54,121] [ERROR] [**/_pistar/utilities/testcases/case.py:142]
exception: _pistar.utilities.exceptions.assertion.AssertionContainsException: expect [1, 2, 3] to contain 4, but it did not
        @teststep
        def step_basic_assert(self):
            self.assert_that(100).is_type_of(int, float).is_less_than(200)
>           self.assert_that([1, 2, 3]).contains(4)
E   _pistar.utilities.exceptions.assertion.AssertionContainsException: expect [1, 2, 3] to contain 4, but it did not

/test/example.py:15 AssertionContainsException
ExampleTestCase teardown...
---------------------------------------------------- ExampleTestCase end ----------------------------------------------------

===================================================== test summary info =====================================================
FAILED /test/example.py::ExampleTestCase
===================================================== 1 failed in 0.03s =====================================================

Features

  • Test cases can be flexibly composed by pre step, test step and post step

  • Various test step usage, such as timeout control and parameterization

  • Rich streaming assertion and error log output

  • Support session level pre and post conditions

  • Compatible with pytest case execution

  • Automatic generation of basic test cases

Some features of pistar refer to unittest and pytest.

License

Copyright (c) Huawei Technologies Co., Ltd. 2020-present.

Distributed under the terms of the MIT license, pistar is free software.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pistar-1.0.1-py3-none-any.whl (68.4 kB view details)

Uploaded Python 3

File details

Details for the file pistar-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pistar-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 68.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for pistar-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09996a33b0ea6dc0449b2c1a0d4c2e4bd32675d98855330cae430c5e7b466ee1
MD5 eb81512da4ebc73e593626f282b94410
BLAKE2b-256 c78c195822fdbb3417c8210db5f0062d9bc25ecbf2781fd56edfca8de04f8c05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page