create account

Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration by tokenika

View this thread on: hive.blogpeakd.comecency.com
· @tokenika ·
$25.52
Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration
**We are proud to announce a new release of EOSFactory, version 1.0. The main feature introduced in this release is standardized unit testing for EOS smart-contracts. Also, thanks to tight integration with Visual Studio Code you can now tap into the rich world of utilities offered by the VSC community. Our aim is to turn EOSFactory into a comprehensive IDE (Integrated Development Environment) for EOS smart-contracts.**

![img](https://cdn.steemitimages.com/DQmR21xQNJ4CbS1DoJEAutvYFWU9mD11PAYkCQZpLnHXLdY/EOSFactory%20logo.png)

## Standardized unit testing

The initial EOSFactory release (v0.8 [published](https://steemit.com/eos/@tokenika/introducing-eosfactory-an-eos-smart-contract-development-and-testing-framework) three weeks ago) was a solid foundation but contained only simple examples of home-made unit tests, whose only point was to prove the concept. Therefore those unit tests could not be treated as a robust verification tool: they did not handle errors in an orderly manner and they did not offer proper assertions.

This release takes [EOSFactory](https://github.com/tokenika/eosfactory) to the next level. We've integrated it with [Unittest](https://docs.python.org/2/library/unittest.html), the standard unit testing framework for Python. What it means is that from now on, you have the power of standardized Python-based unit testing at your disposal.

Below is an example of an EOSFactory unit test output:

```
Test project /mnt/d/Workspaces/EOS/contracts/hello.tokenika/build
    Start 1: unittest
1/2 Test #1: unittest .........................   Passed    6.58 sec
    Start 2: test
2/2 Test #2: test .............................   Passed    5.12 sec
100% tests passed, 0 tests failed out of 2
Total Test time (real) =  11.71 sec
```

### Main features in v1.0

We believe the features available in this release make EOSFactory reliable and production-ready, hence we label it v1.0. Below is a complete list of those new features.

#### 1. Standard unit-testing framework

We are utilizing the power of [Unittest](https://docs.python.org/3/library/unittest.html), the standard Python unit test framework. As emphasized in the documentation, Unittest is a fully fledged and highly standardized toolset:

> The `unittest` unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. 

#### 2. Support for user-defined workspaces

We are introducing clear separation between EOSFactory infrastructure (including its demo examples and smart-contract templates) and dedicated user-defined workspace, where user-created smart-contracts and unit tests can be safely stored.

#### 3. Support for debugging

Smart-contracts can never be properly debugged (as you cannot pause the blockchain easily), but we've come up with a good work-around for tracking a smart-contract’s execution. What you can do with EOSFactory is put in your C++ code special logger clauses (e.g. `logger_info("user: ", name{user});`) which will produce output to the console giving you the exact location of its origin, including the C++ method name, file name and line number.

#### 4. Preliminary code verification

When using the standard EOS toolset, in order to check for errors in a smart-contract code you need to go through the entire process of building & linking performed by the `WASM` compiler. What we offer is the option of reducing this process to a simple `CLANG` compilation (i.e. without linking). And only when your code is error-free and you are ready for testnet deployment and unit testing, you can switch to the more heavy-weight `WASM` compiler.

#### 5. *Visual Studio Code* integration

EOSFactory is becoming more tightly integrated with [Visual Studio Code](https://code.visualstudio.com/). When you create a new smart-contract in EOSFactory, what you get is an entire VSC project, with support for [CMake](https://cmake.org/) builds, automated tasks and [IntelliSense](https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx) features.

## Why is EOSFactory needed?

Undoubtedly, everything that EOSFactory offers can be done with the official EOSIO toolset, i.e. `cleos` and `eosiocpp`. Does it make EOSFactory just a simple alternative to those tools? Not really.

Try to go through [EOS tutorials](https://github.com/EOSIO/eos/wiki/Tutorial-eosio-token-Contract) based on `cleos` and you'll see how much concentration is required to follow those simple examples without making a single mistake. And now imagine doing it 10 or 100 times. Surely, it's a daunting task!

Code development and unit-testing involve tasks that need to be executed hundreds of times, and each time in exactly the same way and exactly the same context. Therefore those tasks need to be fully automated, as otherwise a lot of time is being wasted and, what's even worse, a lot of additional uncertainty is introduced. Manually performed actions are prone to errors.

And this is what EOSFactory actually brings to the table: an easy & intuitive way to automate the process of dealing with smart-contracts. Write down, in the form of a Python script, what needs to be done multiple times in exactly the same way and exactly the same context, and then just run the script. EOSFactory will take care of everything else: it will compile your smart-contract, create a new testnet, deploy the contract, invoke its methods and verify the response, then tear down the testnet, and finally report the results. And all of this done in a couple of seconds.

## Aiming to become a comprehensive EOS IDE

With *Visual Studio Code* integration all the essential programming tools become easily available, as EOSFactory smart-contract template generator is able to produce a complete *Visual Studio Code* project, which includes not only unit testing support but also:

- Linux, MacOS and Windows compatibility,
- [CMake](https://cmake.org/) support allowing you to compile, build and unit test your smart-contract by running those three commands: `cmake`, `make`, `ctest`.
- automated tasks accessible from the VSC menu or via keyboard shortcut keys,
- all the features that come with [IntelliSense](https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx): e.g. code completion, content assist, code hinting,
- multiple community-driven extensions, including the possibility to create a specialized EOS smart-contract extension.

![img](https://cdn.steemitimages.com/DQmcYyhEcoz4Az2vEf7vA1AJYgTNzhvKewsKPqd7hqbphyo/peek.png)

## Documentation

EOSFactory source code can be found in [this repository](https://github.com/tokenika/eosfactory) on GitHub. For more detailed documentation, tutorials and installation guides, please refer to [this website](http://eosfactory.io/sphinx/build/html/).

## Feedback is welcome

As we mentioned in our previous post, all feedback is very welcome, especially critical, as it motivates us towards improvement.

---

**NOTE:** For the time being EOSFactory `v1.0` is compatible EOSIO `dawn-v4.0.0`. Once EOSIO stops changing rapidly and becomes stable, the subsequent EOSFactory release will be compatible with the latest EOSIO release.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authortokenika
permlinkintroducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration
categoryeos
json_metadata{"tags":["eos","eosio","dev","blockchain","crypto"],"image":["https://cdn.steemitimages.com/DQmR21xQNJ4CbS1DoJEAutvYFWU9mD11PAYkCQZpLnHXLdY/EOSFactory%20logo.png","https://cdn.steemitimages.com/DQmcYyhEcoz4Az2vEf7vA1AJYgTNzhvKewsKPqd7hqbphyo/peek.png"],"links":["https://steemit.com/eos/@tokenika/introducing-eosfactory-an-eos-smart-contract-development-and-testing-framework","https://github.com/tokenika/eosfactory","https://docs.python.org/2/library/unittest.html","https://docs.python.org/3/library/unittest.html","https://code.visualstudio.com/","https://cmake.org/","https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx","https://github.com/EOSIO/eos/wiki/Tutorial-eosio-token-Contract","http://eosfactory.io/sphinx/build/html/"],"app":"steemit/0.1","format":"markdown"}
created2018-06-07 14:19:57
last_update2018-06-07 14:19:57
depth0
children8
last_payout2018-06-14 14:19:57
cashout_time1969-12-31 23:59:59
total_payout_value21.563 HBD
curator_payout_value3.958 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7,307
author_reputation5,007,110,235,602
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,697,657
net_rshares9,313,167,759,807
author_curate_reward""
vote details (39)
@aclarkuk82 ·
Fantastic work guys, I am looking forward to using this new release.
👍  ,
properties (23)
authoraclarkuk82
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180607t143431114z
categoryeos
json_metadata{"tags":["eos"],"app":"steemit/0.1"}
created2018-06-07 14:34:30
last_update2018-06-07 14:34:30
depth1
children0
last_payout2018-06-14 14:34:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length68
author_reputation901,192,097,946
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,699,707
net_rshares183,059,961
author_curate_reward""
vote details (2)
@alienzin ·
great! Thanks for your effort.
So I resteemed.
properties (22)
authoralienzin
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180611t045228461z
categoryeos
json_metadata{"tags":["eos"],"app":"steemit/0.1"}
created2018-06-11 04:52:30
last_update2018-06-11 04:52:30
depth1
children0
last_payout2018-06-18 04:52:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length46
author_reputation725,858,496,687
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,240,469
net_rshares0
@eosvenezuela ·
Amazing project @tokenika, the best of lucks! Greetings from #EOSVenezuela

https://steemitimages.com/0x0/https://s33.postimg.cc/nnqmdgzwf/instagram_format_32.jpg
properties (22)
authoreosvenezuela
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180608t012756803z
categoryeos
json_metadata{"tags":["eos","eosvenezuela"],"users":["tokenika"],"image":["https://steemitimages.com/0x0/https://s33.postimg.cc/nnqmdgzwf/instagram_format_32.jpg"],"app":"steemit/0.1"}
created2018-06-08 01:27:57
last_update2018-06-08 01:27:57
depth1
children0
last_payout2018-06-15 01:27:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length162
author_reputation2,732,562,338,898
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,772,644
net_rshares0
@javierjmc ·
Will be trying this soon, thanks for developing tools for the community!
properties (22)
authorjavierjmc
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180607t154009364z
categoryeos
json_metadata{"tags":["eos"],"app":"steemit/0.1"}
created2018-06-07 15:40:09
last_update2018-06-07 15:40:09
depth1
children0
last_payout2018-06-14 15:40:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length72
author_reputation420,915,675,359
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,708,644
net_rshares0
@pnc ·
Great work @tokenika, I follow and appreciate the work you do to advance EOS development. U can count on my vote. Congrat!
properties (22)
authorpnc
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180607t163233459z
categoryeos
json_metadata{"tags":["eos"],"users":["tokenika"],"app":"steemit/0.1"}
created2018-06-07 16:32:33
last_update2018-06-07 16:32:33
depth1
children0
last_payout2018-06-14 16:32:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length122
author_reputation31,733,986,331,482
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,715,197
net_rshares0
@sfeos ·
Excited to try this out. Thank you!
properties (22)
authorsfeos
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180607t152113495z
categoryeos
json_metadata{"tags":["eos"],"app":"steemit/0.1"}
created2018-06-07 15:21:12
last_update2018-06-07 15:21:12
depth1
children0
last_payout2018-06-14 15:21:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length35
author_reputation309,719,905,083
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,706,206
net_rshares0
@steemitboard ·
Congratulations @tokenika! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/voted.png)](http://steemitboard.com/@tokenika) Award for the number of upvotes received

<sub>_Click on the badge to view your Board of Honor._</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-tokenika-20180607t224720000z
categoryeos
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-06-07 22:47:18
last_update2018-06-07 22:47:18
depth1
children0
last_payout2018-06-14 22:47:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length719
author_reputation38,975,615,169,260
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,756,951
net_rshares0
@yingpingzhang ·
great!
properties (22)
authoryingpingzhang
permlinkre-tokenika-introducing-eosfactory-v1-0-with-standardized-unit-testing-and-visual-studio-code-integration-20180617t114005658z
categoryeos
json_metadata{"tags":["eos"],"app":"steemit/0.1"}
created2018-06-17 11:40:09
last_update2018-06-17 11:40:09
depth1
children0
last_payout2018-06-24 11:40:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6
author_reputation1,348,872,191,969
root_title"Introducing EOSFactory v1.0 with standardized unit testing and Visual Studio Code integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id61,084,367
net_rshares0