diff options
author | DR695H <dr695h@att.com> | 2019-04-18 10:56:38 -0400 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2019-04-23 10:34:04 -0700 |
commit | d050b58d3fde6a049104d8287f8d8cfbe3013d5d (patch) | |
tree | 7563bfffabfc4f713996b1f12e52b5f2317fc6e2 /robotframework-onap/loadtest/TestConfig.py | |
parent | 5709f89501b9ecf93fcb1667de017e1736c8919f (diff) |
move robotframeworkonap to subdirectory
i also moved the build to maven based, although that isnt needed
to work right now.
Change-Id: Ib18d70e3ea4858cc4b9d51fdc2046b59202640ab
Issue-ID: TEST-141
Signed-off-by: DR695H <dr695h@att.com>
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'robotframework-onap/loadtest/TestConfig.py')
-rw-r--r-- | robotframework-onap/loadtest/TestConfig.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/robotframework-onap/loadtest/TestConfig.py b/robotframework-onap/loadtest/TestConfig.py new file mode 100644 index 0000000..b9b8112 --- /dev/null +++ b/robotframework-onap/loadtest/TestConfig.py @@ -0,0 +1,59 @@ +''' +Created on Apr 7, 2017 + +@author: jf9860 +''' +import json + +class TestConfig(object): + ''' + The profile defines a cycle of tests. Each entry is defined as + [<seconds to wait>, [<list of ete tags to run after the wait]], + ''' + profile = [ + [0, ["health"]], + ] + + duration=10 + cyclelength=60 + + def __init__(self, duration=None, cyclelength=None, json=None): + ''' + Constructor + ''' + if (json != None): + self.parseConfig(json) + if (duration != None): + self.duration = duration + if (cyclelength != None): + self.cyclelength = cyclelength + running_time = 0 + for p in self.profile: + secs = p[0] + running_time = running_time + secs + if (running_time < self.cyclelength): + last = self.cyclelength - running_time + self.profile.append([last, []]) + + def parseConfig(self, fileName): + with open(fileName) as data_file: + config = json.load(data_file) + self.profile = config["profile"] + self.cyclelength = config["cyclelength"] + self.duration = config["duration"] + + + def to_string(self): + pstring = 'Cycle length is {} seconds'.format(self.cyclelength) + pstring = '{}\nDuration is {} seconds'.format(pstring, self.duration) + running_time = 0 + for p in self.profile: + secs = p[0] + running_time = running_time + secs + for ete in p[1]: + pstring = "{0}\n{1:08d} : {2:08d} : {3}".format(pstring, secs, running_time, ete) + if (len(p[1]) == 0): + pstring = "{0}\n{1:08d} : {2:08d} : {3}".format(pstring, secs, running_time, "") + return pstring + + |