|
| 1 | +# SynTest Framework - JavaScript |
| 2 | + |
| 3 | +> The aim of this tool is make it easier for JavaScript developers to test their code in a more effective and efficient way. |
| 4 | +
|
| 5 | +A tool to generate synthetic tests for the JavaScript language |
| 6 | + |
| 7 | +### What is SynTest JavaScript? |
| 8 | + |
| 9 | +SynTest JavaScript is a tool for automatically generating test cases for the JavaScript language. This tool is part of the [SynTest Framework](https://www.syntest.org). This framework contains multiple tools related to the generation of synthetic tests. |
| 10 | + |
| 11 | +### Overview |
| 12 | + |
| 13 | +The common core contains the common interfaces for the code control-flow representation, test case structure, genes, and the implementation for the meta-heuristic search algorithms. |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +#### NPM |
| 18 | + |
| 19 | +The simplest way to use syntest-javascript is by installing the [npm package](https://www.npmjs.com/package/syntest/javascript). |
| 20 | + |
| 21 | +```bash |
| 22 | +$ npm install @syntest/javascript |
| 23 | +``` |
| 24 | + |
| 25 | +You can install it in your project as shown in the snippit above or you can install the package globally by using the npm options `-g`. |
| 26 | + |
| 27 | +#### From source |
| 28 | + |
| 29 | +The tool can be used by cloning the project, installing its dependencies, and compiling the TypeScript: |
| 30 | + |
| 31 | +- Clone the projects |
| 32 | + |
| 33 | +```bash |
| 34 | +$ git clone git@github.com:syntest-framework/syntest-javascript.git |
| 35 | +``` |
| 36 | + |
| 37 | +- Install dependencies |
| 38 | + |
| 39 | +```bash |
| 40 | +$ cd syntest-javascript; npm install |
| 41 | +``` |
| 42 | + |
| 43 | +- Build Syntest-javascript |
| 44 | + |
| 45 | +```bash |
| 46 | +$ cd syntest-javascript; npm run build |
| 47 | +``` |
| 48 | + |
| 49 | +You can create a `.syntest.js` file to change the way the tool behaves. |
| 50 | + |
| 51 | +Finally run the tool |
| 52 | + |
| 53 | +```bash |
| 54 | +cd <PATH_TO_SYNTEST_JAVASCRIPT>; npm run standalone |
| 55 | +``` |
| 56 | + |
| 57 | +The results can be found in the `syntest` folder |
| 58 | + |
| 59 | +## Usage |
| 60 | + |
| 61 | +To start you need to be in the root of the project folder containing the code you want to create test-cases for. Next, you need to install two dev-dependencies in your project, namely [chai](https://www.npmjs.com/package/chai) and [chai-as-promised](https://www.npmjs.com/package/chai-as-promised). Both are needed to run the tests. |
| 62 | + |
| 63 | +After installing these dependencies together with the tool, you can run the following example command. |
| 64 | + |
| 65 | +```bash |
| 66 | +$ syntest-javascript --target-root-directory="<PATH_TO_YOUR_SOURCE_FOLDER>/src" --total-time=10 |
| 67 | +``` |
| 68 | + |
| 69 | +This will test all javascript code that is contained in the source folder. It will run for 10 seconds. |
| 70 | + |
| 71 | +SynTest-JavaScript is highly configurable and supports a bunch of options and arguments, all of them can be found by providing the `--help` option or `-h` for short. Another way of configuring the tool is by putting a .syntest.js file in the root of your project. The file should have the following structure: |
| 72 | + |
| 73 | +```js |
| 74 | +module.exports = { |
| 75 | + "population-size": 10, |
| 76 | + "max-depth": 5, |
| 77 | + ... |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +## Documentation |
| 82 | + |
| 83 | +For questions and help with how to use this tool, please see the [documentation](https://www.syntest.org). |
| 84 | + |
| 85 | +## Support |
| 86 | + |
| 87 | +For questions and help with how to use this library, please see [SUPPORT.md](SUPPORT.md). |
| 88 | + |
| 89 | +## Contributing |
| 90 | + |
| 91 | +Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change. For more information, please see [CONTRIBUTING.md](CONTRIBUTING.md). |
| 92 | + |
| 93 | +## Authors and acknowledgment |
| 94 | + |
| 95 | +- Annibale Panichella (PI) |
| 96 | +- Mitchell Olsthoorn (Project Lead) |
| 97 | +- Dimitri Stallenberg (Developer) |
| 98 | + |
| 99 | +## License |
| 100 | + |
| 101 | +The code within this project is licensed under the [Apache-2.0 license](LICENSE). |
0 commit comments