Akiira / Comp-524-program

A genetic algorithm to create test suites that cover every branch of a program
2 stars 0 forks source link

Generation of test cases in ranges #15

Closed ambarket closed 9 years ago

ambarket commented 9 years ago

I implemented two versions of this. The first (in the populationGeneration branch) split the population up into subsets, where the first edges+preds test cases of each test suite in a given subset pulled from the same range. The rest would pull each parameter from a random range.

I then realized this isn't what we talked about so I modified it to be the way we disucssed in the other appropriately named branch.

In both cases taking this approach increases the starting coverage from ~7% to ~11% which is somewhat interesting. They still max out the same though around ~48 to 52%. Which it reaches in about 250 generations.

Hopefully once the test case crossover is implemented we'll see a benefit from this. However I have a feeling its not going to be very apparent because each range is still about 10 billion with this approach ( 2 - 4 trillion / hundreds).

The first approach may prove promising with larger populations, and larger number of ranges to get more diverse values. We'd need at least 10000 ranges and therefore at least 10000 members of the pop just to get down to ranges in the millions though.

Akiira commented 9 years ago

I accidentally merged this into master. I was trying to push to my own branch that i was experimenting with parameters on but the eclipse push configuration got messed up. If there was any reason you did not want this on master yet let me know and I'll revert the merge.

ambarket commented 9 years ago

It should be fine. That's the version I think will be more helpful anyway. To get up to speed check out Comp 524 Program where NUM_OF_RANGES is set. TestCase.cpp where the cases are being generated and Population.cpp where the testSuites are assigned a range. And testSuite.cpp where the first edges+preds test cases are in the specified range and any remaining pull from random ranges.

And note the default testcase constructor now picks a random range and value in that range for each parameter. Thinking about it more though this should be pretty much mathematically equivalent to just picking a random number in the whole range.

ambarket commented 9 years ago

This evolved into a better algorithm, no longer relevant.