Guide:https://ngta.readthedocs.io
Note:
- from version 1.0, only support python>=3.5.2.
- from version 2.0, don't compatible with unittest.
- from version 4.0, only support python>=3.6.5.
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 yml configuration with schema.
- HTML report can be extended and customized.
- Support running testcases with multi-process when testbench is not exclusive.
- Agent mode:
Installation
- Install ngta:
pip install ngta
- Generate work dir:
python -m ngta init --dest-dir=${WORKDIR} --include-sample
Note: ${WORKDIR} indicate the target dir.
Why we need work dir:
- Test code also need version control, please use GIT.
- Good working 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.service systemd service file for linux.
|-- agent.xml the config file for installing as service in Windows.
|-- cases tesetcase dir
|-- sample1 project or product dir1(GIT submodule1)
|-- sample2 project or product dir2(GIT submodule2)
|-- conf agent config files
|-- lib internal libraries.
|-- logs userd for saving log, result and report.
|-- .ngta anchor file, also used to store configuration.
Node: For integrating with platform, create each project or product as git repository, and put it as git submodule into ${WORKDIR}/cases.
Sample:run test by yml config
- Open command-line, run following commands:
cd ${WORKDIR}
python -m ngta run --config=cases\sample\base\config.yml - After running finished, we can found log and report in
${WORKDIR}\logs
. - 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.
Sample:run test by path
- Open command-line, run following commands:
cd ${WORKDIR}
python -m ngta run --locate=sample.base.test_equal - After runing finished, we can found log and report in
${WORKDIR}\logs
.
Note:
-
--locate
can be apackage
,module
,class
,method
,py file
ordir
. - When specify
--locate
, it also support other arguments--tag
,--include
,--failfast
,--repeat-number
and etc.
Sample:run .py file
- Open command-line, run following commands:
cd ${WORKDIR}\cases\sample\base
python test_equal.py - 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 tagregression
-
@test
used to specify this is a testcase. Test method or function name start with test are also supported. -
assert_that
reference: assertpy
Report Sample:
- Screenshot:
- HTML: report.html
More features: Guide