code-coverage

How do I setup code coverage on my Express based API?

只愿长相守 提交于 2020-07-18 03:44:09
问题 I've been at this problem for a while and I cannot make the existing solutions work for me. I have a Node.js API written in Express.js. I have been writing tests for the API using Mocha, Chai, and Supertest. These test are mostly integration tests. One test may look like: it('should fail to register a new user without the proper information', function(done) { api.post('/user') .send({}) .expect(400) .expect('Content-Type', /json/) .end(function(err, res) { should.exist(res.body); should.exist

PyCharm: Coverage in community edition?

依然范特西╮ 提交于 2020-07-07 23:57:10
问题 AFAIK the feature "test coverage" is only available in the professional version (code-coverage). How to see code coverage of my tests with the PyCharm community version? 回答1: You can use PyCrunch plugin for this. As a bonus, tests will rerun when impacted files change. 回答2: As you have already found, test coverage feature is available only in the professional PyCharm version. What it's possible to do is using an external python package that perform the coverage of your test suite. This

PyCharm: Coverage in community edition?

时光总嘲笑我的痴心妄想 提交于 2020-07-07 23:54:30
问题 AFAIK the feature "test coverage" is only available in the professional version (code-coverage). How to see code coverage of my tests with the PyCharm community version? 回答1: You can use PyCrunch plugin for this. As a bonus, tests will rerun when impacted files change. 回答2: As you have already found, test coverage feature is available only in the professional PyCharm version. What it's possible to do is using an external python package that perform the coverage of your test suite. This

How does assert groupType != null contain 4 branches

吃可爱长大的小学妹 提交于 2020-06-28 03:16:09
问题 I need to test the following code. public List<PatientGroup> findGroups(final String groupType) throws HwBaseAppException { assert groupType != null;//4 branches here CriteriaBuilder criteriaBuilder=persistence.getCriteriaBuilder(); CriteriaQuery<PatientGroup> query = criteriaBuilder.createQuery(PatientGroup.class); Root<PatientGroup> patientGroupRoot = query.from(PatientGroup.class); Predicate condition=criteriaBuilder.equal(patientGroupRoot.get(PatientGroup_.active), Boolean.TRUE); Join

Skipping JaCoCo execution due to missing execution data error

↘锁芯ラ 提交于 2020-06-11 17:02:29
问题 I am getting Skipping JaCoCo execution due to missing execution data file:/scratch/jenkins/workspace/sonar-test/target/jacoco.exec error My pom profile is: <profile> <id>test-coverage</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven.surefire.plugin.version}</version> <configuration combine.self="override"> <redirectTestOutputToFile>true</redirectTestOutputToFile> <testFailureIgnore>true<

Code Coverage report shown only for polyfills.ts and test.ts under Dev\ folder. Doest show coverage for files under src folder

你说的曾经没有我的故事 提交于 2020-06-09 07:08:06
问题 In my angular 7 app, when i run "ng test --watch=false --code-coverage true" i get the coverage report in my coverage folder, but coverage is shown only for two files. (Polyfills.ts & test.ts). Below is my project structure. Please let me know how to get coverage for files under SRC folder. Note: when i run ng test all the tests under SRC folder is getting executed. dev --app --test.ts --tsconfig.app.json --tsconfig.spec.json src --lib --component --services angular.json karma.conf.json test

Sonarqube: line out of range since file shrinks after merge with master

孤街浪徒 提交于 2020-06-01 06:18:42
问题 There is a fileA on master (say it consists of 1000 lines) We are on feature_branch , where fileA has length of say 1050 lines. On our CI pipeline, we are running coverage (it is a Python project) and it produces coverage.xml , to be used as cov input to SQ. Our SQ preview stage is as follows: - git config --global user.name "SonarQube" - git config --global user.email "sonarqube@somedomain.com" - git checkout origin/master - git merge $CI_BUILD_REF --no-commit --no-ff - sonar-scanner -Dsonar

scoverage: Combine Coverage from test and it:test

半世苍凉 提交于 2020-05-13 02:05:10
问题 I splitted my Unit- and Integration-Tests with a Filter: lazy val FunTest = config("it") extend Test def funTestFilter(name: String): Boolean = name endsWith "Spec" def unitTestFilter(name: String): Boolean = name endsWith "Test" ... testOptions in Test := Seq(Tests.Filter(unitTestFilter)), testOptions in FunTest := Seq(Tests.Filter(funTestFilter)), ... So I can do something like that: sbt clean coverage test dockerComposeUp it:test dockerComposeStop coverageReport Sadly that kills all my

increasing code coverage for JdbcTemplate mocking

冷暖自知 提交于 2020-05-11 11:01:54
问题 I am mocking JdbcTemplate for unit test cases, as don't want to hit actual database integration. But it is decreasing my code coverage (Red indicates missing coverage). Below is the snippet used. Same case happens by using user defined mappers. final List<String> resultList = new ArrayList<String>(); resultList.add("test1"); resultList.add("test2"); final JdbcTemplate template = Mockito.mock(JdbcTemplate.class); Mockito.when( template.query(Mockito.anyString(), Mockito.any(Object[].class),

increasing code coverage for JdbcTemplate mocking

六眼飞鱼酱① 提交于 2020-05-11 10:59:01
问题 I am mocking JdbcTemplate for unit test cases, as don't want to hit actual database integration. But it is decreasing my code coverage (Red indicates missing coverage). Below is the snippet used. Same case happens by using user defined mappers. final List<String> resultList = new ArrayList<String>(); resultList.add("test1"); resultList.add("test2"); final JdbcTemplate template = Mockito.mock(JdbcTemplate.class); Mockito.when( template.query(Mockito.anyString(), Mockito.any(Object[].class),