-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a TestEngine #889
Comments
I will be creating an |
The underlying engine could be changed in a future easily in order to be more verbose. |
I already did that. Im not changing 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. |
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. |
Your misunderstanding it. I explained it incorrectly. The |
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 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)); |
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. |
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? |
I will write a Readme.md explaining the new testing environment |
https://github.com/neo-project/neo-devpack-dotnet/blob/master/src%2FNeo.SmartContract.Testing%2FREADME.md please tell me if you need more information |
@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. |
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 |
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. |
I think that the testEngine is finished, let's move to the next step #949 |
We have a problem creating unit tests, I'm going to make a testEngine to facilitate the testing of smart contracts.
Doc:
Bugs found with this engine:
if
statement sequence points andSequencePointInserter
#938The text was updated successfully, but these errors were encountered: