diff --git a/src/css/custom.css b/src/css/custom.css index 62d88b7ef..e567267b8 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -142,6 +142,10 @@ div[class^="sidebar_"] .button svg { @apply font-bold text-[color:var(--ifm-color-primary)]; } +th, #lang { + text-align: center; +} + .docs-wrapper aside { @apply border-0; } diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/go.md b/versioned_docs/version-2.0.0/server/sdk-installation/go.md index 8d4aba659..826c0cde6 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/go.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/go.md @@ -18,18 +18,6 @@ keyword: - Go Test --- -import WhatAreKeployFeatures from './index.md' - - - -## Usage - -For keploy test coverage the binary must built with `-cover` flag: - -```go -go build -cover -``` - To get the coverage data for unit tests : ```go diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/index.md b/versioned_docs/version-2.0.0/server/sdk-installation/index.md index 44ef2c149..29aacf0d3 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/index.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/index.md @@ -1,6 +1,6 @@ --- id: index -title: Pre-requites 🛠️ +title: Test Coverage Generation tags: - coverage keyword: @@ -24,6 +24,8 @@ To get the coverage report, first make sure all the requirements are met and the keploy test -c "your_application_command" ``` +In case of **docker** command, you would need to set `--skipCoverage` flag to false as by default coverage is disabled. Also language must be explicitly passed through `--language` flag. + After successful execution of this command, A coverage report would be generated inside the test-run folder of keploy/reports. ```sh @@ -39,20 +41,86 @@ keploy └── test-2.yaml ``` -**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command. - +:::note +In case of java application, before running test subcommand, you need to clean the target folder by removing any previously generated file, and then running install command. Else you may get [class mismatch error](https://www.eclemma.org/jacoco/trunk/doc/classids.html) or total coverage percentage would come out to be 0. ```bash mvn clean install -Dmaven.test.skip=true ``` +::: + ## 🛠️ Language Specific Requirements -| Programming Language | Prerequisites | -| :------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| go | 1. The application should have a graceful shutdown to stop the API server on `SIGTERM` or `SIGINT` signals. Refer [appendix](#graceful-shutdown) for basic implementation of graceful shutdown function.
2. The go binary should be built with `-cover` flag. | -| python | [Python 3 and above](https://www.python.org/downloads/)
[coverage.py](https://coverage.readthedocs.io/en/7.4.1/install.html) | -| javascript | [nyc](https://www.npmjs.com/package/nyc) | -| java | [Jacoco 0.8.8](https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin/0.8.8) | + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Programming Language + + Prerequisites +
NativeDocker
+ go + + 1. The application should have a graceful shutdown to stop the API server on `SIGTERM` or `SIGINT` signals. Refer [appendix](#graceful-shutdown) for basic implementation of graceful shutdown function. + 2. The go binary should be built with `-cover` flag. +
+ python + + [coverage.py v7.6.0 and above](https://coverage.readthedocs.io/en/7.6.0/install.html) + + update your CMD instruction to:
+ `CMD ["sh", "-c", "python3 -m coverage run $APPEND --data-file=.coverage.keploy app.py"]`,
+ where app.py will be the program to run. +
+ javascript + + [nyc](https://www.npmjs.com/package/nyc) + + 1. Add a new script to package.json:
+ `"keploy-coverage": "nyc --clean=$CLEAN npm run start",` + 2. Change the CMD instruction to:
+ `CMD [ "npm", "run", "keploy-coverage" ]` +
+ java + + [Jacoco](https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin/0.8.8) + + Update the CMD instruction to:
+ `CMD ["sh", "-c", "java $JACOCOAGENT -jar "]` +
+ +:::note +If container fails to stop after keploy test-set run, then include the below instructions in your dockerfile: +```sh +RUN apt-get install -y dumb-init +ENTRYPOINT [ "dumb-init", "--" ] +``` +::: ## Graceful Shutdown diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index 7e53d324a..abffeaee7 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -18,12 +18,6 @@ keyword: - Junit --- -import WhatAreKeployFeatures from './index.md' - - - -## Usage - ### Update `pom.xml` file You will need to add the following plugins in `pom.xml` file of your application. :- diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/javascript.md b/versioned_docs/version-2.0.0/server/sdk-installation/javascript.md index 13bccf6c0..27c767236 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/javascript.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/javascript.md @@ -21,12 +21,6 @@ keywords: - Typescript --- -import WhatAreKeployFeatures from './index.md' - - - -## Usage - ### Update package file Update the `package.json` file that runs the application: diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/python.md b/versioned_docs/version-2.0.0/server/sdk-installation/python.md index a2eac2ebb..e1fafd020 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/python.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/python.md @@ -16,12 +16,6 @@ keyword: - Pytest --- -import WhatAreKeployFeatures from './index.md' - - - -## Usage - To get the coverage data for your unit tests: ```sh diff --git a/versioned_sidebars/version-2.0.0-sidebars.json b/versioned_sidebars/version-2.0.0-sidebars.json index 0ab24b2cc..b73b1e39f 100644 --- a/versioned_sidebars/version-2.0.0-sidebars.json +++ b/versioned_sidebars/version-2.0.0-sidebars.json @@ -46,6 +46,10 @@ "label": "Test Coverage Generation", "collapsible": true, "collapsed": true, + "link": { + "type": "doc", + "id": "server/sdk-installation/index" + }, "items": [ "server/sdk-installation/go", "server/sdk-installation/java",