Lisk Framework is an application framework responsible for establishing and maintaining the interactions between the modules of a Lisk blockchain application.
Lisk Framework aims to provide a consistent and intuitive interface between each module and component. Currently, Lisk Framework establishes interactions between the chain
, api
and network
modules.
The architecture of Lisk Framework follows the research documented in LIP0005. The diagram below provides a high-level overview of the architecture:
To install and use Lisk Framework follow the steps described in the Lisk SDK installation and usage sections.
- Recreate the database to run the tests against a new blockchain:
dropdb lisk_dev
createdb lisk_dev
- Launch Lisk (runs on port 4000):
NODE_ENV=test npm start
Starting from version 1.6.0
, Lisk Framework will be using Jest as its main test runner with gradual deprecation of mocha. Since rewriting all existing mocha tests is not feasible at the moment, we have two test runners in our code base:
- Modules (all source code under
framework/src/modules
folder) will be tested usingmocha
and test files should be located underframework/test/mocha
. - Framework (all of the source files but
framework/src/modules
) will be tested usingjest
and test files should be located underframework/test/jest
. - Functional and Network tests suites will be using
mocha
and test files should be located underframework/test/mocha
.
Tests are run using the following command:
npm run mocha:<testType> -- [testPathPattern] [mochaCliOptions]
- Where testType can be one of
unit
,integration
,functional:ws
,functional:get
,functional:post
,functional:put
,functional
,network
(required). - Where testPathPattern is a regexp pattern string that is matched against all tests paths before executing the test (optional).
- Where mochaCliOptions can be any of mocha's
command line options
(optional).
Examples:
# Running network tests
npm run mocha:network
npm run mocha:network -- --grep @p2p
npm run mocha:network -- --grep @propagation
# Running unit tests
npm run mocha:unit
npm run mocha:unit -- --grep @slow
npm run mocha:unit -- --grep @unstable
### extensive
npm run mocha:unit -- --grep="@unstable" --invert
# Running integration tests
npm run mocha:integration -- --grep @slow
npm run mocha:integration -- --grep @unstable
# extensive
npm run mocha:integration -- --grep="@unstable" --invert
# Running functional tests
npm run mocha:functional:ws
npm run mocha:functional:get
npm run mocha:functional:post
npm run mocha:functional:put
Individual test files can be run using the following commands:
npm run mocha:unit -- <testPathPattern> [mochaCliOptions]
or
npm run mocha <filepath> [mochaCliOptions]
or
npx mocha <filepath> [mochaCliOptions]
npm run jest:<testType>
testType
can be unit
|integration
|functional
npm run jest:<testType> -- [testPathPattern] [jestCliOptions]
To test the changes in framework you can run,
node test/test_app
or node test/test_app | npx bunyan
If you want to test the changes in lisk-sdk/elements
to reflect in lisk-sdk/framework
, please make sure you run npm run build
at lisk-sdk
after making any changes in elements library and run node test/test_app
.
Reason | How |
---|---|
Want to chat with our community | Chat with them on Lisk.chat |
Want to chat with our developers | Chat with them on Gitter |
Found a bug | Open a new issue |
Found a security issue | See our bounty program |
Want to share your research | Propose your research |
Want to develop with us | Create a fork |
Copyright © 2016-2018 Lisk Foundation
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
This program also incorporates work previously released with lisk 0.9.11
(and earlier) versions under the MIT License. To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:
Copyright © 2016-2018 Lisk Foundation
Copyright © 2015 Crypti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.