Comments (21)
https://github.com/neo-project/neo-devpack-dotnet/blob/master/src%2FNeo.SmartContract.Testing%2FREADME.md please tell me if you need more information
from neo-devpack-dotnet.
IIUC that'd be something similar to https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/neotest or https://neow3j.io/#/neo-n3/smart_contract_development/testing. But both have some real or almost real ledger behind, so invocations are real transactions packed into some blocks and processed in a regular way. Can you you provide more details on how DLL-packed contracts will work here?
The problem that we have been encountering throughout all the contracts reviewed is mainly the same, the contracts have not been tested, and the lack of unit tests.
What I am doing is the ability to generate some "artifacts" abstract class extracted from NefFile
, in this way the testing is not limited to contracts made in C#, these artifacts generate a valid C# code descriptive of the Abi, and through mocks, I intend convert types between VM<>dotnet to facilitate calling and testing contracts.
The initial idea (it may evolve in a future version) is to test without generating a transaction, so if you want to simulate two transactions you would have to do something like this:
var walletA= new UInt160("a");
var walletA= new UInt160("b");
TestEngine engine=new ();
var contract = engine.Deploy<MyContract>();
engine.Signer= walletA;
contract.Mint();
engine.Signer= walletB;
Assert.IsFalse(contract.Transfer(walletA,walletB,1)); // no signed by a
engine.Signer= walletA;
Assert.IsTrue(contract.Transfer(walletA,walletB,1));
from neo-devpack-dotnet.
@shargon can you add checkpoints to your engine?
from neo-devpack-dotnet.
I will be creating an DebugApplicationEngine
. After my TraceApplicationEngine
. Just keep that in mind.
from neo-devpack-dotnet.
I will be creating an
DebugApplicationEngine
. After myTraceApplicationEngine
. Just keep that in mind.
The underlying engine could be changed in a future easily in order to be more verbose.
from neo-devpack-dotnet.
I will be creating an
DebugApplicationEngine
. After myTraceApplicationEngine
. Just keep that in mind.The underlying engine could be changed in a future easily in order to be more verbose.
I already did that. Im not changing ApplicationEngine
. I am however replacing it by doing ApplicationEngine.Provider = new TraceApplicationEngine());
All I am saying is, all this work you are doing can be done very easy with current code we have. It already built to handle something like this. I don't know why you reinventing the wheel again. When we have already made it.
from neo-devpack-dotnet.
I don't know why you reinventing the wheel again. When we have already made it.
I'm tired of seeing projects in neo without any unit tests, it's not easy to do them, show me a single project that has them, I think this wheel is not even being reinvented, if it is even designed.
from neo-devpack-dotnet.
Your misunderstanding it. I explained it incorrectly.
The TestEngine
you are creating. Can be done with ease with IApplicationEngineProvider
. All I am saying is build your Engine with that Interface. So you can plugin/hook into the ApplicationEngine
protected
or virtual
methods for getting all the VMs information. I don't think I need to tell you the information you can get from ApplicationEngine
. But this would be the real big test. Where you can test on mainnet
or testnet
without problems. I been working on TraceApplicationEngine
for about a day. And was saying no one should reinvent all the functionality that ApplicationEngine
has already. We have an Engine
Its called ApplicationEngine
. You should make TestApplicationEngine
or ContractApplicationEngine
. If that makes sense.
from neo-devpack-dotnet.
IIUC that'd be something similar to https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/neotest or https://neow3j.io/#/neo-n3/smart_contract_development/testing. But both have some real or almost real ledger behind, so invocations are real transactions packed into some blocks and processed in a regular way. Can you you provide more details on how DLL-packed contracts will work here?
from neo-devpack-dotnet.
Here you can see how it will work:
from neo-devpack-dotnet.
would be much better if you had provided a detailed introduction on what you are trying to do, and how it is supposed to work.
from neo-devpack-dotnet.
would be much better if you had provided a detailed introduction on what you are trying to do, and how it is supposed to work.
@shargon Yes we need more information. So you dont waste everyone's time, including yours.
from neo-devpack-dotnet.
would be much better if you had provided a detailed introduction on what you are trying to do, and how it is supposed to work.
Got it, next time I will do that. My goal is to make it easy unit tests for any smart contract, because trust me, there's a lack of this everywhere.
from neo-devpack-dotnet.
would be much better if you had provided a detailed introduction on what you are trying to do, and how it is supposed to work.
Got it, next time I will do that. My goal is to make it easy unit tests for any smart contract, because trust me, there's a lack of this everywhere.
That is fine. How are we to use it? How do we build tests now? How do we setup the environment? What is required of a test? Whats the convention of the API? How are files and configuration laid out?
from neo-devpack-dotnet.
That is fine. How are we to use it? How do we build tests now? How do we setup the environment? What is required of a test? Whats the convention of the API? How are files and configuration laid out?
I will write a Readme.md explaining the new testing environment
from neo-devpack-dotnet.
@shargon can you add checkpoints to your engine?
BreakPoint? VM.Tests's engine can do that. Can be added in another pr if not added.
from neo-devpack-dotnet.
@shargon can you add checkpoints to your engine?
Only snapshots now, commit and rollback, but if you consider dump the storage to a json, and load from it a checkpoint, yes, it's possible to do that
from neo-devpack-dotnet.
Also can we have in binary file format? If not already.
from neo-devpack-dotnet.
Also can we have in binary file format? If not already.
Of course, it could be faster
from neo-devpack-dotnet.
Also can we have in binary file format? If not already.
Of course, it could be faster
I mean log file in binary format also.
from neo-devpack-dotnet.
I think that the testEngine is finished, let's move to the next step #949
from neo-devpack-dotnet.
Related Issues (20)
- Make `Runtime.ScriptContainer` return a Transaction object HOT 8
- Map.toString() throwing Exception: An unhandled exception was thrown. Key not found in Map HOT 18
- Add support to Array.Empty HOT 1
- `BigInteger` comparer for `ByteString` HOT 17
- Move TestClasses into a separate project
- UTs are not working on macOS / VSCode
- Automatically include "Debug" event when building in debug mode
- How can we avoid problems with different .NET versions? What's the best way to distribute the compiler? HOT 9
- StoredAttribute default value when integer is not working
- Release workflow doesn't work HOT 2
- Use github packages without user and password HOT 7
- Neo submodule issue HOT 6
- Release workflow may not work HOT 2
- Fix hardcoded version for packing
- Update neo submodule
- TestEngine: Coverage and test current smart contracts
- Allow to compile a cs files without a project
- Avoid reuse the same namespace in devpack HOT 2
- property.SetMethod is null, compilation failed HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neo-devpack-dotnet.