Advertisement
fedorm

Untitled

Apr 2nd, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.50 KB | None | 0 0
  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. jcenter()
  5. }
  6.  
  7. dependencies {
  8. classpath "org.codehaus.gpars:gpars:1.2.1"
  9. classpath "io.qameta.allure:allure-gradle:2.3"
  10.  
  11. }
  12. }
  13.  
  14. plugins {
  15. id 'io.qameta.allure' version "2.5"
  16. }
  17.  
  18. allure {
  19. version = '2.2.1'
  20. autoconfigure = true
  21. aspectjweaver = true
  22. }
  23. apply from: 'environment.gradle'
  24. apply plugin: 'application'
  25. apply plugin: 'java'
  26. apply plugin: 'idea'
  27.  
  28. import groovyx.gpars.GParsPool
  29.  
  30. version = '1.0'
  31. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  32.  
  33. sourceCompatibility = 1.8
  34. targetCompatibility = 1.8
  35.  
  36. mainClassName = 'ru.crystals.settester.SetTester'
  37.  
  38. def suitesPath = "build/suites/"
  39. def testSuite = hasProperty('test_suite') ? test_suite : 'suite_robot.xml'
  40. def testGroup = hasProperty('test_group') ? test_group : ''
  41.  
  42. def htmlCucumberReport = hasProperty('cucumber_html') ? cucumber_html.toBoolean() : true
  43. def junitCucumberReport = hasProperty('cucumber_junit') ? cucumber_junit.toBoolean() : true
  44. def jsonCucumberReport = hasProperty('cucumber_json') ? cucumber_json.toBoolean() : true
  45. def cucumberTags = hasProperty('cucumber_tags') ? cucumber_tags : ''
  46. def inversionTags = []
  47.  
  48. repositories {
  49. // Репозиторий SetMachine:
  50. maven { url "https://artifactory.setmachine.ru:8443/repository/sm-public/" }
  51. maven { url "https://artifactory.setmachine.ru:8443/repository/set10-api-public" }
  52.  
  53. maven {
  54. url 'http://artifactory.crystals.ru:8081/artifactory/remote-repos'
  55. credentials { username 'crystal'; password 'pdF7WUzBazTV' }
  56. }
  57. maven {
  58. url 'http://dl.bintray.com/epam/reportportal'
  59. }
  60. mavenCentral()
  61. jcenter()
  62. }
  63.  
  64.  
  65.  
  66. configurations {
  67. cucumberRuntime {
  68. extendsFrom testRuntime
  69. }
  70. }
  71.  
  72. def defaultEncoding = 'UTF-8'
  73.  
  74. dependencies {
  75. loadLibs()
  76.  
  77. compile server_libs.blazeds
  78. compile server_libs.jcifs
  79. compile server_libs.jee
  80. compile server_libs.guava
  81.  
  82. compile libs.hibernate
  83. compile libs.jdbc
  84. compile libs.junit
  85.  
  86. compile project(':SetRetail10_Cash_OSGi:OSGiDataStruct')
  87. compile project(':SetRetail10_Cash:modules:CashDS')
  88. compile project(':SetRetail10_Commons:DataStructsModule')
  89. compile project(':SetRetail10_Commons:goods-catalog-schema')
  90. compile project(':SetRetail10_Commons:SET-Topology-API')
  91. compile project(':SetRetail10_Commons:SET-Cards-Coupons')
  92. compile project(':SetRetail10_Commons:SET-Cards-PresentCards')
  93. compile project(':SetRetail10_Commons:SET-Report-API')
  94. compile project(':SetRetail10_Commons:SET-OperDay-API')
  95. compile project(':SetRetail10_Commons:PaymentsBankCardEntity')
  96. compile project(':SetRetail10_Commons:PaymentsBonusCardEntity')
  97. compile project(':SetRetail10_Commons:PaymentsGiftCardEntity')
  98. compile project(':SetRetail10_Commons:Loyal:SET-LoyalStructures')
  99. compile project(':SetRetail10_Commons:SET-Report')
  100. compile project(':SetRetail10_Commons:SET-Scales-Products-Exporter-API')
  101. compile project(':SetRetail10_Server:OperDay:SET-OperDay')
  102. compile project(':SetRetail10_Server:OperDay:SET-OperDay-MainCash')
  103. compile project(':SetRetail10_Server:RetailX:SET-Printers')
  104. compile project(':SetRetail10_Server:RetailX:SET-Producer')
  105. compile project(':SetRetail10_Server:RetailX:SET-Products')
  106. compile project(':SetRetail10_Server:RetailX:SET-ProductTypeManager')
  107. compile project(':SetRetail10_Server:RetailX:ServerDS')
  108. compile project(':SetRetail10_Server:Cards:Cards-SET-Cards-Coupons')
  109. compile project(':SetRetail10_Server:Cards:SET-Cards-PresentCards-DS')
  110. compile project(':SetRetail10_Server:Discounts:SET-Discounts')
  111. compile project(':SetRetail10_Server:RetailX:SET-Scales-Tech')
  112. compile project(':SetRetail10_Server:RetailX:SET-Scales-Tech:set-scales-tech-ejb')
  113. compile project(':SetRetail10_Server:Cards:SET-Cards-Coupons')
  114. compile project(':SetRetail10_Server:RetailX:SET-Scales-Products-Exporter')
  115. compile project(':SetRetail10_Server:Discounts:FLMS-Solution:FLMS-DiscountProcessing')
  116. compile project(':SetRetail10_Utils:CrystalAMF')
  117. compile project(':SetRetail10_Utils:ServerHttpClient')
  118. compile project(':SetRetail10_Commons:PersistenceUnits')
  119. compile project(':SetRetail10_Cash:modules:StockBalance1C')
  120. compile project(':SetRetail10_Server:RetailX:SET-ExternalSystems')
  121. compile project(':ExternalPaymentPlugin')
  122. compile project(':ExternalLoyaltyPlugin')
  123. compile project(':ExternalCardPlugin')
  124.  
  125. compile 'org.apache.commons:commons-lang3:3.0'
  126. compile 'com.xebialabs.overthere:overthere:4.4.1'
  127. compile 'org.seleniumhq.selenium:selenium-java:2.53.0'
  128. compile 'org.springframework:spring:2.5.6'
  129. compile 'com.itextpdf:itextpdf:5.5.6'
  130. compile 'org.apache.velocity:velocity:1.7'
  131. compile 'com.google.inject:guice:4.0-beta5'
  132. compile 'org.jdom:jdom:2.0.2'
  133. compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.2'
  134. compile 'io.rest-assured:rest-assured:3.0.5'
  135. compile 'info.cukes:cucumber-java:1.2.4'
  136. compile 'com.lowagie:itext:2.1.7'
  137. compile 'org.testng:testng:6.9.10'
  138. compile 'org.apache.poi:poi:3.16'
  139. compile 'org.apache.poi:poi-ooxml:3.16'
  140. compile 'ru.yandex.qatools.ashot:ashot:1.5.4'
  141. compile 'com.epam.reportportal:agent-java-testng:3.0.6'
  142. compile 'com.epam.reportportal:logger-java-logback:3.0.0'
  143. compile 'com.epam.reportportal:logger-java-log4j:3.0.2'
  144. compile 'com.epam.reportportal:agent-java-cucumber:3.0.1'
  145. testCompile("org.uncommons:reportng:1.1.4") { exclude group: "org.testng", module: "testng" }
  146. testCompile 'info.cukes:cucumber-testng:1.2.4'
  147. testCompile "com.github.tomakehurst:wiremock:2.6.0"
  148. compileOnly 'org.projectlombok:lombok:1.16.18'
  149. testCompile group: 'com.shazam', name: 'shazamcrest', version: '0.11'
  150. }
  151.  
  152. subprojects {
  153. repositories {
  154. // Репозитории SetMachine - там нам позволили публиковать наши артефакты:
  155. maven {
  156. url "https://artifactory.setmachine.ru:8443/repository/set10-api-public"
  157. }
  158.  
  159. maven {
  160. url 'http://artifactory.crystals.ru:8081/artifactory/remote-repos'
  161. credentials { username 'crystal'; password 'pdF7WUzBazTV' }
  162. }
  163.  
  164. // Репозиторий SetMachine:
  165. maven { url "https://artifactory.setmachine.ru:8443/repository/sm-public/" }
  166. mavenCentral()
  167. }
  168.  
  169. apply plugin: 'java'
  170.  
  171. //подключение конфигуратора проектов
  172. ext.BRANCH_ROOT_PATH = new File(rootProject.projectDir.getPath() + '/../../..').getAbsolutePath()
  173. apply(from: relativePath(ext.BRANCH_ROOT_PATH + '/proj_configurator.gradle'));
  174.  
  175. // compiler properties
  176. compileJava {
  177. options.encoding = defaultEncoding
  178. options.debug = true
  179. }
  180. compileTestJava {
  181. options.encoding = defaultEncoding
  182. options.debug = true
  183. }
  184.  
  185. sourceCompatibility = 1.8
  186. targetCompatibility = 1.8
  187.  
  188. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  189.  
  190. test.enabled = false
  191.  
  192. dependencies {
  193. testCompile libs.junit
  194. compile server_libs.guava
  195. compile server_libs.blazeds
  196. compile 'backport-util-concurrent:backport-util-concurrent:3.1'
  197. }
  198. }
  199.  
  200. //подключение списка библиотек
  201. def loadLibs() {
  202. ext.BRANCH_ROOT_PATH = new File(rootProject.projectDir.getPath() + '/../../..').getAbsolutePath()
  203. project.apply(from: relativePath(ext.BRANCH_ROOT_PATH + '/SetRetail10_Cash/lib/libs.gradle'))
  204. project.apply(from: relativePath(ext.BRANCH_ROOT_PATH + '/SetRetail10_Server/server_libs.gradle'))
  205. project.apply(from: relativePath(BRANCH_ROOT_PATH + '/SetRetail10_Server/loyalty_libs.gradle'))
  206. }
  207.  
  208. task copyToLib(type: Copy) {
  209. into "$buildDir/libs/lib"
  210. from configurations.runtime
  211. }
  212.  
  213. task createJar(type: Jar) {
  214. dependsOn copyToLib
  215. from sourceSets.test.output
  216. from sourceSets.main.output
  217. manifest { attributes "Main-Class": "$mainClassName" }
  218. }
  219.  
  220. task copySuites(type: Copy) {
  221. from fileTree('src/test/resources/suites').files
  222. from 'src/test/resources/'
  223. include '*.xml'
  224. into 'build/suites'
  225. }
  226.  
  227. task copyExternalPlugins(dependsOn: project(':ExternalPaymentPlugin').tasks.jar, type: Copy) {
  228. from(project(':ExternalPaymentPlugin').buildDir.path + "/libs") {
  229. include('*.jar')
  230. }
  231. into 'src/test/resources/plugins/payments/'
  232. }
  233.  
  234. project.tasks.compileJava.dependsOn copyExternalPlugins
  235.  
  236. test {
  237. dependsOn copySuites
  238. systemProperties System.getProperties()
  239. testLogging.showStandardStreams = true
  240. useTestNG()
  241. options {
  242. useDefaultListeners = false
  243. //listeners << 'org.uncommons.reportng.HTMLReporter'
  244. listeners << 'org.uncommons.reportng.JUnitXMLReporter'
  245. testSuite.tokenize(',').collect {
  246. it = suitesPath + it
  247. }.each { suites it }
  248. includeGroups "${testGroup}"
  249. }
  250. }
  251.  
  252. task pathingJar(type: Jar) {
  253. classifier 'pathing'
  254. doFirst {
  255. manifest {
  256. attributes "Class-Path": configurations.cucumberRuntime.files.collect {
  257. it.toURL().toString().replaceFirst(/file:\/+/, '/')
  258. }.join(' ')
  259. }
  260. }
  261. dependsOn configurations.runtime
  262. }
  263.  
  264. task reportportal() {
  265. Properties props = new Properties()
  266. File propsFile = project.file('src/test/resources/reportportal.properties')
  267. props.load(propsFile.newDataInputStream())
  268. if (System.getProperty("rp.enable") == null) {
  269. System.setProperty("rp.enable", props.getProperty("rp.enable"))
  270. }
  271. System.setProperty("rp.endpoint", props.getProperty("rp.endpoint"))
  272. System.setProperty("rp.uuid", props.getProperty("rp.uuid"))
  273. if (System.getProperty("rp.launch") == null) {
  274. System.setProperty("rp.launch", props.getProperty("rp.launch"))
  275. }
  276. System.setProperty("rp.project", props.getProperty("rp.project"))
  277. }
  278.  
  279. task cucumberInParallel() {
  280. def cucumberArgs = ['--plugin', 'pretty', '--glue', 'ru.crystals.settester', 'build/resources/test']
  281. dependsOn assemble, compileTestJava, compileJava, processResources, processTestResources, pathingJar
  282.  
  283. def reportDirectory = file('cucumber')
  284. if (reportDirectory.exists()) {
  285. reportDirectory.deleteDir()
  286. }
  287.  
  288. String[] Tags
  289. if (!cucumberTags.isEmpty()) {
  290. Tags = cucumberTags.split(',')
  291. } else
  292. Tags = ''
  293.  
  294. for (String item : Tags) {
  295. inversionTags.add('--tags')
  296. inversionTags.add('~' + item)
  297. }
  298.  
  299. doLast {
  300. GParsPool.withPool(Tags.length) {
  301. Tags.eachParallel { String tag ->
  302. javaexec {
  303. main = "cucumber.api.cli.Main"
  304. classpath = files(pathingJar.archivePath, sourceSets.test.output.getFiles(), sourceSets.main.output.getFiles())
  305. args = cucumberArgs + ['--plugin', 'html:cucumber/html-report' + tag] + ['--plugin', 'junit:cucumber/junit-report' + tag + '.xml'] + ['--plugin', 'json:cucumber/cucumber' + tag + '.json'] + ['--tags', tag]
  306. systemProperties System.getProperties()
  307. }
  308. }
  309. }
  310. }
  311. }
  312.  
  313. task cucumberInSequence() {
  314. def cucumberArgs = ['--plugin', 'pretty', '--glue', 'ru.crystals.settester', 'build/resources/test']
  315. doLast {
  316. javaexec {
  317. main = "cucumber.api.cli.Main"
  318. classpath = files(pathingJar.archivePath, sourceSets.test.output.getFiles(), sourceSets.main.output.getFiles())
  319. args = cucumberArgs + ['--plugin', 'html:cucumber/html-report'] + ['--plugin', 'junit:cucumber/junit-report.xml'] + ['--plugin', 'json:cucumber/cucumber.json'] + inversionTags
  320. systemProperties System.getProperties()
  321. }
  322. }
  323. }
  324.  
  325. task cucumber() {
  326. def cucumberArgs = ['--plugin', 'pretty', '--glue', 'ru.crystals.settester', 'build/resources/test']
  327. if (htmlCucumberReport) {
  328. cucumberArgs.addAll(['--plugin', 'html:cucumber/html-report'])
  329. }
  330.  
  331. if (junitCucumberReport) {
  332. cucumberArgs.addAll(['--plugin', 'junit:cucumber/junit-report.xml'])
  333. }
  334.  
  335. if (jsonCucumberReport) {
  336. cucumberArgs.addAll(['--plugin', 'json:cucumber/cucumber.json'])
  337. }
  338.  
  339. if (!cucumberTags.isEmpty()) {
  340. cucumberArgs.addAll(['--tags', cucumberTags])
  341. }
  342.  
  343. def reportDirectory = file('cucumber')
  344. if (reportDirectory.exists()) {
  345. reportDirectory.deleteDir()
  346. }
  347.  
  348. cucumberArgs.addAll(['--plugin', 'com.epam.reportportal.cucumber.ScenarioReporter'])
  349.  
  350. dependsOn assemble, compileTestJava, compileJava, processResources, processTestResources, pathingJar, reportportal
  351. doLast {
  352. javaexec {
  353. main = "cucumber.api.cli.Main"
  354. classpath = files(pathingJar.archivePath, sourceSets.test.output.getFiles(), sourceSets.main.output.getFiles())
  355. args = cucumberArgs
  356. systemProperties System.getProperties()
  357. }
  358. }
  359. }
  360.  
  361. task prepareEnv(type: Test) {
  362. systemProperties System.getProperties()
  363. testLogging.showStandardStreams = true
  364. dependsOn destroyVagrantMachine, changeVagrantConfig, runVagrantMachine, copySuites
  365. useTestNG()
  366. options {
  367. useDefaultListeners = false
  368. //listeners << 'org.uncommons.reportng.HTMLReporter'
  369. listeners << 'org.uncommons.reportng.JUnitXMLReporter'
  370. suites suitesPath + "suite_robot_config_server.xml"
  371. }
  372. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement