diff --git a/remix-tests/README.md b/remix-tests/README.md index ad9320444..ec0c1d483 100644 --- a/remix-tests/README.md +++ b/remix-tests/README.md @@ -1,4 +1,11 @@ ## Remix-Tests +[![npm version](https://badge.fury.io/js/remix-tests.svg)](https://www.npmjs.com/package/remix-tests) +[![npm](https://img.shields.io/npm/dt/remix-tests.svg?label=Total%20Downloads)](https://www.npmjs.com/package/remix-tests) +[![npm](https://img.shields.io/npm/dw/remix-tests.svg)](https://www.npmjs.com/package/remix-tests) +[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ethereum/remix/tree/master/remix-tests) +[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/ethereum/remix/issues) + + `remix-tests` is a tool to test Solidity smart contracts. It works underneath Remix IDE plugin "Solidity Unit Testing" which is used to write and run test cases for a contract. Tests are written in Solidity itself. `remix-tests` can be used as CLI and a library too. ### Installation @@ -45,7 +52,7 @@ Note that `TestsAccounts` is filled with all the accounts available in `web3.eth ### How to use -#### Command Line +#### As command line interface * To run all files inside `examples` directory ``` @@ -140,55 +147,62 @@ Running `simple_storage_test.sol` file will output as: :point_right: remix-test can also be used for continuous integration testing. See example [Su Squares contract](https://github.com/su-squares/ethereum-contract/tree/e542f37d4f8f6c7b07d90a6554424268384a4186) and [Travis build](https://travis-ci.org/su-squares/ethereum-contract/builds/446186067) -///// TODO - -#### Library +#### As a Library for development -Importing the library: +Import library: ```Javascript const RemixTests = require('remix-tests'); ``` -Running a single test object: +Run a single test object: ```Javascript -remixTests.runTest(testName, testObj, testCallback, resultsCallback) +remixTests.runTest (testName: string, testObject: any, contractDetails: CompiledContract, fileAST: AstNode, opts: Options, testCallback: TestCbInterface, resultsCallback: ResultCbInterface) ``` -**Params:** -* `testName` - `string` name of the test -* `testObj` - web3.js 1.0 contract instance of the test -* `testCallback(object)` - called each time there is a test event. 3 possible type of objects: +Params:- +1. `testName` - Name of the test +2. `testObject` - Web3 1.0 contract instance of the test +3. `contractDetails` - Contract details +4. `fileAST` - AST of test file +5. `opts` - Custom options +6. `testCallback(object)` - Called each time there is a test event. 3 possible type of objects: * `{ type: 'contract', value: '', filename: '' }` * `{ type: 'testPass', value: '', time: