All Projects → yusuf8ahmed → Wasmite

yusuf8ahmed / Wasmite

Licence: Apache-2.0 license
Now WebAssembly has proper testing, unit-testing and debugging 🤗

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Wasmite

eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (+105%)
Mutual labels:  unit-testing, test, test-automation, test-framework, testing-tools, testing-framework
IO-TESTER
A functional test framework
Stars: ✭ 32 (+60%)
Mutual labels:  test, test-automation, test-framework, testing-tools, testing-framework
Testfx
MSTest V2 framework and adapter
Stars: ✭ 391 (+1855%)
Mutual labels:  test, test-framework, unittest, testing-tools
Recheck Web
recheck for web apps – change comparison tool with local Golden Masters, Git-like ignore syntax and "Unbreakable Selenium" tests.
Stars: ✭ 224 (+1020%)
Mutual labels:  test-automation, test-framework, testing-tools, testing-framework
testza
Full-featured test framework for Go! Assertions, fuzzing, input testing, output capturing, and much more! 🍕
Stars: ✭ 409 (+1945%)
Mutual labels:  unit-testing, test, test-framework, testing-framework
PixelTest
Fast, modern, simple iOS snapshot testing written purely in Swift.
Stars: ✭ 56 (+180%)
Mutual labels:  test, test-framework, testing-tools, testing-framework
Testcafe
A Node.js tool to automate end-to-end web testing.
Stars: ✭ 9,176 (+45780%)
Mutual labels:  test, test-automation, test-framework, testing-tools
Swagger meqa
Auto generate and run tests using swagger/OpenAPI spec, no coding needed
Stars: ✭ 151 (+655%)
Mutual labels:  test, test-automation, testing-tools, testing-framework
Qtools
QTools collection of open source tools for embedded systems development on Windows, Linux and MacOS
Stars: ✭ 64 (+220%)
Mutual labels:  unit-testing, test-automation, test-framework, testing-tools
Telegraf-Test
Telegraf Test - Simple Test ToolKit of Telegram Bots
Stars: ✭ 22 (+10%)
Mutual labels:  test, test-automation, test-framework, testing-tools
docker-pudb
Debug Python code within a Docker container remotely from your terminal using pudb
Stars: ✭ 18 (-10%)
Mutual labels:  debugger, debug, debugging-tools, debugging-tool
Zunit
A powerful testing framework for ZSH projects
Stars: ✭ 140 (+600%)
Mutual labels:  unit-testing, test-automation, test-framework, testing-tools
Gdb Frontend
☕ GDBFrontend is an easy, flexible and extensionable gui debugger.
Stars: ✭ 2,104 (+10420%)
Mutual labels:  debugger, debug, debugging-tools, debugging-tool
dwarf import
This loads DWARF info from an open binary and propagates function names, arguments, and type info
Stars: ✭ 18 (-10%)
Mutual labels:  debug, debugging-tools, debugging-tool
test junkie
Highly configurable testing framework for Python
Stars: ✭ 72 (+260%)
Mutual labels:  test-automation, testing-tools, testing-framework
bugsnag-vue
[DEPRECATED] This package now lives within the monorepo for our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
Stars: ✭ 26 (+30%)
Mutual labels:  debug, debugging-tools, debugging-tool
carina
Carina automation framework: Web, Mobile, API, DB etc testing...
Stars: ✭ 652 (+3160%)
Mutual labels:  test, test-automation, testing-tools
nopdb
NoPdb: Non-interactive Python Debugger
Stars: ✭ 67 (+235%)
Mutual labels:  debugger, debugging-tools, debugging-tool
pysys-test
PySys System Test Framework
Stars: ✭ 14 (-30%)
Mutual labels:  test-automation, test-framework, testing-framework
unittest expander
A library that provides flexible and easy-to-use tools to parameterize Python unit tests, especially those based on unittest.TestCase.
Stars: ✭ 12 (-40%)
Mutual labels:  unit-testing, test, unittest

What is the Wasmite project

Since WebAssembly is the future of the web. I decide to create Wasmite, a python package for unit-testing your wasm or wat code. Wasmite is based on wasmer and the python standard library package unittest. Documentation for can be found here: documentation for unittest and documentation for wasmer

This project was formerly an extension of my Rust/Python Web framework Wasp, so some section of the code may refer to it's earlier name (Native)

Wasmite looks for tests in python files whose names start with test_*.py and runs every test_* function it discovers. The testing folder has more examples.

Having any problems or questions create a issue, i will be happy to help :)

Installation

This project requires python 3 and doesn't support 3.9

pip install wasmite

Project Goals:

  • Import wasm or wat module successfully
  • Access functions within module
  • Type checking of parameters and the result of functions
  • Release to PyPi for public to use
  • Allow Wasmite ...
    • Export Python functions
    • Export Global Instances
    • Export Memory Instances
  • More complex examples in testing folder
  • Receive community on how to improve

Examples:

from wasmite import WasmiteCase, WasmModule
from wasmite import FunctionTypes, Function, Global, Value, main
from wasmite import I32

def sum(x: int, y: int) -> int:
    """ python function to be imported into WASM  """
    return x + y

class Test(WasmiteCase):
    # create a variable the hold all the functions from a specific wasm file.
    module = WasmModule("test_wasm.wasm")
    # import python function into WASM 
    # type annotations on the function is necessary 
    module.register("math", {
        "sum": Function(module.store, sum),
        "seven": Global(module.store, Value.i32(7), mutable=True)
    })
    # start up the module and return the exports (this is mandatory)
    exports = module.get_exports()
    
    def test_add(self):
        # test add function
        result = self.exports.add(1,2)
        self.assertEqual(result, 3) 
        
    def test_sub(self):
        # test the sub function
        result = self.exports.sub(2,2)
        self.assertEqual(result, 0)

    def test_args_add(self):
        # check the types for results and parameter of the function "add"
        # param is I32, I32 and result is I32
        add_function = self.exports.add
        self.assertTypes(add_function, FunctionTypes([I32, I32], [I32])) # result will fail
        
    def test_import_sum(self):
        # test the imported python function sum.
        sum_function = self.exports.addsum(5,2)
        self.assertEqual(sum_function, 7)
        
    def test_global_read(self):
        # test reading value of global
        read_seven = self.exports.read_global()
        self.assertEqual(read_seven, 7) 
        
    def test_global_write(self):
        # test writing value of global
        self.exports.write_global(5)
        read_seven = self.exports.read_global()
        self.assertEqual(read_seven, 5) 
        
# Hi don't forget to add me         
if __name__ == "__main__":
    main()

-->

Then you can then run this test like so:

# make sure you are in examples/wasm
$ python test_wasm.py

test_add (__main__.Test) ... ok
test_args_add (__main__.Test) ... ok
test_global_read (__main__.Test) ... ok
test_global_write (__main__.Test) ... ok
test_import_sum (__main__.Test) ... ok
test_sub (__main__.Test) ... ok

----------------------------------------------------------------------
Ran 6 tests in 0.001s

OK
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].