blob: dd5cf880e709d4f3855421b97f955f47e6bbba5e [file] [log] [blame]
Devin Lime1346f42018-05-15 15:41:36 -07001#!groovy
Devin Limf5175192018-05-14 19:13:22 -07002// Copyright 2017 Open Networking Foundation (ONF)
3//
4// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7//
8// TestON is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 2 of the License, or
11// (at your option) any later version.
12//
13// TestON is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with TestON. If not, see <http://www.gnu.org/licenses/>.
20
21// This is the Jenkins script for USECASE-pipeline-<branch>
22
Devin Limf5175192018-05-14 19:13:22 -070023// set the dependencies.
Devin Limb734ea52018-05-14 14:13:05 -070024funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
25test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
26fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080027
Devin Limf5175192018-05-14 19:13:22 -070028// init configuration of funcs to be USECASE
Devin Limfe9a4cb2018-05-11 17:06:21 -070029fileRelated.init()
Devin Lim61643762017-12-07 15:55:38 -080030funcs.initialize( "USECASE" );
Devin Limf5175192018-05-14 19:13:22 -070031
32// read the TestON.property files and save it as a dictionary
Devin Lim90803a82017-08-29 13:41:44 -070033def prop = null
Devin Lim61643762017-12-07 15:55:38 -080034prop = funcs.getProperties()
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080035USECASE = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "USECASE" ]
36
Devin Limf5175192018-05-14 19:13:22 -070037// save directory and file.
Devin Limfe9a4cb2018-05-11 17:06:21 -070038graph_generator_file = fileRelated.trendIndividual
39graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
Devin Lim90803a82017-08-29 13:41:44 -070040
Devin Limf5175192018-05-14 19:13:22 -070041// get tests to run.
Devin Lim61643762017-12-07 15:55:38 -080042echo( "Testcases:" )
43def testsToRun = null
44testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
45funcs.printTestToRun( testsToRun )
Devin Lim90803a82017-08-29 13:41:44 -070046
Devin Limf5175192018-05-14 19:13:22 -070047// save the function of the test running into the dictionary.
Devin Lim90803a82017-08-29 13:41:44 -070048def tests = [:]
49for( String test : USECASE.keySet() ){
50 toBeRun = testsToRun.contains( test )
51 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
Devin Lim61643762017-12-07 15:55:38 -080052 tests[ stepName ] = funcs.runTest( test, toBeRun, prop, test, false, USECASE, graph_generator_file, graph_saved_directory )
Devin Lim90803a82017-08-29 13:41:44 -070053}
54
Devin Limf5175192018-05-14 19:13:22 -070055// get start time of the test.
Devin Lim61643762017-12-07 15:55:38 -080056start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070057// run the tests sequntially
Devin Lim90803a82017-08-29 13:41:44 -070058for ( test in tests.keySet() ){
Devin Lim61643762017-12-07 15:55:38 -080059 tests[ test ].call()
Devin Lim90803a82017-08-29 13:41:44 -070060}
Devin Limf5175192018-05-14 19:13:22 -070061
62// send the result to slack after USECASE test is done.
Devin Lim61643762017-12-07 15:55:38 -080063funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
Devin Limf5175192018-05-14 19:13:22 -070064
65// generate the overall graph for USECASE.
Devin Limfe9a4cb2018-05-11 17:06:21 -070066funcs.generateOverallGraph( prop, USECASE, graph_saved_directory )