Skip to main content

Next generation test automation.

Project description

中文 README


User Guidehttps://yyang179.github.io/ngta-doc/

Note:

  • from version 1.0, only support python>=3.5.2.

Why choose NGTA:

Do you have encounter following problems when developing automation testcase:

  • Parametrize for testcase and also need to support customized type.
  • Load testcase according to your requirements.
  • Group the testcases.
  • The dependency between testcases.
  • Initialize the test environment only one time for whole test process.
  • Get test environment in testcase easily.
  • Classify the log output files.
  • Run testcases concurrently.
  • Run testcases distributed.
  • Generate a beautiful report.
  • enable or disable mock by simple config.

Introduce:

NGTA's full name is Next Generation Test Automation, it designed with following keywords:

  • Business independent.
  • Cross platform.
  • Powerful parametrize for testcase.
  • Add testbench concept.
  • Add events mechanism.
  • Local mode:
    • powerful xml or yaml configuration with schema.
    • HTML report can be extended and customized.
    • Support running testcases with multi-process when testbench is not exclusive.
  • Agent mode:
    • Provide Http Restful interface.
    • Run test request with multi-processes.
    • Support Distributed.
    • Integrate with cavia platform.

Installation

  1. Install ngta:

    pip install ngta

  2. Generate work dir:

    python -m ngta init --dest-dir=${WORKDIR} --include-sample

Note: ${WORKDIR} indicate the target dir.

Why we need work dir:

  1. Test code also need version control, please use SVN or GIT.
  2. Good work structure is helpful for managing testcases.

The generated work dir:

${WORKDIR}                          root dir
|-- bin                             
    |-- agent.exe                   exe file for installing test agent as service in Windows.
    |-- agent.xml                   the config file for installing as service.
|-- cases                           tesetcase dir
    |-- sample                      project or product dir
|-- conf                            agent config files 
|-- lib                             internal libraries.
|-- logs                            userd for saving log, result and report.
|-- .ngta                           anchor file, also used to store configuration.

Sample:run test by xml config

  1. Open command-line, run following commands:

    cd ${WORKDIR}
    python -m ngta run --config=cases\sample\base\config.xml

  2. After running finished, we can found log and report in ${WORKDIR}\logs.
  3. In ${WORKDIR}\cases\sample\base\config.xml, it config how to load test in ${WORKDIR}\cases\sample\base\test_equal.py and inject the parameters.

Note: Recommend run test with xml config, it includes all features.

Sample:run test by path

  1. Open command-line, run following commands:

    cd ${WORKDIR}
    python -m ngta run --locate=sample.base.test_equal

  2. After runing finished, we can found log and report in ${WORKDIR}\logs.

Note

  • --locate can be a package, module, class, method, py file or dir.
  • When specify --locate, it also support other arguments --tag, --include, --failfast, --repeat-number and etc.

Sample:run .py file

  1. Open command-line, run following commands:

    cd ${WORKDIR}\cases\sample\base
    python test_equal.py

  2. After runing finished, we can found report.html in ${WORKDIR}\cases\sample\base.

Different with unittest.TestCase:

Review ${WORKDIR}\cases\sample\base\test_equal.py:

# coding: utf-8
from ngta import TestCase, tag, test


class EqualTestCase(TestCase):
    @tag("regression")
    @test(u"Test {value1} equal with {value2}")
    def test_int(self, value1=1, value2=2):
        msg = "%s should equal with %s." % (value1, value2)
        self.assert_that(value1, msg).is_equal_to(value2)
  • @tag specify the tag regression
  • @test used to specify this is a testcase.
  • assert_that reference: assertpy

Report Sample:


More features: User Guide

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
ngta-2.5.15-py2.py3-none-any.whl (407.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Sep 26, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page