Comments (11)
It isn't built into busted yet, but I can tag this as a feature request.
from busted.
question with #48 is then whether it is limited to randomizing per testfile, or it would automatically disable threaded testing and randomize all available tests.
from busted.
Good question - I assume randomizing per testfile. I don't have a strong opinion - if we want a truly global random, then we could probably either:
- run each test in its own thread
- run with one single thread
from busted.
It seems like globally random would be ideal, but per file would certainly be sufficient (particularly if there is any kind of limitation running tests across files). Are there any constraints related to setup/teardown only running once? I THINK most test frameworks that randomize do so for each level of tests - this would imply file-level randomization. I am open to working on this feature if noone else is available/willing to pick it up, although I would certainly need some guidance.
from busted.
I think a couple of items should be combined;
- threaded testing #48
- implementing snapshots (see lunarmodules/luassert#38) on each nested level
- randomizing tests
This requires some rework on the engine. Currently the bootstrapper loads and executes the testfiles (does not run the tests itself) and then hands the set of tests to the busted core and there the tests are executed.
To make this work properly, executing the testfiles should also move into busted core, because each test file needs to be wrapped in a luassert snapshot.
Or stated otherwise; now there are nested levels of describe()
and it()
blocks, and the testfile itself is not a block but should be added as one.
from busted.
Just posted #93
Which triggered me that the randomization can not go beyond the scope of a describe()
block, because the setup()
and teardown()
only run once per describe()
block.
from busted.
when doing randomization, on what level should this be set?
- global through a commandline option
- per
describe()
block through a function egrandomize(true/false)
which should then make all tests in thatdescribe()
(and nested ones) randomized (or explicitly not randomized)
from busted.
@ToadJamb I think the current master should make it possible to add the randomization. It has to be done on the level of a describe()
block, so the run_context()
function in core.lua
seems to be the right spot.
from busted.
A global --randomize
could work with tagged tests. It'd also be easy to add in randomize()
as a function if it's in the bottom of a describe block - describe would hit this and scramble the indexes in the context tree. This wouldn't be recursive by default, although we could add in a flag like randomize({ recursive = true })
to have it recurse through sub-describes. This would also allow you to say "randomize these tests that are above me", if you only want to randomize a subset.
Would that flexibility be a feature, or just a leftover of taking the lazy way to implement it?
from busted.
for simplicity rather randomize_all()
then randomize({ recursive = true })
. And then the option --randomize
should behave as a randomize_all()
on the top-level describe of testfiles.
and the functions should overrule the command line option.
from busted.
Yes, that makes sense.
from busted.
Related Issues (20)
- Can't install dependency of busted via luarocks HOT 1
- Can't install dependency 'mediator_lua' of busted via luarocks HOT 2
- Lua
- bad release HOT 1
- Can't install/run on Windows 10 HOT 3
- Garbled characters in output HOT 4
- Wrong `LUAROCKS_SYSCONFDIR` in `busted.bat` HOT 1
- `package.moonpath` is never updated which breaks Moonscript module requirements HOT 1
- [feature request] Support clean up function for it() HOT 4
- Async documented but not functional HOT 1
- [question] how to pass argument to function when trying to catch errors HOT 2
- [help needed] fails to execute as a standalone file HOT 2
- the comand line argument with space will be split when use --lua
- Fails to encode results to json due to non-string error objects being raised
- [Feature Request] Could we introduce a new context for ordered tests? HOT 11
- Make it easier to run a global before_each before all before_each blocks or a global after_each after all after_each blocks HOT 1
- Make it easier to run a global before_each before all before_each blocks or a global after_each after all after_each blocks HOT 1
- Fennel loader? HOT 2
- Bug? Loader applied to wrong language
- Teee HOT 1
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 busted.