describe('isEven', () => {
function* evenPositiveIntegers() {
for( let i=0; i < Number.MAX_SAFE_INTEGER
; i+=2 )
yield i
}
forEachItemIn( evenPositiveIntegers() ).it('should return true', item => {
expect( isEven(item) ).toBe(true)
})
})
export const forEachItemIn = items => ({
it: (specText, specFn) => it(specText, async () => {
for( const item of items )
{
await new Promise( done => setTimeout(done) )
specFn(item)
}
})
})
--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at https://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.
Hi Gregg,
thank You for Your answer. I've seen and considered a similar answer on Stackexchange (https://stackoverflow.com/questions/25419201/run-jasmine-spec-multiple-times-in-one-execution).
There is however some concern with that solution: As far as I understand it, Jasmine or at least Karma-Jasmine creates all the specs before executing them (otherwise how does it count and randomize the specs). So for each test to be run, a string and a function object are stored. Let's say in total we have 16 bytes per test. For the example that I've given, we are talking about roughly 70 petabytes of overhead (https://www.wolframalpha.com/input/?i=(2%5E53+-+1)*16bytes+%2F+2).
Granted, the example is a little contrived. The number of test in my case is probably only going to go into the 100k, but then again I under-stated the memory overhead per test above, especially using Karma-Jasmine. Just consider how much data is logged while debugging in Karma-Jasmine's browser window.
A lot of great reporters cannot be used anymore either. The Karma-Spec-Reporter for example which normally gives a great, structured view of the test results would create an abominable wall of text.
Considering the insane amount of combinations that would be
necessary to exhaustively test even the simplest of functions, and
considering how time and mind consuming it can be to test every
edge-case with hand-crafted examples, I feel like I may not be the
only one with the desire to run large amounts of randomized tests.
In the meantime, I've come up with a somewhat acceptable solution
that can be found in the attachments.
P.S.: Apologies for the duplicate post. I couldn't find the
initial post in my Outbox an assumed that I accidentally clicked
discarded the e-mail instead of sending it.
Thank You for Your the support and for the Jasmine testing framework
Dirk
You received this message because you are subscribed to a topic in the Google Groups "Jasmine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jasmine-js/9mWDoBmM7q8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jasmine-js+...@googlegroups.com.
Thank You, yes that was exactly what I was looking for.