From 14316c4e9fa4efe86b0b0a57fbbdadc2fcd96a9c Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 27 May 2015 12:48:41 +0200 Subject: [PATCH] add web tests for quality gates page --- .../main/coffee/apps/quality-gate/app.coffee | 1 + .../src/test/js/quality-gates-spec.js | 570 ++++++++++- .../quality-gates-spec/app-anonymous.json | 835 +++++++++++++++++ .../src/test/json/quality-gates-spec/app.json | 884 ++++++++++++++++-- .../test/json/quality-gates-spec/copy.json | 4 + .../quality-gates-spec/create-condition.json | 8 + .../test/json/quality-gates-spec/create.json | 4 + .../test/json/quality-gates-spec/list.json | 10 +- .../test/json/quality-gates-spec/rename.json | 4 + .../json/quality-gates-spec/show-another.json | 4 + .../json/quality-gates-spec/show-created.json | 4 + .../test/json/quality-gates-spec/show.json | 118 ++- .../quality-gates-spec/update-condition.json | 7 + 13 files changed, 2304 insertions(+), 149 deletions(-) create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/app-anonymous.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/copy.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/create-condition.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/create.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/rename.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/show-another.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/show-created.json create mode 100644 server/sonar-web/src/test/json/quality-gates-spec/update-condition.json diff --git a/server/sonar-web/src/main/coffee/apps/quality-gate/app.coffee b/server/sonar-web/src/main/coffee/apps/quality-gate/app.coffee index 770d1f1e454..f238ddeb559 100644 --- a/server/sonar-web/src/main/coffee/apps/quality-gate/app.coffee +++ b/server/sonar-web/src/main/coffee/apps/quality-gate/app.coffee @@ -39,6 +39,7 @@ define [ App.openFirstQualityGate = -> + App.layout.headerRegion.reset() App.layout.detailsRegion.reset() diff --git a/server/sonar-web/src/test/js/quality-gates-spec.js b/server/sonar-web/src/test/js/quality-gates-spec.js index ec78d267a17..6c1d34cd6f5 100644 --- a/server/sonar-web/src/test/js/quality-gates-spec.js +++ b/server/sonar-web/src/test/js/quality-gates-spec.js @@ -19,49 +19,601 @@ */ /* global casper:false */ -var lib = require('../lib'); +var lib = require('../lib'), + testName = lib.testName('Quality Gates'); lib.initMessages(); lib.changeWorkingDirectory('quality-gates-spec'); lib.configureCasper(); -casper.test.begin('Quality Gates', function suite (test) { +casper.test.begin(testName('Should Show List'), 5, function (test) { + casper + .start(lib.buildUrl('quality_gates'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + }); + }) + + .then(function () { + casper.waitForSelector('.quality-gates-results .list-group-item'); + }) + + .then(function () { + test.assertElementCount('.quality-gates-results .list-group-item', 3); + test.assertSelectorContains('.quality-gates-results .list-group-item', 'SonarQube way'); + test.assertSelectorContains('.quality-gates-results .list-group-item', 'Simple Gate'); + test.assertSelectorContains('.quality-gates-results .list-group-item', 'Another Gate'); + + test.assertElementCount('.quality-gates-results .badge', 1); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Show Details', 'Anonymous'), 12, function (test) { + casper + .start(lib.buildUrl('quality_gates'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app-anonymous.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + }); + }) + + .then(function () { + casper.waitForSelector('.quality-gates-results .list-group-item'); + }) + + .then(function () { + // FIXME use better selector + casper.click('.quality-gates-results .list-group-item:last-child'); + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertElementCount('.quality-gates-results .list-group-item.active', 1); + test.assertSelectorContains('.quality-gates-results .list-group-item.active', 'SonarQube way'); + + test.assertSelectorContains('.search-navigator-workspace-header', 'SonarQube way'); + test.assertDoesntExist('#quality-gate-rename'); + test.assertDoesntExist('#quality-gate-copy'); + test.assertDoesntExist('#quality-gate-unset-as-default'); + test.assertDoesntExist('#quality-gate-delete'); + + test.assertExists('.quality-gate-conditions'); + test.assertElementCount('.quality-gate-conditions tbody tr', 8); + test.assertDoesntExist('.quality-gate-conditions .update-condition'); + test.assertDoesntExist('.quality-gate-conditions .delete-condition'); + + test.assertExists('.quality-gate-default-message'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Show Details', 'Admin'), 12, function (test) { + casper + .start(lib.buildUrl('quality_gates'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + }); + }) + + .then(function () { + casper.waitForSelector('.quality-gates-results .list-group-item'); + }) + + .then(function () { + // FIXME use better selector + casper.click('.quality-gates-results .list-group-item:last-child'); + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertElementCount('.quality-gates-results .list-group-item.active', 1); + test.assertSelectorContains('.quality-gates-results .list-group-item.active', 'SonarQube way'); + + test.assertSelectorContains('.search-navigator-workspace-header', 'SonarQube way'); + test.assertExists('#quality-gate-rename'); + test.assertExists('#quality-gate-copy'); + test.assertExists('#quality-gate-unset-as-default'); + test.assertExists('#quality-gate-delete'); + + test.assertExists('.quality-gate-conditions'); + test.assertElementCount('.quality-gate-conditions tbody tr', 8); + test.assertElementCount('.quality-gate-conditions .update-condition', 8); + test.assertElementCount('.quality-gate-conditions .delete-condition', 8); + + test.assertExists('.quality-gate-default-message'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Rename'), 2, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/1'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + lib.mockRequestFromFile('/api/qualitygates/rename', 'rename.json', { data: { id: '1', name: 'New Name' } }); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + casper.click('#quality-gate-rename'); + casper.waitUntilVisible('#quality-gate-edit-name'); + }) + + .then(function () { + casper.evaluate(function () { + jQuery('#quality-gate-edit-name').val('New Name'); + }); + casper.click('.modal-foot button'); + casper.waitForSelectorTextChange('.search-navigator-header-component'); + }) + + .then(function () { + test.assertSelectorContains('.search-navigator-header-component', 'New Name'); + test.assertSelectorContains('.quality-gates-results .list-group-item.active', 'New Name'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Copy'), 3, function (test) { casper .start(lib.buildUrl('quality_gates#show/1'), function () { lib.setDefaultViewport(); + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + lib.mockRequestFromFile('/api/qualitygates/copy', 'copy.json', { data: { id: '1', name: 'New Name' } }); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + casper.click('#quality-gate-copy'); + casper.waitUntilVisible('#quality-gate-edit-name'); + }) + + .then(function () { + casper.evaluate(function () { + jQuery('#quality-gate-edit-name').val('New Name'); + }); + casper.click('.modal-foot button'); + casper.waitForSelectorTextChange('.search-navigator-header-component'); + }) + + .then(function () { + test.assertSelectorContains('.search-navigator-header-component', 'New Name'); + test.assertSelectorContains('.quality-gates-results .list-group-item.active', 'New Name'); + test.assertSelectorContains('.quality-gates-results .list-group-item', 'SonarQube way'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Set As Default'), 4, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/5'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=5', 'show-another.json'); + lib.mockRequest('/api/qualitygates/set_as_default', '{}', { data: { id: '5' } }); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertDoesntExist('.quality-gates-results .list-group-item.active .badge'); + test.assertDoesntExist('.quality-gate-default-message'); + casper.click('#quality-gate-set-as-default'); + casper.waitForSelector('.quality-gates-results .list-group-item.active .badge'); + }) + + .then(function () { + test.assertExists('.quality-gate-default-message'); + test.assertElementCount('.quality-gates-results .badge', 1); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Unset As Default'), 4, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/1'), function () { + lib.setDefaultViewport(); lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + lib.mockRequest('/api/qualitygates/unset_default', '{}'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertExists('.quality-gates-results .list-group-item.active .badge'); + test.assertExists('.quality-gate-default-message'); + casper.click('#quality-gate-unset-as-default'); + casper.waitWhileSelector('.quality-gates-results .list-group-item.active .badge'); + }) + + .then(function () { + test.assertDoesntExist('.quality-gate-default-message'); + test.assertDoesntExist('.quality-gates-results .badge'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Create'), 2, function (test) { + casper + .start(lib.buildUrl('quality_gates'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/create', 'create.json', { data: { name: 'New Name' } }); + lib.mockRequestFromFile('/api/qualitygates/show?id=6', 'show-created.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.quality-gates-results .list-group-item'); + }) + + .then(function () { + casper.click('#quality-gate-add'); + casper.waitUntilVisible('#quality-gate-edit-name'); + }) + + .then(function () { + casper.evaluate(function () { + jQuery('#quality-gate-edit-name').val('New Name'); + }); + casper.click('.modal-foot button'); + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertSelectorContains('.search-navigator-header-component', 'New Name'); + test.assertSelectorContains('.quality-gates-results .list-group-item.active', 'New Name'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Delete'), 2, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/5'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=5', 'show-another.json'); + lib.mockRequest('/api/qualitygates/destroy', '{}', { data: { id: '5' } }); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertElementCount('.quality-gates-results .list-group-item', 3); + casper.click('#quality-gate-delete'); + casper.waitForSelector('button[data-confirm="yes"]'); + }) + + .then(function () { + casper.click('button[data-confirm="yes"]'); + casper.waitWhileSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertElementCount('.quality-gates-results .list-group-item', 2); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Add Condition'), 6, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/5'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=5', 'show-another.json'); + lib.mockRequestFromFile('/api/qualitygates/create_condition', 'create-condition.json', + { data: { metric: 'complexity', op: 'GT', period: '1', warning: '3', error: '4' } }); }) .then(function () { casper.evaluate(function () { require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.search-navigator-header-component'); + }) + + .then(function () { + test.assertElementCount('.quality-gate-conditions [name="error"]', 0); + + casper.evaluate(function () { + jQuery('#quality-gate-new-condition-metric').val('complexity').change(); + }); + test.assertElementCount('.quality-gate-conditions [name="error"]', 1); + }) + + .then(function () { + casper.click('.cancel-add-condition'); + casper.waitWhileSelector('.cancel-add-condition'); + }) + + .then(function () { + test.assertElementCount('.quality-gate-conditions [name="error"]', 0); + + casper.evaluate(function () { + jQuery('#quality-gate-new-condition-metric').val('complexity').change(); }); + test.assertElementCount('.quality-gate-conditions [name="error"]', 1); + + casper.evaluate(function () { + jQuery('[name="period"]').val('1'); + jQuery('[name="operator"]').val('GT'); + jQuery('[name="warning"]').val('3'); + jQuery('[name="error"]').val('4'); + }); + casper.click('.add-condition'); + casper.waitForSelector('.update-condition'); + }) + + .then(function () { + test.assertExists('.update-condition[disabled]'); + test.assertExists('.delete-condition'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Update Condition'), 3, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/1'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + lib.mockRequestFromFile('/api/qualitygates/update_condition', 'update-condition.json', + { data: { id: '1', warning: '173' } }); }) .then(function () { - casper.waitForSelector('.active', function () { - test.assertElementCount('.active', 1); - test.assertSelectorHasText('.search-navigator-side .active', 'Default Gate'); + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); }); }) .then(function () { - casper.waitForSelector('.search-navigator-workspace-header', function () { - test.assertSelectorHasText('.search-navigator-workspace-header', 'Default Gate'); + casper.waitForSelector('.update-condition'); + }) + + .then(function () { + test.assertExists('.quality-gate-conditions tr:first-child .update-condition[disabled]'); + casper.evaluate(function () { + jQuery('.quality-gate-conditions tr:first-child [name="warning"]').val('173').change(); }); + test.assertDoesntExist('.quality-gate-conditions tr:first-child .update-condition[disabled]'); + casper.click('.quality-gate-conditions tr:first-child .update-condition'); + casper.waitWhileSelector('.quality-gate-conditions tr:first-child .update-condition:not([disabled])'); + }) + + .then(function () { + test.assertExists('.quality-gate-conditions tr:first-child .update-condition[disabled]'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Should Delete Condition'), 2, function (test) { + casper + .start(lib.buildUrl('quality_gates#show/1'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/qualitygates/app', 'app.json'); + lib.mockRequestFromFile('/api/qualitygates/list', 'list.json'); + lib.mockRequestFromFile('/api/qualitygates/show?id=1', 'show.json'); + lib.mockRequest('/api/qualitygates/delete_condition', '{}', { data: { id: '1' } }); }) .then(function () { - casper.waitForSelector('table.quality-gate-conditions tbody tr:nth-child(9)', function () { - test.assertElementCount('table.quality-gate-conditions tbody tr', 9); + casper.evaluate(function () { + require(['apps/quality-gate/app']); + jQuery.ajaxSetup({ dataType: 'json' }); }); }) + .then(function () { + casper.waitForSelector('.delete-condition'); + }) + + .then(function () { + test.assertElementCount('.delete-condition', 8); + + casper.click('.quality-gate-conditions tr:first-child .delete-condition'); + casper.waitForSelector('button[data-confirm="yes"]'); + }) + + .then(function () { + casper.click('button[data-confirm="yes"]'); + lib.waitForElementCount('.delete-condition', 7); + }) + + .then(function () { + test.assert(true); + }) + .then(function () { lib.sendCoverage(); }) diff --git a/server/sonar-web/src/test/json/quality-gates-spec/app-anonymous.json b/server/sonar-web/src/test/json/quality-gates-spec/app-anonymous.json new file mode 100644 index 00000000000..ddbb887c940 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/app-anonymous.json @@ -0,0 +1,835 @@ +{ + "edit": false, + "periods": [ + { + "key": 1, + "text": "since previous analysis" + }, + { + "key": 2, + "text": "over 30 days" + }, + { + "key": 3, + "text": "since previous version" + }, + { + "key": 4, + "text": "over period 4 - defined at project level" + }, + { + "key": 5, + "text": "over period 5 - defined at project level" + } + ], + "metrics": [ + { + "id": 1, + "key": "lines", + "name": "Lines", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 101, + "key": "new_critical_violations", + "name": "New Critical issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 102, + "key": "new_major_violations", + "name": "New Major issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 103, + "key": "new_minor_violations", + "name": "New Minor issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 104, + "key": "new_info_violations", + "name": "New Info issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 105, + "key": "false_positive_issues", + "name": "False positive issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 106, + "key": "open_issues", + "name": "Open issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 12, + "key": "statements", + "name": "Statements", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 19, + "key": "commented_out_code_lines", + "name": "Commented-out LOC", + "type": "INT", + "domain": "Documentation", + "hidden": true + }, + { + "id": 20, + "key": "complexity", + "name": "Complexity", + "type": "INT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 135, + "key": "sqale_debt_ratio", + "name": "SQALE Technical Debt Ratio", + "type": "PERCENT", + "domain": "Technical Debt", + "hidden": false + }, + { + "id": 66, + "key": "it_branch_coverage", + "name": "IT condition coverage", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 67, + "key": "new_it_branch_coverage", + "name": "Condition coverage by IT on new code", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 70, + "key": "overall_coverage", + "name": "Overall coverage", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 71, + "key": "new_overall_coverage", + "name": "Overall coverage on new code", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 72, + "key": "overall_lines_to_cover", + "name": "Overall lines to cover", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": true + }, + { + "id": 90, + "key": "duplicated_lines_density", + "name": "Duplicated lines (%)", + "type": "PERCENT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 131, + "key": "sqale_index", + "name": "Technical Debt", + "type": "WORK_DUR", + "domain": "Technical Debt", + "hidden": false + }, + { + "id": 132, + "key": "new_technical_debt", + "name": "Technical Debt on new code", + "type": "WORK_DUR", + "domain": "Technical Debt", + "hidden": false + }, + { + "id": 144, + "key": "burned_budget", + "name": "Burned budget", + "type": "FLOAT", + "domain": "Management", + "hidden": false + }, + { + "id": 145, + "key": "business_value", + "name": "Business value", + "type": "FLOAT", + "domain": "Management", + "hidden": false + }, + { + "id": 146, + "key": "team_size", + "name": "Team size", + "type": "INT", + "domain": "Management", + "hidden": false + }, + { + "id": 141, + "key": "profile_version", + "name": "Profile version", + "type": "INT", + "domain": "General", + "hidden": true + }, + { + "id": 143, + "key": "days_since_last_commit", + "name": "Days since last commit", + "type": "INT", + "domain": "SCM", + "hidden": false + }, + { + "id": 41, + "key": "new_uncovered_lines", + "name": "Uncovered lines on new code", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 42, + "key": "line_coverage", + "name": "Line coverage", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 43, + "key": "new_line_coverage", + "name": "Line coverage on new code", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 45, + "key": "conditions_to_cover", + "name": "Branches to cover", + "type": "INT", + "domain": "Tests", + "hidden": true + }, + { + "id": 46, + "key": "new_conditions_to_cover", + "name": "Branches to cover on new code", + "type": "INT", + "domain": "Tests", + "hidden": true + }, + { + "id": 47, + "key": "uncovered_conditions", + "name": "Uncovered branches", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 48, + "key": "new_uncovered_conditions", + "name": "Uncovered branches on new code", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 49, + "key": "branch_coverage", + "name": "Condition coverage", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 50, + "key": "new_branch_coverage", + "name": "Condition coverage on new code", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 53, + "key": "it_coverage", + "name": "IT coverage", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 54, + "key": "new_it_coverage", + "name": "Coverage by IT on new code", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 55, + "key": "it_lines_to_cover", + "name": "IT lines to cover", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": true + }, + { + "id": 56, + "key": "new_it_lines_to_cover", + "name": "Lines to cover by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 57, + "key": "it_uncovered_lines", + "name": "IT uncovered lines", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 58, + "key": "new_it_uncovered_lines", + "name": "Uncovered lines by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 59, + "key": "it_line_coverage", + "name": "IT line coverage", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 60, + "key": "new_it_line_coverage", + "name": "Line coverage by IT on new code", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 73, + "key": "new_overall_lines_to_cover", + "name": "Overall lines to cover on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 74, + "key": "overall_uncovered_lines", + "name": "Overall uncovered lines", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 75, + "key": "new_overall_uncovered_lines", + "name": "Overall uncovered lines on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 76, + "key": "overall_line_coverage", + "name": "Overall line coverage", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 77, + "key": "new_overall_line_coverage", + "name": "Overall line coverage on new code", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 2, + "key": "generated_lines", + "name": "Generated Lines", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 3, + "key": "ncloc", + "name": "Lines of code", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 5, + "key": "generated_ncloc", + "name": "Generated lines of code", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 6, + "key": "classes", + "name": "Classes", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 7, + "key": "files", + "name": "Files", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 8, + "key": "directories", + "name": "Directories", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 9, + "key": "packages", + "name": "Packages", + "type": "INT", + "domain": "Size", + "hidden": true + }, + { + "id": 10, + "key": "functions", + "name": "Functions", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 79, + "key": "overall_conditions_to_cover", + "name": "Overall branches to cover", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": true + }, + { + "id": 80, + "key": "new_overall_conditions_to_cover", + "name": "Overall branches to cover on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": true + }, + { + "id": 81, + "key": "overall_uncovered_conditions", + "name": "Overall uncovered branches", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 82, + "key": "new_overall_uncovered_conditions", + "name": "Overall uncovered branches on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 83, + "key": "overall_branch_coverage", + "name": "Overall condition coverage", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 84, + "key": "new_overall_branch_coverage", + "name": "Overall condition coverage on new code", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 87, + "key": "duplicated_lines", + "name": "Duplicated lines", + "type": "INT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 88, + "key": "duplicated_blocks", + "name": "Duplicated blocks", + "type": "INT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 89, + "key": "duplicated_files", + "name": "Duplicated files", + "type": "INT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 25, + "key": "function_complexity", + "name": "Complexity /function", + "type": "FLOAT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 29, + "key": "tests", + "name": "Unit tests", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 30, + "key": "test_execution_time", + "name": "Unit tests duration", + "type": "MILLISEC", + "domain": "Tests", + "hidden": false + }, + { + "id": 31, + "key": "test_errors", + "name": "Unit test errors", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 32, + "key": "skipped_tests", + "name": "Skipped unit tests", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 33, + "key": "test_failures", + "name": "Unit test failures", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 34, + "key": "test_success_density", + "name": "Unit test success (%)", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 36, + "key": "coverage", + "name": "Coverage", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 38, + "key": "lines_to_cover", + "name": "Lines to cover", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 134, + "key": "development_cost", + "name": "SQALE Development Cost", + "type": "STRING", + "domain": "Technical Debt", + "hidden": true + }, + { + "id": 37, + "key": "new_coverage", + "name": "Coverage on new code", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 107, + "key": "reopened_issues", + "name": "Reopened issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 108, + "key": "confirmed_issues", + "name": "Confirmed issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 13, + "key": "public_api", + "name": "Public API", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 14, + "key": "projects", + "name": "Projects", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 15, + "key": "comment_lines", + "name": "Comment lines", + "type": "INT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 16, + "key": "comment_lines_density", + "name": "Comments (%)", + "type": "PERCENT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 17, + "key": "public_documented_api_density", + "name": "Public documented API (%)", + "type": "PERCENT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 18, + "key": "public_undocumented_api", + "name": "Public undocumented API", + "type": "INT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 21, + "key": "file_complexity", + "name": "Complexity /file", + "type": "FLOAT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 22, + "key": "complexity_in_classes", + "name": "Complexity in classes", + "type": "INT", + "domain": "Complexity", + "hidden": true + }, + { + "id": 23, + "key": "class_complexity", + "name": "Complexity /class", + "type": "FLOAT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 24, + "key": "complexity_in_functions", + "name": "Complexity in functions", + "type": "INT", + "domain": "Complexity", + "hidden": true + }, + { + "id": 39, + "key": "new_lines_to_cover", + "name": "Lines to cover on new code", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 62, + "key": "it_conditions_to_cover", + "name": "IT branches to cover", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": true + }, + { + "id": 40, + "key": "uncovered_lines", + "name": "Uncovered lines", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 11, + "key": "accessors", + "name": "Accessors", + "type": "INT", + "domain": "Size", + "hidden": true + }, + { + "id": 63, + "key": "new_it_conditions_to_cover", + "name": "Branches to cover by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": true + }, + { + "id": 64, + "key": "it_uncovered_conditions", + "name": "IT uncovered branches", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 65, + "key": "new_it_uncovered_conditions", + "name": "Uncovered branches by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 93, + "key": "violations", + "name": "Issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 94, + "key": "blocker_violations", + "name": "Blocker issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 95, + "key": "critical_violations", + "name": "Critical issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 96, + "key": "major_violations", + "name": "Major issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 97, + "key": "minor_violations", + "name": "Minor issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 98, + "key": "info_violations", + "name": "Info issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 99, + "key": "new_violations", + "name": "New issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 100, + "key": "new_blocker_violations", + "name": "New Blocker issues", + "type": "INT", + "domain": "Issues", + "hidden": false + } + ] +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/app.json b/server/sonar-web/src/test/json/quality-gates-spec/app.json index 6a38a3ed8b5..4908fd2b2fc 100644 --- a/server/sonar-web/src/test/json/quality-gates-spec/app.json +++ b/server/sonar-web/src/test/json/quality-gates-spec/app.json @@ -1,5 +1,5 @@ { - "edit": false, + "edit": true, "periods": [ { "key": 1, @@ -7,7 +7,7 @@ }, { "key": 2, - "text": "over 365 days" + "text": "over 30 days" }, { "key": 3, @@ -23,77 +23,813 @@ } ], "metrics": [ - { - "id": 62, - "key": "blocker_violations", - "name": "Blocker issues", - "type": "INT", - "domain": "Issues", - "hidden": false - }, - { - "id": 37, - "key": "new_coverage", - "name": "Coverage on new code", - "type": "PERCENT", - "domain": "Tests", - "hidden": false - }, - { - "id": 63, - "key": "critical_violations", - "name": "Critical issues", - "type": "INT", - "domain": "Issues", - "hidden": false - }, - { - "id": 154, - "key": "sqale_effort_to_grade_a", - "name": "Effort to rating A", - "type": "WORK_DUR", - "domain": "SQALE", - "hidden": false - }, - { - "id": 218, - "key": "open_issues", - "name": "Open issues", - "type": "INT", - "domain": "Issues", - "hidden": false - }, - { - "id": 219, - "key": "reopened_issues", - "name": "Reopened issues", - "type": "INT", - "domain": "Issues", - "hidden": false - }, - { - "id": 32, - "key": "skipped_tests", - "name": "Skipped unit tests", - "type": "INT", - "domain": "Tests", - "hidden": false - }, - { - "id": 31, - "key": "test_errors", - "name": "Unit test errors", - "type": "INT", - "domain": "Tests", - "hidden": false - }, - { - "id": 33, - "key": "test_failures", - "name": "Unit test failures", - "type": "INT", - "domain": "Tests", - "hidden": false - } + { + "id": 1, + "key": "lines", + "name": "Lines", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 101, + "key": "new_critical_violations", + "name": "New Critical issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 102, + "key": "new_major_violations", + "name": "New Major issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 103, + "key": "new_minor_violations", + "name": "New Minor issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 104, + "key": "new_info_violations", + "name": "New Info issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 105, + "key": "false_positive_issues", + "name": "False positive issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 106, + "key": "open_issues", + "name": "Open issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 12, + "key": "statements", + "name": "Statements", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 19, + "key": "commented_out_code_lines", + "name": "Commented-out LOC", + "type": "INT", + "domain": "Documentation", + "hidden": true + }, + { + "id": 20, + "key": "complexity", + "name": "Complexity", + "type": "INT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 135, + "key": "sqale_debt_ratio", + "name": "SQALE Technical Debt Ratio", + "type": "PERCENT", + "domain": "Technical Debt", + "hidden": false + }, + { + "id": 66, + "key": "it_branch_coverage", + "name": "IT condition coverage", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 67, + "key": "new_it_branch_coverage", + "name": "Condition coverage by IT on new code", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 70, + "key": "overall_coverage", + "name": "Overall coverage", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 71, + "key": "new_overall_coverage", + "name": "Overall coverage on new code", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 72, + "key": "overall_lines_to_cover", + "name": "Overall lines to cover", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": true + }, + { + "id": 90, + "key": "duplicated_lines_density", + "name": "Duplicated lines (%)", + "type": "PERCENT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 131, + "key": "sqale_index", + "name": "Technical Debt", + "type": "WORK_DUR", + "domain": "Technical Debt", + "hidden": false + }, + { + "id": 132, + "key": "new_technical_debt", + "name": "Technical Debt on new code", + "type": "WORK_DUR", + "domain": "Technical Debt", + "hidden": false + }, + { + "id": 144, + "key": "burned_budget", + "name": "Burned budget", + "type": "FLOAT", + "domain": "Management", + "hidden": false + }, + { + "id": 145, + "key": "business_value", + "name": "Business value", + "type": "FLOAT", + "domain": "Management", + "hidden": false + }, + { + "id": 146, + "key": "team_size", + "name": "Team size", + "type": "INT", + "domain": "Management", + "hidden": false + }, + { + "id": 141, + "key": "profile_version", + "name": "Profile version", + "type": "INT", + "domain": "General", + "hidden": true + }, + { + "id": 143, + "key": "days_since_last_commit", + "name": "Days since last commit", + "type": "INT", + "domain": "SCM", + "hidden": false + }, + { + "id": 41, + "key": "new_uncovered_lines", + "name": "Uncovered lines on new code", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 42, + "key": "line_coverage", + "name": "Line coverage", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 43, + "key": "new_line_coverage", + "name": "Line coverage on new code", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 45, + "key": "conditions_to_cover", + "name": "Branches to cover", + "type": "INT", + "domain": "Tests", + "hidden": true + }, + { + "id": 46, + "key": "new_conditions_to_cover", + "name": "Branches to cover on new code", + "type": "INT", + "domain": "Tests", + "hidden": true + }, + { + "id": 47, + "key": "uncovered_conditions", + "name": "Uncovered branches", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 48, + "key": "new_uncovered_conditions", + "name": "Uncovered branches on new code", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 49, + "key": "branch_coverage", + "name": "Condition coverage", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 50, + "key": "new_branch_coverage", + "name": "Condition coverage on new code", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 53, + "key": "it_coverage", + "name": "IT coverage", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 54, + "key": "new_it_coverage", + "name": "Coverage by IT on new code", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 55, + "key": "it_lines_to_cover", + "name": "IT lines to cover", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": true + }, + { + "id": 56, + "key": "new_it_lines_to_cover", + "name": "Lines to cover by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 57, + "key": "it_uncovered_lines", + "name": "IT uncovered lines", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 58, + "key": "new_it_uncovered_lines", + "name": "Uncovered lines by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 59, + "key": "it_line_coverage", + "name": "IT line coverage", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 60, + "key": "new_it_line_coverage", + "name": "Line coverage by IT on new code", + "type": "PERCENT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 73, + "key": "new_overall_lines_to_cover", + "name": "Overall lines to cover on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 74, + "key": "overall_uncovered_lines", + "name": "Overall uncovered lines", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 75, + "key": "new_overall_uncovered_lines", + "name": "Overall uncovered lines on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 76, + "key": "overall_line_coverage", + "name": "Overall line coverage", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 77, + "key": "new_overall_line_coverage", + "name": "Overall line coverage on new code", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 2, + "key": "generated_lines", + "name": "Generated Lines", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 3, + "key": "ncloc", + "name": "Lines of code", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 5, + "key": "generated_ncloc", + "name": "Generated lines of code", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 6, + "key": "classes", + "name": "Classes", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 7, + "key": "files", + "name": "Files", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 8, + "key": "directories", + "name": "Directories", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 9, + "key": "packages", + "name": "Packages", + "type": "INT", + "domain": "Size", + "hidden": true + }, + { + "id": 10, + "key": "functions", + "name": "Functions", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 79, + "key": "overall_conditions_to_cover", + "name": "Overall branches to cover", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": true + }, + { + "id": 80, + "key": "new_overall_conditions_to_cover", + "name": "Overall branches to cover on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": true + }, + { + "id": 81, + "key": "overall_uncovered_conditions", + "name": "Overall uncovered branches", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 82, + "key": "new_overall_uncovered_conditions", + "name": "Overall uncovered branches on new code", + "type": "INT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 83, + "key": "overall_branch_coverage", + "name": "Overall condition coverage", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 84, + "key": "new_overall_branch_coverage", + "name": "Overall condition coverage on new code", + "type": "PERCENT", + "domain": "Tests (Overall)", + "hidden": false + }, + { + "id": 87, + "key": "duplicated_lines", + "name": "Duplicated lines", + "type": "INT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 88, + "key": "duplicated_blocks", + "name": "Duplicated blocks", + "type": "INT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 89, + "key": "duplicated_files", + "name": "Duplicated files", + "type": "INT", + "domain": "Duplication", + "hidden": false + }, + { + "id": 25, + "key": "function_complexity", + "name": "Complexity /function", + "type": "FLOAT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 29, + "key": "tests", + "name": "Unit tests", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 30, + "key": "test_execution_time", + "name": "Unit tests duration", + "type": "MILLISEC", + "domain": "Tests", + "hidden": false + }, + { + "id": 31, + "key": "test_errors", + "name": "Unit test errors", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 32, + "key": "skipped_tests", + "name": "Skipped unit tests", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 33, + "key": "test_failures", + "name": "Unit test failures", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 34, + "key": "test_success_density", + "name": "Unit test success (%)", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 36, + "key": "coverage", + "name": "Coverage", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 38, + "key": "lines_to_cover", + "name": "Lines to cover", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 134, + "key": "development_cost", + "name": "SQALE Development Cost", + "type": "STRING", + "domain": "Technical Debt", + "hidden": true + }, + { + "id": 37, + "key": "new_coverage", + "name": "Coverage on new code", + "type": "PERCENT", + "domain": "Tests", + "hidden": false + }, + { + "id": 107, + "key": "reopened_issues", + "name": "Reopened issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 108, + "key": "confirmed_issues", + "name": "Confirmed issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 13, + "key": "public_api", + "name": "Public API", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 14, + "key": "projects", + "name": "Projects", + "type": "INT", + "domain": "Size", + "hidden": false + }, + { + "id": 15, + "key": "comment_lines", + "name": "Comment lines", + "type": "INT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 16, + "key": "comment_lines_density", + "name": "Comments (%)", + "type": "PERCENT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 17, + "key": "public_documented_api_density", + "name": "Public documented API (%)", + "type": "PERCENT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 18, + "key": "public_undocumented_api", + "name": "Public undocumented API", + "type": "INT", + "domain": "Documentation", + "hidden": false + }, + { + "id": 21, + "key": "file_complexity", + "name": "Complexity /file", + "type": "FLOAT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 22, + "key": "complexity_in_classes", + "name": "Complexity in classes", + "type": "INT", + "domain": "Complexity", + "hidden": true + }, + { + "id": 23, + "key": "class_complexity", + "name": "Complexity /class", + "type": "FLOAT", + "domain": "Complexity", + "hidden": false + }, + { + "id": 24, + "key": "complexity_in_functions", + "name": "Complexity in functions", + "type": "INT", + "domain": "Complexity", + "hidden": true + }, + { + "id": 39, + "key": "new_lines_to_cover", + "name": "Lines to cover on new code", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 62, + "key": "it_conditions_to_cover", + "name": "IT branches to cover", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": true + }, + { + "id": 40, + "key": "uncovered_lines", + "name": "Uncovered lines", + "type": "INT", + "domain": "Tests", + "hidden": false + }, + { + "id": 11, + "key": "accessors", + "name": "Accessors", + "type": "INT", + "domain": "Size", + "hidden": true + }, + { + "id": 63, + "key": "new_it_conditions_to_cover", + "name": "Branches to cover by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": true + }, + { + "id": 64, + "key": "it_uncovered_conditions", + "name": "IT uncovered branches", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 65, + "key": "new_it_uncovered_conditions", + "name": "Uncovered branches by IT on new code", + "type": "INT", + "domain": "Tests (Integration)", + "hidden": false + }, + { + "id": 93, + "key": "violations", + "name": "Issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 94, + "key": "blocker_violations", + "name": "Blocker issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 95, + "key": "critical_violations", + "name": "Critical issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 96, + "key": "major_violations", + "name": "Major issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 97, + "key": "minor_violations", + "name": "Minor issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 98, + "key": "info_violations", + "name": "Info issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 99, + "key": "new_violations", + "name": "New issues", + "type": "INT", + "domain": "Issues", + "hidden": false + }, + { + "id": 100, + "key": "new_blocker_violations", + "name": "New Blocker issues", + "type": "INT", + "domain": "Issues", + "hidden": false + } ] } diff --git a/server/sonar-web/src/test/json/quality-gates-spec/copy.json b/server/sonar-web/src/test/json/quality-gates-spec/copy.json new file mode 100644 index 00000000000..5049f54d958 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/copy.json @@ -0,0 +1,4 @@ +{ + "id": 6, + "name": "New Name" +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/create-condition.json b/server/sonar-web/src/test/json/quality-gates-spec/create-condition.json new file mode 100644 index 00000000000..219e339b799 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/create-condition.json @@ -0,0 +1,8 @@ +{ + "id": 19, + "metric": "complexity", + "op": "GT", + "warning": "1", + "error": "2", + "period": 1 +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/create.json b/server/sonar-web/src/test/json/quality-gates-spec/create.json new file mode 100644 index 00000000000..5049f54d958 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/create.json @@ -0,0 +1,4 @@ +{ + "id": 6, + "name": "New Name" +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/list.json b/server/sonar-web/src/test/json/quality-gates-spec/list.json index 9d7ac911b05..6fcd19d6f28 100644 --- a/server/sonar-web/src/test/json/quality-gates-spec/list.json +++ b/server/sonar-web/src/test/json/quality-gates-spec/list.json @@ -1,8 +1,16 @@ { "qualitygates": [ + { + "id": 5, + "name": "Another Gate" + }, + { + "id": 4, + "name": "Simple Gate" + }, { "id": 1, - "name": "Default Gate" + "name": "SonarQube way" } ], "default": 1 diff --git a/server/sonar-web/src/test/json/quality-gates-spec/rename.json b/server/sonar-web/src/test/json/quality-gates-spec/rename.json new file mode 100644 index 00000000000..e370fa9586e --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/rename.json @@ -0,0 +1,4 @@ +{ + "id": 1, + "name": "New Name" +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/show-another.json b/server/sonar-web/src/test/json/quality-gates-spec/show-another.json new file mode 100644 index 00000000000..dbb615b2295 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/show-another.json @@ -0,0 +1,4 @@ +{ + "id": 5, + "name": "Another Gate" +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/show-created.json b/server/sonar-web/src/test/json/quality-gates-spec/show-created.json new file mode 100644 index 00000000000..5049f54d958 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/show-created.json @@ -0,0 +1,4 @@ +{ + "id": 6, + "name": "New Name" +} diff --git a/server/sonar-web/src/test/json/quality-gates-spec/show.json b/server/sonar-web/src/test/json/quality-gates-spec/show.json index bc36acb897e..7125875b1b3 100644 --- a/server/sonar-web/src/test/json/quality-gates-spec/show.json +++ b/server/sonar-web/src/test/json/quality-gates-spec/show.json @@ -1,70 +1,58 @@ { "id": 1, - "name": "Default Gate", + "name": "SonarQube way", "conditions": [ - { - "id": 1, - "metric": "blocker_violations", - "op": "GT", - "warning": "", - "error": "0" - }, - { - "id": 2, - "metric": "new_coverage", - "op": "LT", - "warning": "", - "error": "80", - "period": 3 - }, - { - "id": 3, - "metric": "critical_violations", - "op": "GT", - "warning": "", - "error": "0" - }, - { - "id": 4, - "metric": "sqale_effort_to_grade_a", - "op": "GT", - "warning": "", - "error": "0" - }, - { - "id": 5, - "metric": "open_issues", - "op": "GT", - "warning": "0", - "error": "" - }, - { - "id": 6, - "metric": "reopened_issues", - "op": "GT", - "warning": "0", - "error": "" - }, - { - "id": 7, - "metric": "skipped_tests", - "op": "GT", - "warning": "0", - "error": "" - }, - { - "id": 8, - "metric": "test_errors", - "op": "GT", - "warning": "", - "error": "0" - }, - { - "id": 9, - "metric": "test_failures", - "op": "GT", - "warning": "", - "error": "0" - } + { + "id": 1, + "metric": "blocker_violations", + "op": "GT", + "warning": "", + "error": "0" + }, + { + "id": 3, + "metric": "test_errors", + "op": "GT", + "error": "0" + }, + { + "id": 4, + "metric": "test_failures", + "op": "GT", + "error": "0" + }, + { + "id": 5, + "metric": "new_coverage", + "op": "LT", + "warning": "", + "error": "80", + "period": 3 + }, + { + "id": 6, + "metric": "open_issues", + "op": "GT", + "warning": "0" + }, + { + "id": 7, + "metric": "reopened_issues", + "op": "GT", + "warning": "0" + }, + { + "id": 8, + "metric": "skipped_tests", + "op": "GT", + "warning": "0" + }, + { + "id": 9, + "metric": "sqale_index", + "op": "LT", + "warning": "3360", + "error": "4020" + } ] } diff --git a/server/sonar-web/src/test/json/quality-gates-spec/update-condition.json b/server/sonar-web/src/test/json/quality-gates-spec/update-condition.json new file mode 100644 index 00000000000..af2c053ff94 --- /dev/null +++ b/server/sonar-web/src/test/json/quality-gates-spec/update-condition.json @@ -0,0 +1,7 @@ +{ + "id": 1, + "metric": "blocker_violations", + "op": "GT", + "warning": "173", + "error": "0" +} -- 2.39.5