@nsshunt/ststestrunner 1.1.45 → 1.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -506,7 +506,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
506
506
  }
507
507
  };
508
508
  ExecuteRunner = async () => {
509
- if (this.runner.iteration % 100 === 0) this.Debug(`${this.runner.options.testType}:${this.runner.workerManagerId} -->> Iteration: ${this.runner.options.description} ${this.runner.iteration}`);
509
+ if (this.runner.iteration % 100 === 0) this.Debug(`TestCaseFhirQueryBase:ExecuteRunner(): ${this.runner.options.testType}:${this.runner.workerManagerId} -->> Iteration: ${this.runner.options.description} ${this.runner.iteration}`);
510
510
  const start = performance.now();
511
511
  this.runner.instrumentData.activeRequestCount++;
512
512
  this.#CheckResetClient();
@@ -524,7 +524,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
524
524
  this.runner.instrumentData.activeRequestCount--;
525
525
  const diff = performance.now() - start;
526
526
  this.runner.instrumentData.duration = diff;
527
- if (diff > 150) console.debug(chalk.default.magenta(`*** ==> Long execution: [${diff}]`));
527
+ if (diff > 150) this.Debug(chalk.default.magenta(`TestCaseFhirQueryBase:ExecuteRunner(): *** ==> Long execution: [${diff}]`));
528
528
  await this.PublishTelemetry();
529
529
  return true;
530
530
  };
@@ -533,9 +533,15 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
533
533
  //#region src/libmodule/testCaseFhir01.ts
534
534
  var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
535
535
  ExecuteQuery = async () => {
536
- await this.GetAccessToken();
537
- this.accesssToken = null;
538
- return null;
536
+ try {
537
+ await this.GetAccessToken();
538
+ this.accesssToken = null;
539
+ return null;
540
+ } catch (error) {
541
+ this.runner.instrumentData.errorCount++;
542
+ this.Error(`TestCaseFhir01:ExecuteQuery(): Error: [${error}]`);
543
+ throw error;
544
+ }
539
545
  };
540
546
  };
541
547
  //#endregion
@@ -548,8 +554,9 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
548
554
  const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
549
555
  return (await client.PostResource("Person", personRecord)).body;
550
556
  } catch (error) {
551
- console.error(error);
552
- return null;
557
+ this.runner.instrumentData.errorCount++;
558
+ this.Error(`TestCaseFhir02:ExecuteQuery(): Error: [${error}]`);
559
+ throw error;
553
560
  }
554
561
  };
555
562
  };
@@ -557,49 +564,61 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
557
564
  //#region src/libmodule/testCaseFhir03.ts
558
565
  var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
559
566
  ExecuteQuery = async () => {
560
- const client = await this.GetClient();
561
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
562
- const retVal = await client.GetResource("Person", personRecord.id);
563
- delete personRecord.meta;
564
- delete retVal.body.meta;
565
- const p1 = JSON.stringify(personRecord);
566
- const p2 = JSON.stringify(retVal.body);
567
- if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
568
- return retVal.body;
567
+ try {
568
+ const client = await this.GetClient();
569
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
570
+ const retVal = await client.GetResource("Person", personRecord.id);
571
+ delete personRecord.meta;
572
+ delete retVal.body.meta;
573
+ const p1 = JSON.stringify(personRecord);
574
+ const p2 = JSON.stringify(retVal.body);
575
+ if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
576
+ return retVal.body;
577
+ } catch (error) {
578
+ this.runner.instrumentData.errorCount++;
579
+ this.Error(`TestCaseFhir03:ExecuteQuery(): Error: [${error}]`);
580
+ throw error;
581
+ }
569
582
  };
570
583
  };
571
584
  //#endregion
572
585
  //#region src/libmodule/testCaseFhir04.ts
573
586
  var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
574
587
  ExecuteQuery = async () => {
575
- const client = await this.GetClient();
576
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
577
- const retVal = await client.GetResource("Person", personRecord.id);
578
- this.runner.instrumentData.requestCount++;
579
- const compPersonRecord = { ...personRecord };
580
- const loadedPersonRecorded = { ...retVal.body };
581
- delete compPersonRecord.meta;
582
- delete loadedPersonRecorded.meta;
583
- const p1 = JSON.stringify(compPersonRecord);
584
- const p2 = JSON.stringify(loadedPersonRecorded);
585
- if (p1.localeCompare(p2) !== 0) {
586
- this.runner.instrumentData.errorCount++;
587
- return retVal.body;
588
- }
589
- const originalPersonRecord = retVal.body;
590
- if (originalPersonRecord && originalPersonRecord.text) {
591
- originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
592
- const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
593
- const updatedRecord = { ...retVal.body };
594
- delete updatedRecord.meta;
595
- delete originalPersonRecord.meta;
596
- const p1 = JSON.stringify(updatedRecord);
597
- const p2 = JSON.stringify(originalPersonRecord);
598
- if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
599
- return retVal.body;
600
- } else {
588
+ try {
589
+ const client = await this.GetClient();
590
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
591
+ const retVal = await client.GetResource("Person", personRecord.id);
592
+ this.runner.instrumentData.requestCount++;
593
+ const compPersonRecord = { ...personRecord };
594
+ const loadedPersonRecorded = { ...retVal.body };
595
+ delete compPersonRecord.meta;
596
+ delete loadedPersonRecorded.meta;
597
+ const p1 = JSON.stringify(compPersonRecord);
598
+ const p2 = JSON.stringify(loadedPersonRecorded);
599
+ if (p1.localeCompare(p2) !== 0) {
600
+ this.runner.instrumentData.errorCount++;
601
+ return retVal.body;
602
+ }
603
+ const originalPersonRecord = retVal.body;
604
+ if (originalPersonRecord && originalPersonRecord.text) {
605
+ originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
606
+ const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
607
+ const updatedRecord = { ...retVal.body };
608
+ delete updatedRecord.meta;
609
+ delete originalPersonRecord.meta;
610
+ const p1 = JSON.stringify(updatedRecord);
611
+ const p2 = JSON.stringify(originalPersonRecord);
612
+ if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
613
+ return retVal.body;
614
+ } else {
615
+ this.runner.instrumentData.errorCount++;
616
+ return null;
617
+ }
618
+ } catch (error) {
601
619
  this.runner.instrumentData.errorCount++;
602
- return null;
620
+ this.Error(`TestCaseFhir04:ExecuteQuery(): Error: [${error}]`);
621
+ throw error;
603
622
  }
604
623
  };
605
624
  };
@@ -607,21 +626,27 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
607
626
  //#region src/libmodule/testCaseFhir05.ts
608
627
  var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
609
628
  ExecuteQuery = async () => {
610
- const client = await this.GetClient();
611
- const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
612
- if (originalPersonRecord && originalPersonRecord.text) {
613
- originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
614
- const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
615
- const updatedRecord = { ...retVal.body };
616
- delete updatedRecord.meta;
617
- delete originalPersonRecord.meta;
618
- const p1 = JSON.stringify(updatedRecord);
619
- const p2 = JSON.stringify(originalPersonRecord);
620
- if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
621
- return retVal.body;
622
- } else {
629
+ try {
630
+ const client = await this.GetClient();
631
+ const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
632
+ if (originalPersonRecord && originalPersonRecord.text) {
633
+ originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
634
+ const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
635
+ const updatedRecord = { ...retVal.body };
636
+ delete updatedRecord.meta;
637
+ delete originalPersonRecord.meta;
638
+ const p1 = JSON.stringify(updatedRecord);
639
+ const p2 = JSON.stringify(originalPersonRecord);
640
+ if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
641
+ return retVal.body;
642
+ } else {
643
+ this.runner.instrumentData.errorCount++;
644
+ return null;
645
+ }
646
+ } catch (error) {
623
647
  this.runner.instrumentData.errorCount++;
624
- return null;
648
+ this.Error(`TestCaseFhir05:ExecuteQuery(): Error: [${error}]`);
649
+ throw error;
625
650
  }
626
651
  };
627
652
  };
@@ -648,7 +673,8 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
648
673
  return retVal.body;
649
674
  } catch (error) {
650
675
  this.runner.instrumentData.errorCount++;
651
- return null;
676
+ this.Error(`TestCaseFhir06:ExecuteQuery(): Error: [${error}]`);
677
+ throw error;
652
678
  }
653
679
  };
654
680
  };
@@ -1312,7 +1338,8 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
1312
1338
  const patchRecord = fast_json_patch_default.generate(observer);
1313
1339
  return (await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`)).body;
1314
1340
  } catch (error) {
1315
- console.error(error);
1341
+ this.runner.instrumentData.errorCount++;
1342
+ this.Error(`TestCaseFhir07:ExecuteQuery(): Error: [${error}]`);
1316
1343
  throw error;
1317
1344
  }
1318
1345
  };
@@ -1328,7 +1355,8 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
1328
1355
  resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
1329
1356
  return (await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`)).body;
1330
1357
  } catch (error) {
1331
- console.error(error);
1358
+ this.runner.instrumentData.errorCount++;
1359
+ this.Error(`TestCaseFhir08:ExecuteQuery(): Error: [${error}]`);
1332
1360
  throw error;
1333
1361
  }
1334
1362
  };
@@ -1337,12 +1365,18 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
1337
1365
  //#region src/libmodule/testCaseFhir09.ts
1338
1366
  var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
1339
1367
  ExecuteQuery = async () => {
1340
- const client = await this.GetClient();
1341
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
1342
- if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
1343
- else {
1368
+ try {
1369
+ const client = await this.GetClient();
1370
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
1371
+ if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
1372
+ else {
1373
+ this.runner.instrumentData.errorCount++;
1374
+ return null;
1375
+ }
1376
+ } catch (error) {
1344
1377
  this.runner.instrumentData.errorCount++;
1345
- return null;
1378
+ this.Error(`TestCaseFhir09:ExecuteQuery(): Error: [${error}]`);
1379
+ throw error;
1346
1380
  }
1347
1381
  };
1348
1382
  };
@@ -1350,9 +1384,15 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
1350
1384
  //#region src/libmodule/testCaseFhir10.ts
1351
1385
  var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
1352
1386
  ExecuteQuery = async () => {
1353
- const client = await this.GetClient();
1354
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
1355
- return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
1387
+ try {
1388
+ const client = await this.GetClient();
1389
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
1390
+ return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
1391
+ } catch (error) {
1392
+ this.runner.instrumentData.errorCount++;
1393
+ this.Error(`TestCaseFhir10:ExecuteQuery(): Error: [${error}]`);
1394
+ throw error;
1395
+ }
1356
1396
  };
1357
1397
  };
1358
1398
  //#endregion