![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
|ReadTheDocs|_ |TravisCI|_
.. image:: https://badgen.net/badge/Lifecycle/Active/green :alt: Lifecycle Active
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black
.. image:: https://github.com/morganstanley/testplan/blob/main/doc/images/logo/testplan.png
..because unit tests can only go so far..
Testplan is a Python <http://python.org>
_ package that can start a local live
environment, setup mocks, connections to services and run tests against these.
It provides:
MultiTest
a feature extensive functional testing system with a rich set
of assertions and report rendering logic.This is how a very basic Testplan application looks like.
.. code-block:: python
import sys
from testplan import test_plan
from testplan.testing.multitest import MultiTest, testcase, testsuite
def multiply(numA, numB):
return numA * numB
@testsuite
class BasicSuite(object):
@testcase
def basic_multiply(self, env, result):
result.equal(multiply(2, 3), 6, description='Passing assertion')
result.equal(multiply(2, 2), 5, description='Failing assertion')
@test_plan(name='Multiply')
def main(plan):
test = MultiTest(name='MultiplyTest',
suites=[BasicSuite()])
plan.add(test)
if __name__ == '__main__':
sys.exit(not main())
Example execution:
.. code-block:: bash
$ python ./test_plan.py -v
Passing assertion - Pass
6 == 6
Failing assertion - Fail
File: .../test_plan.py
Line: 18
4 == 5
[basic_multiply] -> Fail
[BasicSuite] -> Fail
[MultiplyTest] -> Fail
[Multiply] -> Fail
Testing a server and a client communication.
.. code-block:: python
import sys
from testplan import test_plan
from testplan.testing.multitest import MultiTest, testsuite, testcase
from testplan.testing.multitest.driver.tcp import TCPServer, TCPClient
from testplan.common.utils.context import context
@testsuite
class TCPTestsuite(object):
"""Testsuite for server client connection testcases."""
def setup(self, env):
env.server.accept_connection()
@testcase
def send_and_receive_msg(self, env, result):
"""Basic send and receive hello message testcase."""
msg = env.client.cfg.name
result.log('Client is sending his name: {}'.format(msg))
bytes_sent = env.client.send_text(msg)
received = env.server.receive_text(size=bytes_sent)
result.equal(received, msg, 'Server received client name')
response = 'Hello {}'.format(received)
result.log('Server is responding: {}'.format(response))
bytes_sent = env.server.send_text(response)
received = env.client.receive_text(size=bytes_sent)
result.equal(received, response, 'Client received response')
@test_plan(name='TCPConnections')
def main(plan):
test = MultiTest(name='TCPConnectionsTest',
suites=[TCPTestsuite()],
environment=[
TCPServer(name='server'),
TCPClient(name='client',
host=context('server', '{{host}}'),
port=context('server', '{{port}}'))])
plan.add(test)
if __name__ == '__main__':
sys.exit(not main())
Example execution:
.. code-block:: bash
$ python ./test_plan.py -v
Client is sending: client
Server received - Pass
client == client
Server is responding: Hello client
Client received - Pass
Hello client == Hello client
[send_and_receive_msg] -> Pass
[TCPTestsuite] -> Pass
[TCPConnectionsTest] -> Pass
[TCPConnections] -> Pass
A persistent and human readable test evidence PDF report:
.. code-block:: bash
$ python ./test_plan.py --pdf report.pdf
[TCPConnectionsTest] -> Pass
[TCPConnections] -> Pass
PDF generated at report.pdf
.. image:: https://github.com/morganstanley/testplan/blob/main/doc/images/pdf/readme_server_client.png
For complete documentation that includes downloadable examples, visit this
link <http://testplan.readthedocs.io>
_.
A step by step guide to contribute to Testplan framework can be found
here <http://testplan.readthedocs.io/en/latest/about.html#contributing>
__.
License information here <https://github.com/morganstanley/testplan/blob/main/LICENSE.md>
__.
.. |ReadTheDocs| image:: https://readthedocs.org/projects/testplan/badge/?version=latest .. _ReadTheDocs: http://testplan.readthedocs.io/en/latest/ .. |TravisCI| image:: https://api.travis-ci.com/MorganStanley/testplan.svg?branch=main .. _TravisCI: https://travis-ci.com/morganstanley/testplan
FAQs
Testplan testing framework
We found that testplan demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.