Incremental Tests Development
You can combine experimentation in REPL with actual test development. Your feedback loop becomes even faster:Try API Add the line to test Re-run test with REPL Experiment within preserved context Enumerate test files you want to REPL with and add repl to get into incremental tests development mode webtau testscipts/* repl
Use ls command to list available test files. webtau:000> ls Test files: 0 testscripts/dataDownload.groovy 1 testscripts/downstreamValidation.groovy 2 testscripts/resourceCreation.groovy Note: Listing will happen automatically at the start
webtau:000> s 0 Test scenarios of testscripts/dataDownload.groovy: 0 clean data 1 download data 2 validate data webtau:000> b Test files: 0 testscripts/dataDownload.groovy 1 testscripts/downstreamValidation.groovy 2 testscripts/resourceCreation.groovy webtau:000> s 'datadownload' Test scenarios of testscripts/dataDownload.groovy: 0 clean data 1 download data 2 validate data
Selected test file has three scenarios package testscripts import static org.testingisdocumenting.webtau.WebTauGroovyDsl.scenario scenario("clean data") { println "cleaning..." } scenario("download data") { println "downloading..." } scenario("validate data") { println "validating..." } To run scenario by index webtau:000> r 0 scenario before first test (Setup) [.] before first test (Setup) running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy) Use negative index to select from the bottom, i.e. -1 will select the last scenario, -2 will select second from the end webtau:000> r -1 running: testscripts/dataDownload.groovy validate data scenario validate data (dataDownload.groovy) validating... [.] validate data (dataDownload.groovy) To run scenario by partial name match webtau:000> r 'clean' running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy)
Use r to re-run previous run webtau:000> r running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy)
Multiple Test Scenarios Run
Use comma separated list of indexes or partial text match to run more than one scenario webtau:000> r 0, 1 running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy) running: testscripts/dataDownload.groovy download data scenario download data (dataDownload.groovy) downloading... [.] download data (dataDownload.groovy) webtau:000> r 'download', 'clean' running: testscripts/dataDownload.groovy download data scenario download data (dataDownload.groovy) downloading... [.] download data (dataDownload.groovy) running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy) Note: Order of execution follows the order of specified indexes or textUse r from:to to run a range of scenarios. From , to can be either index or partial text match. webtau:000> r 0:'validate' running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy) running: testscripts/dataDownload.groovy download data scenario download data (dataDownload.groovy) downloading... [.] download data (dataDownload.groovy) running: testscripts/dataDownload.groovy validate data scenario validate data (dataDownload.groovy) validating... [.] validate data (dataDownload.groovy) webtau:000> r 'validate':0 running: testscripts/dataDownload.groovy validate data scenario validate data (dataDownload.groovy) validating... [.] validate data (dataDownload.groovy) running: testscripts/dataDownload.groovy download data scenario download data (dataDownload.groovy) downloading... [.] download data (dataDownload.groovy) running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy)
Select Scenarios Without Run
package testscripts import static org.testingisdocumenting.webtau.WebTauGroovyDsl.scenario scenario("clean data") { println "cleaning..." } scenario("download data") { println "downloading..." } scenario("validate data") { println "validating..." } Lets run scenarios by ranage again webtau:000> r 'validate':0 running: testscripts/dataDownload.groovy validate data scenario validate data (dataDownload.groovy) validating... [.] validate data (dataDownload.groovy) running: testscripts/dataDownload.groovy download data scenario download data (dataDownload.groovy) downloading... [.] download data (dataDownload.groovy) running: testscripts/dataDownload.groovy clean data scenario clean data (dataDownload.groovy) cleaning... [.] clean data (dataDownload.groovy) Use s to display last ran or selected scenarios. These scenarios will be ran with r webtau:000> s Selected scenarios: validate data download data clean data webtau:000> s 0,2 Selected scenarios: clean data validate data