The Recorder is a tool used to save a bunch of transactions in a JSON file and
The Recorder is a tool used to save a bunch of transactions in a JSON file and
rerun them later either in the same environment or in another.
rerun them later either in the same environment or in another.
Saving to the JSON file ( by default its called senario.json) allows one to easily check the transaction list, tweak input parameters, change linked library, etc...
Saving to the JSON file ( by default its called scenario.json) allows one to easily check the transaction list, tweak input parameters, change linked library, etc...
There are many use cases for the recorder.
There are many use cases for the recorder.
For instance:
For instance:
- After having coded and tested contracts in a constrained
- After having coded and tested contracts in a constrained
environment (like the JavaScript VM), you could then change the environment and redeploy it to a more realistic environment like a test net with an **injected web3** or to a Geth node. By using the generated **senario.json** file, you will be using all the same settings that you used in the Javascript VM. And this mean that you won't need to click the interface 100 times or whatever to get the state that you achieved originally. So the recorder could be a tool to protect your sanity.
environment (like the JavaScript VM), you could then change the environment and redeploy it to a more realistic environment like a test net with an **injected web3** or to a Geth node. By using the generated **scenario.json** file, you will be using all the same settings that you used in the Javascript VM. And this mean that you won't need to click the interface 100 times or whatever to get the state that you achieved originally. So the recorder could be a tool to protect your sanity.
You can also change the settings in the senario.json file to customize the playback.
You can also change the settings in the scenario.json file to customize the playback.
- Deploying contract does often require more than creating one
- Deploying contract does often require more than creating one
transaction and so the recorder will automate this deployment.
transaction and so the recorder will automate this deployment.
@ -127,10 +127,10 @@ For instance:
![](images/a-runtab-recorder.png)
![](images/a-runtab-recorder.png)
### senario.json
### scenario.json
To create this file in the recorder, you first of course need to have run some transactions. In the image above - it has a `0` next to **Transactions Recorded**. So this isn't the right moment to save transactions because - well because there aren't any. Each time you make a transaction, that number will increment. Then when you are ready, click the floppy disk icon and the senario.json file will be created.
To create this file in the recorder, you first of course need to have run some transactions. In the image above - it has a `0` next to **Transactions Recorded**. So this isn't the right moment to save transactions because - well because there aren't any. Each time you make a transaction, that number will increment. Then when you are ready, click the floppy disk icon and the scenario.json file will be created.
The JSON file below is an example of the senario.json file.
The JSON file below is an example of the scenario.json file.
defaultVersion:'soljson-v0.6.6+commit.6c089d02.js',// this default version is defined: in makeMockCompiler (for browser test) and in package.json (downloadsolc_root) for the builtin compiler
defaultVersion:'soljson-v0.6.6+commit.6c089d02.js'// this default version is defined: in makeMockCompiler (for browser test) and in package.json (downloadsolc_root) for the builtin compiler
addTooltip('Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload.')
addTooltip('Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload. Error: '+e)
}
// replace in allVersions those compiler builds which exist in allVersionsWasm with new once
<buttonclass='btn btn-primary btn-sm ${css.navigator} ${css.jumpButton} fas fa-step-forward'id='jumpnextbreakpoint'data-id="buttonNavigatorJumpNextBreakpoint"title='Jump to the next breakpoint'onclick=${function(){self.event.trigger('jumpNextBreakpoint')}}disabled=${this.jumpNextBreakpointDisabled}></button>
<buttonclass='btn btn-primary btn-sm ${css.navigator} ${css.jumpButton} fas fa-step-forward'id='jumpnextbreakpoint'data-id="buttonNavigatorJumpNextBreakpoint"title='Jump to the next breakpoint'onclick=${function(){self.event.trigger('jumpNextBreakpoint')}}disabled=${this.jumpNextBreakpointDisabled}></button>
this.testsExecutionStopped=yo`<label class="text-warning h6" data-id="testTabTestsExecutionStopped">The test execution has been stopped</label>`
this.testsExecutionStopped=yo`<label class="text-warning h6" data-id="testTabTestsExecutionStopped">The test execution has been stopped</label>`
this.testsExecutionStoppedError=yo`<label class="text-danger h6" data-id="testTabTestsExecutionStoppedError">The test execution has been stopped because of error(s) in your test file</label>`
this.testsExecutionStoppedError=yo`<label class="text-danger h6" data-id="testTabTestsExecutionStoppedError">The test execution has been stopped because of error(s) in your test file</label>`
if(error)returnmodalDialogCustom.alert('Failed to create file. '+newFile+' '+error)
if(error)returnmodalDialogCustom.alert('Failed to create file. '+newFile+' '+error)
constsplittedFileName=fileName.split('/')
if(!fileProvider.set(newFile,this.generateTestContractSample(hasCurrent,fileName)))returnmodalDialogCustom.alert('Failed to create test file '+newFile)
// This is fine for now because test file is created on same path where file to be tested is.
// This should be updated to pass complete path, if test file comes from different directory/path