A tool for dynamic test generation for JavaScript

Hello guys. I’m writing a tool for dynamic test generation for JavaScript. You can see a video here. The tool uses the symbolic execution tecnique to get the path constraint of a function and then it uses an SMT-solver to solve it.

Suppose that you want to test this function:

function f_1 (a) {
  switch (a) {
    case 1:
      break;
    case 2:
      break;
    case 3:
      break;
    default:
  }

  return 12;
}
```

this is the result:

    { errors: [],
      testCases: [ { a: 10 }, { a: 1 }, { a: 2 }, { a: 3 } ],
      results:
       [ { type: 'number', value: 12, description: '12' },
         { type: 'number', value: 12, description: '12' },
         { type: 'number', value: 12, description: '12' },
        { type: 'number', value: 12, description: '12' } ] }

I resume the example in this image:

[img]http://s22.postimg.org/tybzobekf/Screen_Shot_2016_01_18_at_18_09_38.png[/img]

I really appreciate any suggestions to improve it. The source code is not avaiable yet since there is not a stable version.

Sounds interesting, does it just look at the one function for different inputs or can it work if that function calls other functions?

One use for this would be to be able to easily find the most complex functions in your code, similar to what https://github.com/square/cane does with Ruby methods.

is this a typo in your code?

function f_1 (obj) {
  switch (obj.a) {
     ...
  }
}

Hi markbrown4, thank you for your answer. I’m working on that. First of all I would like to complete the part on the primitive of the language and then I’ll try to implement the part of the objects, but since they are composed by primitives, it will be easy to add this feature.

I didn’t know about that project, but your idea seems interesting. I’ll think on that.

This is another example using strings. At the moment, the tool supports only ‘length’ property and ‘charAt’/‘substring’ methods.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.