Use `given` in `__setup__` function
See original GitHub issueAs a StarkNet smart contract developer, I want to use given
in the __setup__
function to run a suite of tests on a contract that’s been initiated by fuzzed parameters.
In particular, I need to initiate random contract state using fuzzing, however, this initialization is by far the most expensive action in my contract suite. I would like to ideally run it in advance of tests rather than run it separately for each test where I need to use fuzzing.
Is there a way to hack this or do I have to just rely on individual setup functions to use fuzzing?
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Vue.js 3 Composition API: the SetUp Function - Medium
Vue 3 introduced the setUp function. It enables us to extract repeatable parts of components into reusable pieces of code.
Read more >What is the role and usage of the setup function provided by ...
setup sets up an instance and returns properties that it should have. The purpose of Composition API, which setup is a part of, ......
Read more >Composition API: setup() - Vue.js
The setup() hook serves as the entry point for Composition API usage in components in ... The first argument in the setup function...
Read more >When i use setup function in vue2 project i get some error in ...
When i use setup function in vue2 project i get some error in console ... The code you provided relies heavily on code...
Read more >p5.js | setup() Function - GeeksforGeeks
The setup() function runs when the program starts. It is used to set the initial environment properties such as text-color, screen size, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, now I understand what’s going on. Unfortunately, this idea is quite contradictory to the way how Protostar’s test runner works under the hood (fuzzer is spun for each
test_*
function separately, and it wraps single function, setups are running in their own context which is different from test cases ones). Therefore, I don’t think we will ever support such use case in Protostar, at least not in this shape of the codebase (the only solution that comes to my mind is adding something like sub-test-cases, which sounds strange?).As a workaround, I wonder if it wouldn’t work for you if you stick with a single test case and eventually chop it into multiple subroutines. Yes, I know this is suboptimal, because you have single test, which runs sequentially and failure in one subroutine stops executing others, but it should still be helpful in successful case.
Thanks @mkaput - yeah I’ll consider that, no worries. Completely understand the limitation.