Code coverage is always unknown with Flutter in GitLab - flutter

I'm using flutter for this project and when I do the tests I can see the coverage but in the gitlab badge I can't see it.
Gitlab badge
here is my cicd:
cicd with test job
here is my cicd configuration:
Test coverage parsing
Here is my badge configuration
Badge image URL
In the output of test job this is the result:
Test job output
Can someone help me with this please?
Thank you!

Try changing your test coverage parsing regular expression to lines\.*: (\d+.\d+)% the parenthesis (capture group) are important to know what number to pick up.

Related

how to display unit test results from azure devops in github

I have a pipeline that runs on pull requests and executes tests , it also produces an xml execution report (it is a node project and tests run via jest) , and coverage report that I use for sonarcloud. However , the developers want to be able to see the tests results on each pr and see what tests failed in particular, so my question is whether it is possible to somehow export and display those results in github or sonarcloud
Please refer to the following two methods to get the test cases metric in sonarcloud:
You can add sonar.testExecutionReportPaths in Additional Properties option in Prepare Analysis Configuration task. About sonar.coverageReportPaths
For SonarQube to pick up and analyse the content of the report file, you need to inform the sonar scanner. About the location of the XML file. To do so, edit the sonarqube.properties file. Please refer to this.
coverage reporting:
sonar.testExecutionReportPaths=reports/xxx/xxx.xml
In addition, you can also refer to this similar case.

GitLab - test coverage histrory / trend

I use Gitlab CI t report Code Coverage. The CI script prints the output to the console which is then fetched by GitLab via regular expression.
As the result, I get the following coverage description in every merge request:
The question is - how can I track the trend (or change) of this value over a period of time.
I'd like to show the chart with coverage change for e.g. last month, so I'd see, whether the project's code quality is improved or decreased. Looking to something similar to this image:
Which GitLab plugins or open source tools allow to get such a picture / report? Is it possible to achieve a similar result by using just gitlab alone?

Setting Code Coverage percentage in build.yml

I have a requirement of settings code coverage percentage for my unit test cases running in VSTS through the build.yml file.
Right now the build is passing for any code coverage percentage that's coming. I want to restrict this and fail the build if the percentage is not 70%.
Can you help me with this?
You need to publish the test results (and code coverage is in that) and then use another task or release gate to check those results. You can do this with SonarQube Quality gate (needs a SonarQube server) or you can try the marketplace.
For example this task: https://marketplace.visualstudio.com/items?itemName=mspremier.BuildQualityChecks
You can also check it yourself (using PowerShell for example) via the API: https://learn.microsoft.com/en-us/rest/api/vsts/test/code%20coverage?view=vsts-rest-5.0

Travis CI build status failed. What can I do?

I am new in project continuous deployment. I only add my project in Travis CI and add the status logo in my github repo README.md. My project is created using php,html,javascript,bootstrap. And, my project is also connected with mysql database.
Now, what can I do so that it results successful build status.
Edit 1
As I new I don't know where the error message stored by travis ci. But, I can see a job log.
The job log is where you can find out what went wrong. Simply read the logs generated by travis, i.e. here: https://travis-ci.org/al2helal/HandicraftStore/builds/373415975
The error message you're getting is:
The command "phpunit" exited with 2.
Since you haven't defined what you want Travis to do in your .travis.yml, but only configured the language (php), Travis runs the default set of tests for the configured language. In your case it runs phpunit.
However, you haven't written any tests nor you have configured phpunit, so it only displays a help message and exits with an error code.
Before you deploy your automatically anywhere you should run tests that confirm your application is working as expected. Start with writing some.
Next, you'll need to configure Travis to run those tests and configure deployment if all tests pass.
Since you don't seem to know anything about Travis CI, the best place to start is just go through their docs: https://docs.travis-ci.com/

automated test, code coverage, static analysis and codereview

I used to be developer long ago but for last 10 years working on system ops. I am planning to move into devops and trying to sharpen my saw. However, when it comes to jenkins and specially static code analysis, code coverage, automated test and code review, I get so much confused.
Lets start from automated test ( for simplicity take unit test). I understand that we write a separate class file for unit test. But how does that test is carried out? Will jenkins create a jvm where the newly build artifact is deployed and the tests are run against it? or will the test be run against code ( I do not think but still want to clarify)?
I downloaded one example application with maven and codertura from github and build the project. When the build was completed, it publishes code coverage report.
I have not done any post build, for deploying the artifact. So, I am not sure how it works, and what did it do and how?
Thanks
J
Here is a common flow that you can follow to achieve your requirement.
Work with code --> Push to gerrit for review --> Jenkins gerrit trigger plugin get triggered --> The corresponding job will checkout the code you committed and do the compile, package, unit test, deploy to artifactory --> Execute the sonar build to analysis the code quality, static analysis, code coverage...
Br,
Tim