@suffolklitlab/alkiln 5.13.3-feat-random → 5.13.3-feat-random-2
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.
- package/.github/workflows/github_server.yml +3 -1
- package/.github/workflows/playground.yml +3 -1
- package/.github/workflows/unit_tests.yml +1 -1
- package/_alkiln_meta/shift_logs.js +75 -0
- package/action.yml +6 -8
- package/action_for_github_server/action.yml +31 -39
- package/lib/docassemble/setup.js +1 -3
- package/lib/run_cucumber.js +20 -53
- package/lib/setup/TestGenerator.js +48 -38
- package/lib/setup/generate.js +1 -1
- package/lib/setup/validate.js +1 -1
- package/lib/steps.js +20 -67
- package/lib/utils/Log.js +22 -9
- package/lib/utils/_alkiln-constrained_random_tests_old.js +49 -0
- package/lib/utils/reports.js +6 -7
- package/lib/utils/session_vars.js +11 -6
- package/package.json +13 -10
- package/tests/log_codes/check_codes.sh +3 -3
- package/tests/log_codes/log_code_expected_instances.txt +23 -1
- package/tests/unit_tests/constrained_random_answers/invalid.fixtures.js +46 -24
- package/tests/unit_tests/constrained_random_answers/invalid.test.js +22 -4
- package/tests/unit_tests/constrained_random_answers/valid.fixtures.js +129 -98
- package/tests/unit_tests/constrained_random_answers/valid.test.js +33 -13
|
@@ -44,9 +44,9 @@ Scenario: simplest random answers (1 of 1)
|
|
|
44
44
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
45
45
|
// ======= ENDS EXPECTED ======= //
|
|
46
46
|
simple.exact_log_codes = [
|
|
47
|
-
`
|
|
48
|
-
`
|
|
49
|
-
`
|
|
47
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
48
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
49
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
50
50
|
];
|
|
51
51
|
simple.num_Scenarios = 1;
|
|
52
52
|
|
|
@@ -94,9 +94,9 @@ Scenario: I use minimal text (constrain and generat) (1 of 1)
|
|
|
94
94
|
| var | value |
|
|
95
95
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
96
96
|
fixts.generat.exact_log_codes = [
|
|
97
|
-
`
|
|
98
|
-
`
|
|
99
|
-
`
|
|
97
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
98
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
99
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
100
100
|
];
|
|
101
101
|
|
|
102
102
|
|
|
@@ -122,9 +122,9 @@ Scenario: I use minimal text (constrain and rand) (1 of 1)
|
|
|
122
122
|
| var | value |
|
|
123
123
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
124
124
|
fixts.rand.exact_log_codes = [
|
|
125
|
-
`
|
|
126
|
-
`
|
|
127
|
-
`
|
|
125
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
126
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
127
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
128
128
|
];
|
|
129
129
|
|
|
130
130
|
|
|
@@ -150,9 +150,9 @@ Scenario: I use minimal text (constrain and make) (1 of 1)
|
|
|
150
150
|
| var | value |
|
|
151
151
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
152
152
|
fixts.make.exact_log_codes = [
|
|
153
|
-
`
|
|
154
|
-
`
|
|
155
|
-
`
|
|
153
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
154
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
155
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
156
156
|
];
|
|
157
157
|
|
|
158
158
|
|
|
@@ -178,9 +178,9 @@ Scenario: I use minimal text (constrain and made) (1 of 1)
|
|
|
178
178
|
| var | value |
|
|
179
179
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
180
180
|
fixts.made.exact_log_codes = [
|
|
181
|
-
`
|
|
182
|
-
`
|
|
183
|
-
`
|
|
181
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
182
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
183
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
184
184
|
];
|
|
185
185
|
|
|
186
186
|
|
|
@@ -308,9 +308,9 @@ ${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
|
308
308
|
// ======= ENDS EXPECTED ======= //
|
|
309
309
|
complex.num_Scenarios = 2;
|
|
310
310
|
complex.included_log_codes = [
|
|
311
|
-
`
|
|
312
|
-
`
|
|
313
|
-
`
|
|
311
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
312
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`,
|
|
313
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
314
314
|
];
|
|
315
315
|
|
|
316
316
|
|
|
@@ -339,9 +339,9 @@ Scenario: simplest random answers (1 of 1)
|
|
|
339
339
|
| var | value |
|
|
340
340
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
341
341
|
tags.exact_log_codes = [
|
|
342
|
-
`
|
|
343
|
-
`
|
|
344
|
-
`
|
|
342
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
343
|
+
`ALK0246`, `ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
344
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
345
345
|
];
|
|
346
346
|
|
|
347
347
|
|
|
@@ -383,9 +383,9 @@ ${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
|
383
383
|
`;
|
|
384
384
|
// ======= ENDS EXPECTED ======= //
|
|
385
385
|
fixts.weird_spacing.tags.exact_log_codes = [
|
|
386
|
-
`
|
|
387
|
-
`
|
|
388
|
-
`
|
|
386
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
387
|
+
`ALK0246`, `ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
388
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
389
389
|
];
|
|
390
390
|
|
|
391
391
|
|
|
@@ -418,9 +418,9 @@ ${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
|
418
418
|
`;
|
|
419
419
|
// ======= ENDS EXPECTED ======= //
|
|
420
420
|
fixts.weird_spacing.tags_line_2.exact_log_codes = [
|
|
421
|
-
`
|
|
422
|
-
`
|
|
423
|
-
`
|
|
421
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
422
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
423
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
424
424
|
];
|
|
425
425
|
|
|
426
426
|
|
|
@@ -453,9 +453,9 @@ ${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
|
453
453
|
`;
|
|
454
454
|
// ======= ENDS EXPECTED ======= //
|
|
455
455
|
fixts.weird_spacing.indents.exact_log_codes = [
|
|
456
|
-
`
|
|
457
|
-
`
|
|
458
|
-
`
|
|
456
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
457
|
+
`ALK0246`, `ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
458
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
459
459
|
];
|
|
460
460
|
|
|
461
461
|
|
|
@@ -477,9 +477,9 @@ fixts.weird_spacing.choices.expected = `Not appropriate to use use expected valu
|
|
|
477
477
|
fixts.weird_spacing.choices.find_1 = /(?:correct)|(?:wrong)/;
|
|
478
478
|
// ======= ENDS OPTIONS TO FIND ONE OF ======= //
|
|
479
479
|
fixts.weird_spacing.choices.exact_log_codes = [
|
|
480
|
-
`
|
|
481
|
-
`
|
|
482
|
-
`
|
|
480
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
481
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
482
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
483
483
|
];
|
|
484
484
|
|
|
485
485
|
|
|
@@ -510,9 +510,9 @@ Scenario: 3 columns (1 of 1)
|
|
|
510
510
|
| users[0].has_bear | True | users[0].name.first |`;
|
|
511
511
|
// ======= ENDS EXPECTED ======= //
|
|
512
512
|
fixts.columns_3.exact_log_codes = [
|
|
513
|
-
`
|
|
514
|
-
`
|
|
515
|
-
`
|
|
513
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
514
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
515
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
516
516
|
];
|
|
517
517
|
|
|
518
518
|
|
|
@@ -539,9 +539,9 @@ Scenario: 4 columns (1 of 1)
|
|
|
539
539
|
| users[0].has_bear | True | users[0].name.first |`;
|
|
540
540
|
// ======= ENDS EXPECTED ======= //
|
|
541
541
|
fixts.columns_4.exact_log_codes = [
|
|
542
|
-
`
|
|
543
|
-
`
|
|
544
|
-
`
|
|
542
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
543
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
544
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
545
545
|
];
|
|
546
546
|
|
|
547
547
|
|
|
@@ -574,9 +574,9 @@ Scenario: Keeps comments before and in table (1 of 1)
|
|
|
574
574
|
# Comment 2 keep and repeat
|
|
575
575
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
576
576
|
fixts.rows_comments.exact_log_codes = [
|
|
577
|
-
`
|
|
578
|
-
`
|
|
579
|
-
`
|
|
577
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
578
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
579
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
580
580
|
];
|
|
581
581
|
|
|
582
582
|
|
|
@@ -617,9 +617,9 @@ ${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
|
617
617
|
|
|
618
618
|
# Comment 2 keep and repeat`;
|
|
619
619
|
fixts.comment_after_last_row.included_log_codes = [
|
|
620
|
-
`
|
|
621
|
-
`
|
|
622
|
-
`
|
|
620
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
621
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`,
|
|
622
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
623
623
|
];
|
|
624
624
|
|
|
625
625
|
|
|
@@ -648,9 +648,9 @@ Scenario: Keeps empty rows before and in table (1 of 1)
|
|
|
648
648
|
|
|
649
649
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
650
650
|
fixts.rows_empty.exact_log_codes = [
|
|
651
|
-
`
|
|
652
|
-
`
|
|
653
|
-
`
|
|
651
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
652
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
653
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
654
654
|
];
|
|
655
655
|
|
|
656
656
|
|
|
@@ -680,9 +680,9 @@ Feature: I generate constrained random tests (generated by ALKiln)
|
|
|
680
680
|
Scenario: ALKiln humbly begs the author's forgiveness. The next tests might be flawed.
|
|
681
681
|
Then ALKiln warns the author about a generator ${ fixts.FLUB_PLACEHOLDER }:
|
|
682
682
|
"""
|
|
683
|
-
|
|
684
|
-
🔎
|
|
685
|
-
|
|
683
|
+
――――― Generator file warnings ―――――
|
|
684
|
+
🔎 ALK0239 ${ fixts.WARNING_PLACEHOLDER }
|
|
685
|
+
―――――
|
|
686
686
|
"""
|
|
687
687
|
|
|
688
688
|
@scenario1_of_1
|
|
@@ -692,9 +692,9 @@ Scenario: I'm warned with missing number in random answers generator (1 of 1)
|
|
|
692
692
|
| var | value |
|
|
693
693
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
694
694
|
fixts.warnings.no_number.exact_log_codes = [
|
|
695
|
-
`
|
|
696
|
-
`
|
|
697
|
-
`
|
|
695
|
+
`ALK0237`, `ALK0239`, `ALK0243`, `ALK0244`,
|
|
696
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
697
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
698
698
|
];
|
|
699
699
|
|
|
700
700
|
|
|
@@ -716,9 +716,9 @@ Feature: I generate constrained random tests (generated by ALKiln)
|
|
|
716
716
|
Scenario: ALKiln humbly begs the author's forgiveness. The next tests might be flawed.
|
|
717
717
|
Then ALKiln warns the author about a generator ${ fixts.FLUB_PLACEHOLDER }:
|
|
718
718
|
"""
|
|
719
|
-
|
|
720
|
-
🔎
|
|
721
|
-
|
|
719
|
+
――――― Generator file warnings ―――――
|
|
720
|
+
🔎 ALK0240 ${ fixts.WARNING_PLACEHOLDER }
|
|
721
|
+
―――――
|
|
722
722
|
"""
|
|
723
723
|
|
|
724
724
|
@scenario1_of_1
|
|
@@ -728,9 +728,9 @@ Scenario: I'm warned with too many numbers in random answers tests (1 of 1)
|
|
|
728
728
|
| var | value |
|
|
729
729
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
730
730
|
fixts.warnings.multiple_numbers.exact_log_codes = [
|
|
731
|
-
`
|
|
732
|
-
`
|
|
733
|
-
`
|
|
731
|
+
`ALK0237`, `ALK0240`, `ALK0243`, `ALK0244`,
|
|
732
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
733
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
734
734
|
];
|
|
735
735
|
|
|
736
736
|
|
|
@@ -753,9 +753,9 @@ Feature: I generate constrained random tests (generated by ALKiln)
|
|
|
753
753
|
Scenario: ALKiln humbly begs the author's forgiveness. The next tests might be flawed.
|
|
754
754
|
Then ALKiln warns the author about a generator ${ fixts.FLUB_PLACEHOLDER }:
|
|
755
755
|
"""
|
|
756
|
-
|
|
757
|
-
🔎
|
|
758
|
-
|
|
756
|
+
――――― Generator file warnings ―――――
|
|
757
|
+
🔎 ALK0238 ${ fixts.WARNING_PLACEHOLDER }
|
|
758
|
+
―――――
|
|
759
759
|
"""
|
|
760
760
|
|
|
761
761
|
@scenario1_of_1
|
|
@@ -765,9 +765,9 @@ Scenario: I'm warned with too many number Steps in random answers tests (1 of 1)
|
|
|
765
765
|
| var | value |
|
|
766
766
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
767
767
|
fixts.warnings.multiple_number_Steps.exact_log_codes = [
|
|
768
|
-
`
|
|
769
|
-
`
|
|
770
|
-
`
|
|
768
|
+
`ALK0237`, `ALK0238`, `ALK0243`, `ALK0244`,
|
|
769
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
770
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
771
771
|
];
|
|
772
772
|
|
|
773
773
|
|
|
@@ -790,11 +790,11 @@ Feature: I generate constrained random tests (generated by ALKiln)
|
|
|
790
790
|
Scenario: ALKiln humbly begs the author's forgiveness. The next tests might be flawed.
|
|
791
791
|
Then ALKiln warns the author about a generator ${ fixts.FLUB_PLACEHOLDER }:
|
|
792
792
|
"""
|
|
793
|
-
|
|
794
|
-
🔎
|
|
795
|
-
🔎
|
|
796
|
-
🔎
|
|
797
|
-
|
|
793
|
+
――――― Generator file warnings ―――――
|
|
794
|
+
🔎 ALK0240 ${ fixts.WARNING_PLACEHOLDER }
|
|
795
|
+
🔎 ALK0238 ${ fixts.WARNING_PLACEHOLDER }
|
|
796
|
+
🔎 ALK0240 ${ fixts.WARNING_PLACEHOLDER }
|
|
797
|
+
―――――
|
|
798
798
|
"""
|
|
799
799
|
|
|
800
800
|
@scenario1_of_1
|
|
@@ -804,56 +804,87 @@ Scenario: I'm warned with too many numbers in too many numbers Steps in random a
|
|
|
804
804
|
| var | value |
|
|
805
805
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
806
806
|
fixts.warnings.multiple_number_Steps_and_numbers.exact_log_codes = [
|
|
807
|
-
`
|
|
808
|
-
`
|
|
809
|
-
`
|
|
807
|
+
`ALK0237`, `ALK0240`, `ALK0238`, `ALK0240`, `ALK0243`, `ALK0244`,
|
|
808
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0246`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`, `ALK0246`,
|
|
809
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
810
810
|
];
|
|
811
811
|
|
|
812
812
|
|
|
813
813
|
fixts.warnings.fewer_unique_than_requested = {};
|
|
814
|
-
fixts.warnings.fewer_unique_than_requested.arg =
|
|
815
|
-
`Feature: I generate constrained random tests
|
|
814
|
+
fixts.warnings.fewer_unique_than_requested.arg = [
|
|
815
|
+
`Feature: I generate valid constrained random answers tests 1
|
|
816
|
+
|
|
817
|
+
# The 1st of 2 related tests. This 1st one tests uniqueness within one Scenario.
|
|
816
818
|
|
|
817
|
-
Scenario: I'm warned when I ask for too many unique tests
|
|
818
|
-
Given ALKiln
|
|
819
|
+
Scenario: 1st I'm warned when I ask for too many unique tests in one generator
|
|
820
|
+
Given ALKiln will make 3 random constrained tests
|
|
819
821
|
Given I start the interview at "test_kickout"
|
|
820
|
-
And ALKiln
|
|
822
|
+
And ALKiln will get to ["kickout screen", "success screen"] with any combination of:
|
|
821
823
|
| var | possible_values |
|
|
822
|
-
| user_choice | correct;; wrong
|
|
824
|
+
| user_choice | correct;; wrong |`,
|
|
825
|
+
`Feature: I generate valid constrained random answers tests 2
|
|
826
|
+
|
|
827
|
+
# The 2nd of 2 related tests. Because ALKiln will try to only generate unique tests between all the generators, this 2nd one tests uniqueness of tests between generators. Only the body of the Scenario should matter for uniqueness.
|
|
828
|
+
|
|
829
|
+
Scenario: 2nd I'm warned when I ask for too many unique tests between 2 generators
|
|
830
|
+
Given ALKiln will make 1 random constrained test
|
|
831
|
+
Given I start the interview at "test_kickout"
|
|
832
|
+
And ALKiln will get to ["kickout screen", "success screen"] with any combination of:
|
|
833
|
+
| var | possible_values |
|
|
834
|
+
| user_choice | correct;; wrong |`
|
|
835
|
+
];
|
|
823
836
|
fixts.warnings.fewer_unique_than_requested.expected =
|
|
824
837
|
`@alkiln @generated @randomized @constraints
|
|
825
|
-
Feature: I generate constrained random tests (generated by ALKiln)
|
|
838
|
+
Feature: I generate valid constrained random answers tests 1 (generated by ALKiln)
|
|
839
|
+
|
|
840
|
+
# The 1st of 2 related tests. This 1st one tests uniqueness within one Scenario.
|
|
826
841
|
|
|
827
842
|
@alkiln_extra_intro @alkiln_generator_warning
|
|
828
843
|
Scenario: ALKiln humbly begs the author's forgiveness. The next tests might be flawed.
|
|
829
844
|
Then ALKiln warns the author about a generator ${ fixts.FLUB_PLACEHOLDER }:
|
|
830
845
|
"""
|
|
831
|
-
|
|
832
|
-
🔎
|
|
833
|
-
|
|
846
|
+
――――― Generator file warnings ―――――
|
|
847
|
+
🔎 ALK0260 ${ fixts.WARNING_PLACEHOLDER }
|
|
848
|
+
―――――
|
|
834
849
|
"""
|
|
835
850
|
|
|
836
851
|
@scenario1_of_2
|
|
837
|
-
Scenario: I'm warned when I ask for too many unique tests (1 of 2)
|
|
852
|
+
Scenario: 1st I'm warned when I ask for too many unique tests in one generator (1 of 2)
|
|
838
853
|
Given I start the interview at "test_kickout"
|
|
839
|
-
And I get to any of the question ids ["
|
|
854
|
+
And I get to any of the question ids ["kickout screen", "success screen"] with this data:
|
|
840
855
|
| var | value |
|
|
841
856
|
${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
842
857
|
|
|
843
858
|
@scenario2_of_2
|
|
844
|
-
Scenario: I'm warned when I ask for too many unique tests (2 of 2)
|
|
859
|
+
Scenario: 1st I'm warned when I ask for too many unique tests in one generator (2 of 2)
|
|
845
860
|
Given I start the interview at "test_kickout"
|
|
846
|
-
And I get to any of the question ids ["
|
|
861
|
+
And I get to any of the question ids ["kickout screen", "success screen"] with this data:
|
|
847
862
|
| var | value |
|
|
848
|
-
${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
863
|
+
${ fixts.RANDOM_TABLE_PLACEHOLDER }
|
|
864
|
+
|
|
865
|
+
@alkiln @generated @randomized @constraints
|
|
866
|
+
Feature: I generate valid constrained random answers tests 2 (generated by ALKiln)
|
|
867
|
+
|
|
868
|
+
# The 2nd of 2 related tests. Because ALKiln will try to only generate unique tests between all the generators, this 2nd one tests uniqueness of tests between generators. Only the body of the Scenario should matter for uniqueness.
|
|
869
|
+
|
|
870
|
+
@alkiln_extra_intro @alkiln_generator_warning
|
|
871
|
+
Scenario: ALKiln humbly begs the author's forgiveness. The next tests might be flawed.
|
|
872
|
+
Then ALKiln warns the author about a generator ${ fixts.FLUB_PLACEHOLDER }:
|
|
873
|
+
"""
|
|
874
|
+
――――― Generator file warnings ―――――
|
|
875
|
+
🔎 ALK0260 ${ fixts.WARNING_PLACEHOLDER }
|
|
876
|
+
―――――
|
|
877
|
+
"""
|
|
878
|
+
|
|
879
|
+
`;
|
|
849
880
|
fixts.warnings.fewer_unique_than_requested.find_1_of = [/\| correct \|/, /\| wrong \|/];
|
|
850
|
-
// The
|
|
851
|
-
fixts.warnings.fewer_unique_than_requested.num_Scenarios =
|
|
852
|
-
fixts.warnings.fewer_unique_than_requested.repeat = { code: `
|
|
881
|
+
// The 3rd and 4th are the warning Scenarios
|
|
882
|
+
fixts.warnings.fewer_unique_than_requested.num_Scenarios = 4;
|
|
883
|
+
fixts.warnings.fewer_unique_than_requested.repeat = { code: `ALK0257`, count: 10 };
|
|
853
884
|
fixts.warnings.fewer_unique_than_requested.included_log_codes = [
|
|
854
|
-
`
|
|
855
|
-
`
|
|
856
|
-
`
|
|
885
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
886
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0255`, `ALK0257`, `ALK0259`,
|
|
887
|
+
`ALK0260`, `ALK0261`, `ALK0262`, `ALK0264`,
|
|
857
888
|
];
|
|
858
889
|
|
|
859
890
|
|
|
@@ -899,7 +930,7 @@ ${ fixts.RANDOM_TABLE_PLACEHOLDER }`;
|
|
|
899
930
|
fixts.empty_string_value.find_1_of = [/\| correct \|/, /\| \|/];
|
|
900
931
|
fixts.empty_string_value.num_Scenarios = 2;
|
|
901
932
|
fixts.empty_string_value.included_log_codes = [
|
|
902
|
-
`
|
|
903
|
-
`
|
|
904
|
-
`
|
|
933
|
+
`ALK0237`, `ALK0243`, `ALK0244`,
|
|
934
|
+
`ALK0245`, `ALK0248`, `ALK0249`, `ALK0246`, `ALK0254`, `ALK0255`, `ALK0257`, `ALK0259`,
|
|
935
|
+
`ALK0261`, `ALK0262`, `ALK0264`,
|
|
905
936
|
];
|
|
@@ -66,7 +66,7 @@ function get_log_codes({ logger }) {
|
|
|
66
66
|
* */
|
|
67
67
|
let codes = [];
|
|
68
68
|
|
|
69
|
-
for ( let record of logger.
|
|
69
|
+
for ( let record of logger.internal_log_records ) {
|
|
70
70
|
codes.push( record.opts.code );
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -93,26 +93,46 @@ function mutate_globals_with({ testing_vals, do_compare=false }) {
|
|
|
93
93
|
*
|
|
94
94
|
* @returns {undefined}
|
|
95
95
|
* */
|
|
96
|
-
//
|
|
97
|
-
logger.
|
|
96
|
+
// Reset log codes
|
|
97
|
+
logger.clear_internal_log_records();
|
|
98
98
|
|
|
99
99
|
// Fresh namespace
|
|
100
100
|
let generator = new TestGenerator();
|
|
101
101
|
// Mutates `fixture`
|
|
102
102
|
fixture = testing_vals;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
|
|
104
|
+
let generators = fixture.arg;
|
|
105
|
+
if ( !Array.isArray( generators )) {
|
|
106
|
+
generators = [ fixture.arg ];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Mutates `errors` and `num_Scenarios`
|
|
110
|
+
errors = [];
|
|
111
|
+
num_Scenarios = 0;
|
|
112
|
+
let new_files = [];
|
|
113
|
+
for ( let generator_text of generators ) {
|
|
114
|
+
|
|
115
|
+
let { new_contents: new_file, errors: new_errors } = generator.parse_file({
|
|
116
|
+
file_text: generator_text,
|
|
106
117
|
generator_path: `used_in_warning_logs`,
|
|
107
118
|
logger
|
|
108
|
-
})
|
|
119
|
+
});
|
|
109
120
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
new_files.push( new_file );
|
|
122
|
+
errors.push( ...new_errors );
|
|
123
|
+
|
|
124
|
+
// Validate new file. Should always be valid
|
|
125
|
+
let { AST: doc_AST, errors: file_errs } = get_Gherkin_AST({
|
|
126
|
+
file_text: new_file
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
let scenarios = doc_AST.feature.children;
|
|
130
|
+
num_Scenarios += scenarios.length;
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Mutates `new_contents`
|
|
135
|
+
new_contents = new_files.join(`\n\n`);
|
|
116
136
|
|
|
117
137
|
if ( do_compare ) {
|
|
118
138
|
// Mutates `comparable`
|