forked from UnitTestBot/unittestbot.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-docs-usage-command-line-interface-md-a8caeef9030128213747.js.map
1 lines (1 loc) · 16.6 KB
/
component---src-docs-usage-command-line-interface-md-a8caeef9030128213747.js.map
1
{"version":3,"file":"component---src-docs-usage-command-line-interface-md-a8caeef9030128213747.js","mappings":"8RAQaA,EAAe,Q,gPAC5B,IAAMC,EAAc,CAClBD,aAAAA,GAEIE,EAAYC,EAAAA,EACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,GACF,YACD,OAAO,QAACJ,GAAD,UAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,eAG5E,cACE,GAAM,0BADR,2BAGA,kBAAG,kBAAQC,WAAW,KAAnB,gCAAH,yHAEA,+JAEA,+SAGA,kBAAG,kBAAQA,WAAW,KAAnB,mBAAH,iEAAuH,aAAGA,WAAW,IACjI,KAAQ,WAD2G,QAAvH,MAGA,yNAC6E,sBAAYA,WAAW,KAAvB,aAD7E,aAEA,oBAAK,gBAAMA,WAAW,MAClB,UAAa,eADZ,+iBAgBL,iEAAmD,sBAAYA,WAAW,KAAvB,cAAnD,6CACA,cACE,GAAM,kBADR,mBAGA,sEAAwD,sBAAYA,WAAW,KAAvB,UAAxD,wDACE,sBAAYA,WAAW,KAAvB,yBADF,MAEA,oBAAK,gBAAMA,WAAW,MAClB,UAAa,eADZ,qoBAgBL,cACE,GAAM,YADR,aAGA,oHACA,0HACA,oBAAK,gBAAMA,WAAW,MAClB,UAAa,eADZ,8BAIL,uIACA,oBAAK,gBAAMA,WAAW,MAClB,UAAa,eADZ,oEAIL,cACE,GAAM,oBADR,qBAGA,wFAA0E,sBAAYA,WAAW,KAAvB,YAA1E,wDACS,sBAAYA,WAAW,KAAvB,2BADT,MAEA,oBAAK,gBAAMA,WAAW,MAClB,UAAa,eADZ,g3DAmCL,mLACoC,sBAAYA,WAAW,KAAvB,iBADpC,mEAEE,sBAA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,EAAWK,gBAAiB","sources":["webpack://unittestbot-web/./src/docs/usage/command-line-interface.md"],"sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\n\nimport DefaultLayout from \"/home/user/Github/utbot-new-wiki/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n\n\n <h1 {...{\n \"id\": \"command-line-interface\"\n }}>{`Command Line Interface`}</h1>\n <p><strong parentName=\"p\">{`Command Line Interface (CLI)`}</strong>{` allows users to get access to all UnitTestBot features via command line without any\nspecific client (i.e. VSCode).`}</p>\n <p>{`All the commands that are provided in UnitTestBot extension for Microsoft Visual Studio Code can be accessed directly\nfrom the terminal.`}</p>\n <p>{`Command Line Interface is essential for the ones who need to generate tests for really big projects, then run them and\ncollect coverage information. What's more, UTBot CLI version allows to run your custom generation and running scenarios\ncombining them with some external tools.`}</p>\n <p><strong parentName=\"p\">{`UnitTestBot CLI`}</strong>{` is a part of a server executable and can be downloaded from `}<a parentName=\"p\" {...{\n \"href\": \"install\"\n }}>{`here`}</a>{`.`}</p>\n <p>{`The executable provides several commands: it allows user to run server or CLI commands. If no command is specified,\nserver will be run. In order to learn more about utbot executable features use `}<inlineCode parentName=\"p\">{`-h/--help`}</inlineCode>{` option.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot --help\nUnit tests auto-generation tool for C projects.\nUsage: ./utbot [OPTIONS] [SUBCOMMAND]\n\nOptions:\n -h,--help Print this help message and exit\n --help-all Expand all help\n\nSubcommands:\n server Launch UTBot server.\n generate Generate unit tests and/or stubs.\n run Launch unit tests and generate coverage info.\n all Sequential launch of 'generate stubs' -> 'generate project' -> 'run'.\n`}</code></pre>\n <p>{`In case to read all information, please use `}<inlineCode parentName=\"p\">{`--help-all`}</inlineCode>{` option. It will display all the manual.`}</p>\n <h2 {...{\n \"id\": \"server-command\"\n }}>{`Server Command`}</h2>\n <p>{`In order to run UTBot in server mode, please use `}<inlineCode parentName=\"p\">{`server`}</inlineCode>{` subcommand. The command options can be viewed\nvia `}<inlineCode parentName=\"p\">{`./utbot server --help`}</inlineCode>{`.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot server --help\nLaunch UTBot server.\nUsage: ./utbot server [OPTIONS]\n\nOptions:\n -h,--help Print this help message and exit\n --help-all Expand all help\n -p,--port UINT Port server run on.\n -j UINT Maximum number of threads per user.\n --tmp TEXT Path to temporary folder.\n --log TEXT Path to folder with logs.\n -v,--verbosity ENUM:value in {debug|error|info|trace|warning}:value in {debug->1,error->-2,info->0,trace->9,warning->-1} OR {1,-2,0,9,-1}\n Logger verbosity.\n`}</code></pre>\n <h3 {...{\n \"id\": \"examples\"\n }}>{`Examples`}</h3>\n <p>{`Let us provide with several examples of how you can run UnitTestBot executable in server mode.`}</p>\n <p>{`In case you are fine with default settings you can avoid passing parameters and just run executable.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot\n`}</code></pre>\n <p>{`If you want to be more specific in terms of your settings (e.g., change port and log folder), run it accordingly:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot --port 2130 --log \"/home/utbot/logs\".\n`}</code></pre>\n <h2 {...{\n \"id\": \"generate-command\"\n }}>{`Generate Command`}</h2>\n <p>{`If you want to generate tests for the source code, you need to use `}<inlineCode parentName=\"p\">{`generate`}</inlineCode>{` subcommand. The command options can be\nviewed via `}<inlineCode parentName=\"p\">{`./utbot generate --help`}</inlineCode>{`.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot generate --help\nGenerate unit tests and/or stubs.\nUsage: ./utbot generate [OPTIONS] SUBCOMMAND\n\nOptions:\n -h,--help Print this help message and exit\n --help-all Expand all help\n[Option Group: Project context]\n Options:\n -p,--project-path TEXT REQUIRED\n Path to testing project root.\n -t,--tests-dir TEXT=tests Relative path to directory in which tests will be generated.\n -b,--build-dir TEXT=build Relative path to build directory with compile_commands.json and/or coverage.json.\n[Option Group: Settings context]\n Options:\n -g,--generate-for-static True, if you want UTBot to generate tests for static functions.\n -v,--verbose Set if Huawei’s five rule standard is required.\n --timeout INT=30 Maximum time (in seconds) is allowed for generation tests per function. Set to non-positive number to disable it.\n --no-deterministic-searcher Use deterministic searcher to traverse bitcode in the same way every time. It may significantly slow down generation.\n --no-stubs True, if you don’t want UTBot to use generated stubs from <testsDir>/stubs folder instead real files.\n\nSubcommands:\n project Generate tests for C project.\n stubs Generate stubs for project.\n folder Generate tests for folder.\n file Generate tests for file in project.\n snippet Generate tests for code snippet.\n function Generate tests for function.\n class Generate tests for C++ class.\n line Generate tests for line in file.\n assertion Generate tests that fails assertion.\n predicate Generate tests with given result.\n`}</code></pre>\n <p>{`The command provides other subcommands, that specify test generation mode. It's required to use one. These subcommands\nmay require additional options (i.e., `}<inlineCode parentName=\"p\">{`--line-number`}</inlineCode>{`) in order to run them. Existing options can be displayed\nvia `}<inlineCode parentName=\"p\">{`./utbot generate [SUBCOMMAND] --help`}</inlineCode>{`. You can also check them via global `}<inlineCode parentName=\"p\">{`--help-all`}</inlineCode>{` option.`}</p>\n <p>{`Generated tests can be found in a test folder (`}<inlineCode parentName=\"p\">{`tests`}</inlineCode>{` subfolder in the project directory by default).`}</p>\n <h3 {...{\n \"id\": \"examples-1\"\n }}>{`Examples`}</h3>\n <p>{`Below we demonstrate several examples of how to run generation commands.`}</p>\n <p><strong parentName=\"p\">{`Generate tests for snippet`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot generate --project-path \"/home/snippets/\" snippet --file-path \"home/snippets/snippet.c\"\n`}</code></pre>\n <p>{`Here, `}<inlineCode parentName=\"p\">{`--project-path`}</inlineCode>{` is path to the parent directory of the given snippet file `}<inlineCode parentName=\"p\">{`snippet.c`}</inlineCode>{`.`}</p>\n <p><strong parentName=\"p\">{`Generate tests for project`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot generate --project-path \"/home/projects/c-project\" project\n`}</code></pre>\n <p><strong parentName=\"p\">{`Generate tests for function`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot generate --project-path \"/home/projects/c-project\" function --file-path /home/projects/c-project/complex_structs.c --line-number 39\n`}</code></pre>\n <p><strong parentName=\"p\">{`Generate tests with prompted result`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot generate --project-path \"/home/projects/c-project/\" predicate --file-path \"/home/projects/c-project/basic_functions.c\" --line-number 5 --predicate == --return-value 11 --validation-type int32\n`}</code></pre>\n <h2 {...{\n \"id\": \"run-command\"\n }}>{`Run Command`}</h2>\n <p>{`One of the main features of UnitTestBot that allows to run tests with coverage is available in CLI mode as well. In\norder to run the tests, type in the following command: `}<inlineCode parentName=\"p\">{`./utbot run [OPTIONS] [SUBCOMMAND] [SUBCOMMAND OPTIONS]>`}</inlineCode>{`.\nSubcommand in this case specifies whether to run all generated tests, tests in one file, or just one specific test.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot run --help\nLaunch unit tests and generate coverage info.\nUsage: ./utbot run [OPTIONS] [SUBCOMMAND]\n\nOptions:\n -h,--help Print this help message and exit\n --help-all Expand all help\n[Option Group: Project context]\n Options:\n -p,--project-path TEXT REQUIRED\n Path to testing project root.\n -t,--tests-dir TEXT=tests Relative path to directory in which tests will be generated.\n -b,--build-dir TEXT=build Relative path to build directory with compile_commands.json and/or coverage.json.\n[Option Group: Settings context]\n Options:\n -g,--generate-for-static True, if you want UTBot to generate tests for static functions.\n -v,--verbose Set if Huawei’s five rule standard is required.\n --timeout INT=30 Maximum time (in seconds) is allowed for generation tests per function. Set to non-positive number to disable it.\n --no-deterministic-searcher Use deterministic searcher to traverse bitcode in the same way every time. It may significantly slow down generation.\n --no-stubs True, if you don’t want UTBot to use generated stubs from <testsDir>/stubs folder instead real files.\n\nSubcommands:\n test Run specified test\n file Run all tests in specified file\n project Run all tests for this project\n`}</code></pre>\n <p>{`Similiarly to `}<inlineCode parentName=\"p\">{`generate`}</inlineCode>{` subcommands, you can access manual for `}<inlineCode parentName=\"p\">{`run`}</inlineCode>{` subcommands via `}<inlineCode parentName=\"p\">{`./utbot run [SUBCOMMAND] --help`}</inlineCode>{`.`}</p>\n <h3 {...{\n \"id\": \"examples-2\"\n }}>{`Examples`}</h3>\n <p><strong parentName=\"p\">{`Run all tests for project`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot run --project-path \"/home/projects/c-project\" project\n`}</code></pre>\n <p><strong parentName=\"p\">{`Run test file`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot run --project-path \"/home/projects/c-project\" file --file-path \"home/projects/c-project/tests/basic_functions_test.cpp\" \n`}</code></pre>\n <p><strong parentName=\"p\">{`Run specific test`}</strong></p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot run --project-path \"/home/projects/c-project\" test --file-path \"/home/projects/c-project/tests/basic_functions_test.cpp\" --test-suite \"regression\" --test-name \"max__test_1\"\n`}</code></pre>\n <h2 {...{\n \"id\": \"all-command\"\n }}>{`All Command`}</h2>\n <p>{`For simplicity, UTBot CLI provides `}<inlineCode parentName=\"p\">{`all`}</inlineCode>{` command, that firstly generates stubs for the project, then generates project\ntests and finally runs them with coverage.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot all --help\nSequential launch of 'generate stubs' -> 'generate project' -> 'run'.\nUsage: ./utbot all [OPTIONS]\n\nOptions:\n -h,--help Print this help message and exit\n --help-all Expand all help\n --no-coverage BOOLEAN Flag that controls coverage generation.\n -s,--src-paths TEXT Relative paths to directories, containing source files. Separate each path with comma.\n[Option Group: Project context]\n Options:\n -p,--project-path TEXT REQUIRED\n Path to testing project root.\n -t,--tests-dir TEXT=tests Relative path to directory in which tests will be generated.\n -b,--build-dir TEXT=build Relative path to build directory with compile_commands.json and/or coverage.json.\n[Option Group: Settings context]\n Options:\n -g,--generate-for-static True, if you want UTBot to generate tests for static functions.\n -v,--verbose Set if Huawei’s five rule standard is required.\n --timeout INT=30 Maximum time (in seconds) is allowed for generation tests per function. Set to non-positive number to disable it.\n --no-deterministic-searcher Use deterministic searcher to traverse bitcode in the same way every time. It may significantly slow down generation.\n --no-stubs True, if you don’t want UTBot to use generated stubs from <testsDir>/stubs folder instead real files.\n`}</code></pre>\n <h3 {...{\n \"id\": \"examples-3\"\n }}>{`Examples`}</h3>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-sh\"\n }}>{`user@laptop:~$ ./utbot all --project-path \"/home/projects/c-project\"\n`}</code></pre>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","isMDXComponent"],"sourceRoot":""}