aboutsummaryrefslogtreecommitdiffstats
path: root/tests/build.gradle
blob: 666130b7e6f23130dcbaae502ffacf1a8ca3fd80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
ext {
  jettyVersion = '9.3.11.v20160721'
  bytemanVersion = '3.0.10'
}

configurations {
  sqZip
  includeInTestResources
}

def pluginsForITs = [
    ':plugins:sonar-xoo-plugin',
    ':tests:plugins:access-secured-props-plugin',
    ':tests:plugins:base-auth-plugin',
    ':tests:plugins:batch-plugin',
    ':tests:plugins:extension-lifecycle-plugin',
    ':tests:plugins:fake-billing-plugin',
    ':tests:plugins:fake-governance-plugin',
    ':tests:plugins:foo-plugin-v1',
    ':tests:plugins:foo-plugin-v2',
    ':tests:plugins:global-property-change-plugin',
    ':tests:plugins:issue-filter-plugin',
    ':tests:plugins:l10n-fr-pack',
    ':tests:plugins:license-plugin',
    ':tests:plugins:oauth2-auth-plugin',
    ':tests:plugins:project-builder-plugin',
    ':tests:plugins:property-relocation-plugin',
    ':tests:plugins:property-sets-plugin',
    ':tests:plugins:security-plugin',
    ':tests:plugins:server-plugin',
    ':tests:plugins:settings-encryption-plugin',
    ':tests:plugins:settings-plugin',
    ':tests:plugins:sonar-fake-plugin',
    ':tests:plugins:sonar-subcategories-plugin',
    ':tests:plugins:ui-extensions-plugin',
    ':tests:plugins:posttask-plugin',
    ':tests:plugins:wait-at-platform-level4-plugin',
    ':tests:plugins:ws-plugin',
    ':tests:plugins:backdating-plugin-v1',
    ':tests:plugins:backdating-plugin-v2',
    ':tests:plugins:backdating-customplugin'
]

dependencies {
  // please keep list ordered

  // required version 23.0 for selenide
  testCompile 'com.google.guava:guava:23.0'
  testCompile 'com.googlecode.json-simple:json-simple'
  testCompile 'com.microsoft.sqlserver:mssql-jdbc'
  testCompile 'com.oracle.jdbc:ojdbc8'
  testCompile 'com.squareup.okhttp3:mockwebserver'
  testCompile 'junit:junit'
  testCompile 'mysql:mysql-connector-java'
  testCompile 'org.assertj:assertj-core'
  testCompile 'org.assertj:assertj-guava'
  testCompile 'org.eclipse.jetty:jetty-proxy'
  testCompile 'org.eclipse.jetty:jetty-server'
  testCompile 'org.eclipse.jetty:jetty-servlet'
  testCompile "org.jboss.byteman:byteman-submit:${bytemanVersion}"
  testCompile 'org.postgresql:postgresql'
  testCompile 'org.skyscreamer:jsonassert:1.2.0'
  testCompile 'org.sonarsource.orchestrator:sonar-orchestrator'
  testCompile 'org.subethamail:subethasmtp'
  testCompile project(':server:sonar-qa-util')
  testCompile project(':sonar-ws')

  includeInTestResources "org.jboss.byteman:byteman:${bytemanVersion}"
}

sonarqube {
  skipProject = true
}

//UT are excluding in order for ITs to only run when needed
test{
  exclude '*'
}

task integrationTest(type: Test) {
  description = 'Runs integration tests'

  for (plugin in pluginsForITs) {
    dependsOn project(plugin).assemble
  }

  jacoco.enabled = false

  systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl')
  systemProperty 'orchestrator.artifactory.apiKey', System.getProperty('orchestrator.artifactory.apiKey')
  systemProperty 'orchestrator.artifactory.repositories', System.getProperty('orchestrator.artifactory.repositories')
  systemProperty 'sonar.runtimeVersion', System.getProperty('sonar.runtimeVersion')

  def category = System.getProperty('category')
  filter {
    switch (category) {
      case 'Lite':
        includeTestsMatching 'org.sonarqube.tests.lite.*Suite'
        break
      case 'Category1':
        includeTestsMatching 'org.sonarqube.tests.Category1Suite'
        includeTestsMatching 'org.sonarqube.tests.authorization.*Suite'
        includeTestsMatching 'org.sonarqube.tests.measure.*Suite'
        includeTestsMatching 'org.sonarqube.tests.qualityGate.*Suite'
        includeTestsMatching 'org.sonarqube.tests.settings.*Suite'
        includeTestsMatching 'org.sonarqube.tests.source.*Suite'
        break
      case 'Category2':
        includeTestsMatching 'org.sonarqube.tests.issue.*Suite'
        includeTestsMatching 'org.sonarqube.tests.test.*Suite'
        includeTestsMatching 'org.sonarqube.tests.qualityModel.*Suite'
        break
      case 'Category3':
        includeTestsMatching 'org.sonarqube.tests.Category3Suite'
        includeTestsMatching 'org.sonarqube.tests.component.*Suite'
        includeTestsMatching 'org.sonarqube.tests.project.*Suite'
        break
      case 'Category4':
        includeTestsMatching 'org.sonarqube.tests.Category4Suite'
        includeTestsMatching 'org.sonarqube.tests.duplication.*Suite'
        includeTestsMatching 'org.sonarqube.tests.user.*Suite'
        includeTestsMatching 'org.sonarqube.tests.webhook.*Suite'
        break
      case 'Category5':
        includeTestsMatching 'org.sonarqube.tests.Category5Suite'
        break
      case 'Category6':
        includeTestsMatching 'org.sonarqube.tests.Category6Suite'
        includeTestsMatching 'org.sonarqube.tests.organization.*Suite'
        break
      case 'Plugins':
        includeTestsMatching 'org.sonarqube.tests.plugins.PluginsSuite'
        break
      case 'Upgrade':
        includeTestsMatching 'org.sonarqube.tests.upgrade.UpgradeSuite'
        break
      case 'ServerPerformance':
        includeTestsMatching 'org.sonarqube.tests.performance.server.ServerPerformanceSuite'
        break
    }
    testLogging {
      exceptionFormat 'full' // log the full stack trace (default is the 1st line of the stack trace)
      events "skipped", "failed" // verbose log for failed and skipped tests (by default the name of the tests are not logged)
    }
  }
}

processTestResources() {
  into('/') {
    from configurations.includeInTestResources
    // TODO cache not invalidated when pattern changes?
    rename '(.*)-' + bytemanVersion + '.jar', '$1.jar'
  }
}