|
46 | 46 | {} |
47 | 47 | (distinct (into (keys map1) (keys map2))))) |
48 | 48 |
|
49 | | -(defn update-steps [use-test-step old-tests test-cases match-step-by options new-map] |
50 | | - (if use-test-step |
| 49 | +(defn update-steps [old-tests test-id-to-cases test-name-to-params options] |
| 50 | + (if (:use-test-step options) |
51 | 51 | (map |
52 | 52 | (fn [t] |
53 | 53 | (let [test-id (Integer/parseInt (:id (last t))) |
54 | 54 | test-name (first t) |
55 | | - params (get new-map test-name) |
56 | | - test-test-cases (get test-cases test-id) |
| 55 | + params (get test-name-to-params test-name) |
| 56 | + test-test-cases (get test-id-to-cases test-id) |
57 | 57 | t-test-cases (filter |
58 | 58 | (fn [case] |
59 | 59 | (not (and (:only-failed-steps options) (= "" (:failure-detail case))))) |
|
67 | 67 | (reduce (fn [p param] |
68 | 68 | (or p |
69 | 69 | (replace-map |
70 | | - (if (= match-step-by "description") |
| 70 | + (if (= (:match-step-by options) "description") |
71 | 71 | (:description case) |
72 | 72 | (:pt-test-step-name case)) |
73 | 73 | (replace-keys param)))) |
|
77 | 77 | (reduce (fn [p param] |
78 | 78 | (or p |
79 | 79 | (replace-map |
80 | | - (if (= match-step-by "description") |
| 80 | + (if (= (:match-step-by options) "description") |
81 | 81 | (eval/sf-test-case->pt-step-description options case) |
82 | 82 | (eval/sf-test-case->pt-step-name options case)) |
83 | 83 | (replace-keys param)))) |
|
160 | 160 |
|
161 | 161 | (defn create-instances [[all-tests org-xml-tests testset-id-to-name ts-id-test-name-num-instances test-id-to-cases tests-after] |
162 | 162 | client |
163 | | - {:keys [project-id display-action-logs display-run-time pt-instance-params use-test-step match-step-by] :as options} start-time] |
| 163 | + {:keys [project-id display-action-logs display-run-time pt-instance-params] :as options} start-time] |
164 | 164 | (when display-action-logs (log/infof "pt-instance-params: %s" pt-instance-params)) |
165 | 165 | (let [all-test-ids (map (fn [test] (:id (last test))) all-tests) |
166 | 166 | testname-test (into {} (map (fn [test] {(first test) test}) all-tests)) |
|
203 | 203 | #(eval/sf-test-suite->pt-test-name options %) |
204 | 204 | org-xml-tests)))) |
205 | 205 |
|
206 | | - testname-test2 (when |
| 206 | + test-name-param-vals (when |
207 | 207 | (not-empty pt-instance-params) |
208 | 208 | (into |
209 | 209 | #{} |
|
223 | 223 | test-type (:test-type (:attributes (last obj-test))) |
224 | 224 | params (if (= test-type "BDDTest") bdd-parameters parameters) |
225 | 225 | vals (into [] (if (map? params) (vals params) params))] |
226 | | - (contains? testname-test2 (str name ":" vals)))) |
| 226 | + (contains? test-name-param-vals (str name ":" vals)))) |
227 | 227 | instances) |
228 | 228 | instances) |
229 | 229 |
|
|
262 | 262 | (get-in inst [:attributes :name])) |
263 | 263 | filter-instances)))) |
264 | 264 |
|
265 | | - new-map (into {} |
| 265 | + test-name-to-params (into {} |
266 | 266 | (map |
267 | 267 | (fn [test-name] |
268 | 268 | (reduce (fn [a b] |
|
293 | 293 | (map |
294 | 294 | (fn [test-name] |
295 | 295 | {test-name |
296 | | - (into [] (difference (set (get new-map test-name)) (set (get existing-instance test-name))))}) |
297 | | - (keys new-map))) |
| 296 | + (into [] |
| 297 | + (difference |
| 298 | + (set (get test-name-to-params test-name)) |
| 299 | + (set (get existing-instance test-name))))}) |
| 300 | + (keys test-name-to-params))) |
298 | 301 |
|
299 | | - tests-with-steps (update-steps use-test-step all-tests test-id-to-cases match-step-by options new-map) |
| 302 | + tests-with-steps (update-steps all-tests test-id-to-cases test-name-to-params options) |
300 | 303 | all-tests (concat tests-after tests-with-steps) |
301 | 304 | make-instances (flatten (api/make-instances missing-instances new-testname-to-params test-id-testname)) |
302 | 305 | test-by-id (group-by (fn [test] (read-string (:id (last test)))) all-tests) |
|
307 | 310 | filter-instances |
308 | 311 | instances))) |
309 | 312 |
|
| 313 | + group-xml-tests (group-by |
| 314 | + (fn [test] |
| 315 | + [(eval/sf-test-suite->pt-test-name options test) |
| 316 | + (when pt-instance-params (split-n-filter-instance-params test pt-instance-params))]) |
| 317 | + org-xml-tests) |
| 318 | + |
310 | 319 | instance-to-ts-test (group-by (fn [inst] [(:set-id (:attributes inst)) (:test-id (:attributes inst))]) all-intstances)] |
311 | 320 | (when display-run-time (print-run-time "Time - after create instances: %d:%d:%d" start-time)) |
312 | | - [test-by-id instance-to-ts-test new-map])) |
| 321 | + [test-by-id instance-to-ts-test test-name-to-params group-xml-tests])) |
313 | 322 |
|
314 | | -(defn make-runs [[test-by-id instance-to-ts-test new-map] client {:keys [project-id display-action-logs] :as options} start-time] |
| 323 | +(defn make-runs [[test-by-id instance-to-ts-test test-name-to-params group-xml-tests] client {:keys [display-action-logs] :as options} start-time] |
315 | 324 | (when display-action-logs (log/infof "make-runs")) |
316 | 325 | (flatten (doall |
317 | 326 | (for [[test-testset instances] instance-to-ts-test] |
318 | 327 | (map-indexed |
319 | 328 | (fn [index instance] |
320 | | - (let [[ts-id test-id] test-testset |
| 329 | + (let [[_ test-id] test-testset |
321 | 330 | tst (first (get test-by-id test-id)) |
322 | | - params (get new-map (get tst 0)) |
| 331 | + test-name (get tst 0) |
| 332 | + params (get test-name-to-params test-name) |
323 | 333 | this-param (get params index) |
324 | | - [run run-steps] (eval/sf-test-suite->run-def options (get tst 1) this-param) |
| 334 | + xml-test (get group-xml-tests [test-name (vals this-param)]) |
| 335 | + sys-test (get tst 1) |
| 336 | + [run run-steps] (eval/sf-test-suite->run-def options (first xml-test) sys-test this-param) |
325 | 337 | additional-run-fields (eval/eval-additional-fields run (:additional-run-fields options)) |
326 | 338 | additional-run-fields (merge additional-run-fields (:system-fields additional-run-fields)) |
327 | | - run (eval/sf-test-run->run-def additional-run-fields (get tst 1))] |
| 339 | + run (eval/sf-test-run->run-def additional-run-fields sys-test)] |
328 | 340 | {:instance-id (:id instance) |
329 | 341 | :attributes run |
330 | 342 | :steps run-steps})) instances))))) |
|
0 commit comments