1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
|
%global _empty_manifest_terminate_build 0
Name: python-neoload
Version: 1.3.12
Release: 1
Summary: A command-line native utility for launching and observing NeoLoad performance tests
License: Apache 2.0
URL: https://github.com/Neotys-Labs/neoload-cli
Source0: https://mirrors.aliyun.com/pypi/web/packages/5c/65/21ce9408ed6b8a6555539e3e313951a5b32a4ce8be8da36a097f563022fd/neoload-1.3.12.tar.gz
BuildArch: noarch
Requires: python3-click
Requires: python3-pyconfig
Requires: python3-appdirs
Requires: python3-requests
Requires: python3-jsonschema
Requires: python3-PyYAML
Requires: python3-junit-xml
Requires: python3-termcolor
Requires: python3-coloredlogs
Requires: python3-gitignorefile
Requires: python3-jinja2
Requires: python3-dateutil
Requires: python3-tqdm
Requires: python3-requests-toolbelt
Requires: python3-urllib3
Requires: python3-docker
Requires: python3-pyparsing
Requires: python3-simplejson
Requires: python3-colorama
Requires: python3-importlib-resources
%description
# NeoLoad CLI [](https://github.com/Neotys-Labs/neoload-cli/actions?query=workflow%3A%22Python+package%22+branch%3A%22master%22)
## Overview
This command-line interface helps you launch and observe performance tests on the Neotys Web Platform. Since NeoLoad is very flexible to many deployment models (SaaS, self-hosted, cloud or local containers, etc.), configuration and test execution parameters depend on your licensing and infrastructure provisioning options.
| Property | Value |
| ---------------- | ---------------- |
| Maturity | Stable |
| Author | Neotys |
| License | [BSD 2-Clause "Simplified"](https://github.com/Neotys-Labs/neoload-cli/blob/master/LICENSE) |
| NeoLoad Licensing | License FREE edition, or Enterprise edition, or Professional |
| Supported versions | Tested with NeoLoad Web from version [2.3.2](https://neoload.saas.neotys.com)
| Download Binaries | See the [latest release on pypi](https://pypi.org/project/neoload)|
## TL;DR ... What
The goal of this guide is to demonstrate how you can:
1. create API load tests using code (YAML)
2. run them from any environment
3. visualize test results in web dashboards
## TL;DR ... How
```
pip3 install neoload
neoload login $NLW_TOKEN \
test-settings --zone $NLW_ZONE_DYNAMIC --lgs 5 --scenario sanityScenario createorpatch NewTest1 \
project --path tests/neoload_projects/example_1 upload NewTest1 \
run
```
NOTE: For Windows command line, replace the '\\' multi-line separators above with '^'
## Contents
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Login to Neoload Web](#login-to-neoload-web)
- [Setup a test](#setup-a-test)
- [Setup resources in Neoload Web](#setup-resources-in-neoload-web)
- [Define a test settings](#define-a-test-settings)
- [Upload a Neoload project](#upload-a-neoload-project)
- [Excluding files from the project upload] (#excluding-files-from-the-project-upload)
- [Run a test](#run-a-test)
- [Stop a running test](#stop-a-running-test)
- [Reporting](#reporting)
- [View results](#view-results)
- [Exporting Transaction CSV data](#exporting-transaction-CSV-data)
- [View zones](#view-zones)
- [Create local docker infrastructure to run a test](#create-local-docker-infrastructure-to-run-a-test)
- [Continuous Testing Examples](#continuous-testing-examples)
- [Support for fast-fail based on SLAs](#support-for-fast-fail-based-on-slas)
- [Packaging the CLI with Build Agents](#packaging-the-cli-with-build-agents)
- [IDE Integrations](#ide-integrations)
- [Contributing](#contributing)
## Prerequisites
The CLI requires **Python3**
- Download and install python3 for **Windows 10** from [Python.org](https://www.python.org/downloads/)
- Make sure you check the option 'Add Python to the environment variables' option
- Install pip: ```python -m pip install -U pip```
- Download and install python3 for **Mac OS X** from [Python.org - Python3 on Mac OS X](https://docs.python-guide.org/starting/install3/osx/)
Optional: Install Docker for hosting the test infra on your machine (this feature does not work with Docker for Windows).
## Installation
```
pip3 install neoload
neoload --help
```
NOTE: if you receive SSL download errors when running the above command, you may also need to install sources using the following command:
```
pip3 install certifi
```
## Login to Neoload Web
NeoLoad CLI defaults to using the NeoLoad Web APIs for most operations. That's why you need to login.
```
neoload login [TOKEN]
neoload login --url http://your-onpremise-neoload-api.com/ --workspace "Default Workspace" your-token
```
The CLI will connect by default to Neoload Web SaaS to lease license. \
For self-hosted enterprise license, you must specify the Neoload Web **Api url** with --url. \
\
The CLI stores data locally like api url, token, the workspace ID and the test ID you are working on. **The commands can be chained !**
```
neoload status # Displays stored data
```
## Setup a test
### Optionally Choose a workspace to work with
```
Usage: neoload workspaces [OPTIONS] [[ls|use]] [NAME_OR_ID]
Help: neoload workspaces --help
neoload workspaces use "Default Workspace"
```
Since Neoload Web 2.5 (August 2020), assets are scoped to workspaces.
The CLI allows you to choose your workspace at login or with the "use" sub-command, otherwise the "Default Workspace" is used.\
**/!\\** The zones are shared between workspaces.
### Setup resources in Neoload Web
Run a test requires an infrastructure that is defined in Neoload Web Zones section [(see documentation how to manage zones)](https://www.neotys.com/documents/doc/nlweb/latest/en/html/#27521.htm)
You must at least have either a dynamic or a static zone with one controller and one load generator. At First, you could add resources to the "Default zone" since the CLI use it by default.
### Define a Test
NeoLoad Web Tests contains the configuration of the test and the list of its Test Results. You can analyse transactions values over the latest Test Results to detect regressions.
```
Usage: neoload test-settings [OPTIONS] [[ls|create|put|patch|delete|use|createorpatch]] [NAME]
Help: neoload test-settings --help
neoload test-settings --zone defaultzone --lgs 5 --scenario sanityScenario create NewTest1
```
You can optionally define :
- Which scenario of the Neoload project to use
- The test-settings description
- The controller and load generator's zone to use (defaultzone is set by default)
- How many load generators to use for the zone (1 LG on the defaultzone is set by default)
- Advanced users who already have several zones with available resources in it can write : ```--zone my_controller_zone --lgs lg_zoneA:2,lg_zoneB:3```
To work with a specific test already created and be able to chain commands
```
neoload test-settings use NewTest1
neoload test-settings use 4a5e7707-75c0-4106-bbd4-68962ac7f2b3
```
### Upload a Neoload project
See basic projects examples on github [tests/neoload_projects folder](https://github.com/Neotys-Labs/neoload-cli/tree/master/tests/neoload_projects)
To upload a NeoLoad project zip file or a standalone as code file into a test-settings
```
Usage: neoload project [OPTIONS] [up|upload|meta] NAME_OR_ID
Help: neoload project --help
neoload project --path tests/neoload_projects/example_1/ upload
```
You must specify in which test the project will be uploaded:
* either by doing this command first
<pre><code>neoload test-settings use NewTest1</code></pre>
* or by adding the name or id of the test to the project command
<pre><code>neoload project --path tests/neoload_projects/example_1/ upload NewTest1</code></pre>
:warning: If the Test has no scenario or a scenario that does not exist in the project, then the scenario "Custom" will be selected by default (10 VUs for 5 minutes).
To Validate the syntax and schema of the as-code project yaml files
```
neoload validate sample_projects/example_1/default.yaml
```
### Excluding files from the project upload
If you are uploading a project directory that contains non NeoLoad as-code YAML files (such as .gitlab-ci.yml) you will need to create a .nlignore file (exactly the same as .gitignore) that excludes these files from the project upload process so that NeoLoad Web does not parse them and fail them as if they should be the NeoLoad DSL.
Please see Gitlab and Azure pipeline examples for more detail.
## Run a test
This command runs a test, it produces blocking, unbuffered output about test execution process, including readout of current data points.
At the end, displays the summary and the SLA passed & failed.
```
Usage: neoload run [OPTIONS] [NAME_OR_ID]
Help: neoload run --help
neoload run \ # Runs the currently used test-settings (see neoload status and neoload test-settings use)
--as-code default.yaml,slas/uat.yaml \
--scenario scenario1
--name "MyCustomTestName_${JOB_ID}" \
--description "A custom test description containing hashtags like #latest or #issueNum"
```
- detach option kick off a test and returns immediately. Logs are displayed in Neoload Web (follow the url).
- as-code option specify as-code yaml files to use for the test. They should already be uploaded with the project.
- scenario option specify the scenario name to run. The scenario must be declared in an as-code yaml or in the project, or else it will be the NeoLoad Web Custom scenario (10 VUs 5 minutes).
- Test result name and description can be customized to include CI specific details (e.g. CI job, build number...).
- Reservations can be used with either the reservationID or a reservation duration and a number of Virtual users.
If you are running in interactive console mode, the NeoLoad CLI will automatically open the system default browser to your live test results. \
When hitting Ctrl+C, the CLI will try to stop the test gracefully
### Stop a running test
```
neoload stop # Send the stop signal to the test and wait until it ends.
```
## Reporting
There is basic support in the NeoLoad CLI for viewing and exporting results.
### View results
```
Usage: neoload test-results [OPTIONS] [[ls|summary|junitsla|put|patch|delete|use]] [NAME]
Help: neoload test-results --help
neoload test-results ls # Lists test results .
neoload test-results use # Remember the test result you want to work on. .
neoload test-results summary # The Json result summary, with SLAs
neoload test-results junitsla # Output the summary in a JUnit xml file
```
Metadata on a test can be modified after the test is complete, such as name, description, and status.\
To filter test results based on project, scenario, or status:
```
neoload test-results --filter "project=MyProject;scenario=fullTest" ls
neoload test-results --filter "status=TERMINATED|qualityStatus=FAILED" ls
```
NOTE: you can use either a semicolon OR a pipe, but not both interchangeably in the same filter.
To work with a specific test result and be able to chain commands
```
neoload test-results use 4a5e7707-75c0-4106-bbd4-68962ac7f2b3
```
Detailed logs and results are available on Neoload Web. To get the url of the current result :
```
neoload logs-url # The URL to the test in Neoload Web
```
### The test-results vs. report subcommands
The 'test-results' subcommand is intended for direct operational queries against high-level API data.
The 'report' subcommand is intended to simplify not only common data exporting needs, but also provide
templating capabilities over a standard, correlated data model. In contrast to the test-results
subcommand, 'report' can be used to generate as well as transform test result data.
### Exporting Transaction CSV data
```
Usage: neoload report [OPTIONS] [NAME]
Help: neoload report --help
neoload report --template builtin:transactions-csv "test_result_name_or_id" > temp.csv
```
### Filtering export data by timespan
In many load tests, ramp-up and spin-down time is considered irrelevant to calculate into aggregate statistics,
such as how when warming up, systems may produce higher-than-expected latencies until a steady state is reached.
Therefore, the NeoLoad CLI allows for export of particular time ranges by providing a timespan filter.
```
neoload report --template builtin:transactions-csv --filter "timespan=5m-95%"
neoload report --template builtin:transactions-csv --filter "timespan=15%"
neoload report --template builtin:transactions-csv --filter "timespan=-90%"
```
Timespan format is [Time], then '-' representing to, then another [Time]. Time format can
be either a human readable duration or percentage of overall test duration.
Human readable time duration format is hour|minute|second such as '1h5m30s' or a sub-portion such as '5m'.
Omitting the end [Time] segment will filter results beginning with the time specified to the end of the test.
Similarly, ommiting the start [Time] segment will filter results beginning with the start of the test
to the end time specified.
### Filtering export data by element
It is often useful to narrow analysis and statistics to a particular group of activities, such as
Login processes across multiple workflows (user paths) or other common key business transactions.
Therefore, the NeoLoad CLI allows for exports of specific transcations whose name, parent, or User Path name
matches specific values or patterns.
```
neoload report --template builtin:transactions-csv --filter "elements=Login"
```
You can filter to specific transactions or requests by specifying 'elements' and then a pipe-delimited list
of element GUIDs, full names, or partial name matches. This can also include python-compliant regular expressions.
### Combining timespan and element filters
```
neoload report --template builtin:transactions-csv --filter "timespan=50%-95%;elements=AddToCart"
```
Both timespan and elements filters can be combined in order to get statistics for specific elements
within a precise portion of the test duration. Per the example above, transaction data will be computed
for elements that have 'AddToCart' somewhere in their name, user path, or parent element and calculate
aggregates based on data starting from halfway through the test up to just about the very end.
### Exporting All Test Data and Using Custom Templates
If you would like to use multiple templates to create separate output files for specific test data,
you should dump the test result data using the standard JSON scheme first:
```
neoload report --out-file ~/Downloads/temp.json
```
NOTE: by default, this queries all entity data in test results and may cause multiple API calls
to occur depending on the structure of the user paths and monitoring data in the test result set.
Then you can produce multiple output files from a single data snapshot:
```
neoload report --json-in ~/Downloads/temp.json \
--template builtin:transactions-csv \
--out-file ~/Downloads/temp.csv
neoload report --json-in ~/Downloads/temp.json \
--template /path/to/a/jinja/template.j2 \
--out-file ~/Downloads/temp.html
```
NOTE: built-in reports produce a reduced-scope JSON data model and are therefore faster
that exporting all test data for various templates and output specs.
## View zones
```
neoload zones --human
Help: neoload zones --help
```
Display in a human-readable way the list of all static and dynamic zones registered on Neoload Web, and the resources attached (controllers and load generators).
## Create local docker infrastructure to run a test [EXPERIMENTAL]
***WARNING: Docker features are not officially supported by Neotys as they rely heavily on your own Docker setup and environment. This command is only for local/dev test scenarios to simplify infrastructure requirements.***
In certain environments, such as on a local dev workstation or in a Docker-in-Docker CI build node, it is useful
to "bring your own infrastructure". In other words, when you don't already have a controller and load generators
available in a zone, you can spin some up using Docker before the test starts. An example of an all-on-one approach:
```
neoload docker install
neoload login $NLW_TOKEN \
test-settings --lgs 2 --scenario sanityScenario create NewTest1 \
project --path tests/neoload_projects/example_1 upload \
run
```
What the 'docker install' CLI add step in run command. This step is triggered when zone of controller the test-settings is same than docker.zone (default is defaultzone).
When it is triggered, it launches one controller with number of LG test-settings in docker.zone.
At the end of the run the containers are removed.
The docker container can be launched manually with neoload docker up command and removed with neoload docker down command.
In this case the number of controller and lg is defined by configuration respectively docker.controller.default_count (default: 1) and
docker.lg.default_count (default: 2).
```
Usage: neoload docker [OPTIONS] [up|down|clean|forget|install|uninstall|status]
Help: neoload docker --help
neoload docker up / down # start or delete container depend on configuration
neoload docker install/uninstall # add/remove hooks on run command to up when the controller zone is same and zone is empty. Shut down at the end of test running.
neoload docker forget # remove container from the launched list. That avoid to be removed with down command.
neoload docker clean # remove all container created by neoload-cli even if it was forgotten.
neoload docker status # display configuration and general status.
Options:
--no-wait Do not wait for controller and load generator in zones api
--help Show this message and exit.
Configuration:
- docker.controller.image (default: neotys/neoload-controller:latest)
- docker.controller.default_count (default: 1)
- docker.lg.image (default: neotys/neoload-loadgenerator:latest)
- docker.lg.default_count (default: 2)
- docker.zone (default: defaultzone)
```
NOTE: Docker CLI must be installed on the system using these commands. This will use
the Docker daemon, however it is configured. In a Docker-in-Docker context, this is inferred.
For local workstations, it is sufficient to install Docker Desktop or Docker for Mac.
## CLI configuration
```
neoload config ls
neoload config set docker.lg.default_count=1
Help: neoload config --help
```
The configuration allow customization of CLI behavior. For now, the configuration is used by the docker command (see above).
## Continuous Testing Examples
The main goal of the NeoLoad-CLI is to standardize the semantics of how load tests are executed across development, non-prod, and production environments.
While the above instructions could be run from a contributor workstation, they can easily be translated to various continuous build and deployment orchestration environments, as exampled:
- [Jenkins](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/jenkins)
- [GitHub](https://github.com/Neotys-Labs/neoload-cli/blob/master/examples/pipelines/github/neoload-github-actions-demo.yml)
- [Azure DevOps](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/azure_devops)
- [Gitlab](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/gitlab)
- [AWS](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/aws)
- [Bamboo](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/bamboo-specs)
NB: When chaining commands, the return code of the whole command is the return code of the **last command**. That's why you should not chain the two commands "run" and "test-results junitsla".
NOTE: When combining NeoLoad projects and YAML-based pipeline declarations, please see [Excluding files from the project upload] (#excluding-files-from-the-project-upload) to ensure that unecessary artifacts aren't included in the project upload process.
### Support for fast-fail based on SLAs ###
Not all tests succeed. Sometimes environments are down. Sometimes 3rd parties are surprisingly slow. You don't
want to wait for your build pipelines to conduct the whole test duration if it's possible to identify these
issues early. Applying proper SLAs to your tests allows you to monitor for errors and latency during the test.
Consider the following SLA:
```
sla_profiles:
- name: geo_3rdparty_sla
description: Avg Resp Time >=100ms >= 250ms for cached queries
thresholds:
- avg-resp-time warn >= 100ms fail >= 250ms per interval
- error-rate warn >= 5% fail >= 10% per test
```
If you want to fail the pipeline if either of these thresholds are exceeded over a certain percent of their times,
you must:
- run the test in 'detached' mode to allow for non-blocking execution of a test
- use the fastfail command to monitor for early signals to stop the test if SLAs are violated
- finally wait for the test results
To run the test in detached mode:
```
neoload run \
--detached
```
Then immediately afterwards, use the fastfail command:
```
neoload fastfail --max-failure 25 slas cur
```
In the above example, '25' represents the percent of times where the SLA was violated, such as 'on a particular
request with an SLA applied, 10 out of 50 times it was executed, the SLA failed'.
Finally, because the test was executed in non-blocking mode, you should wait for the final test result.
```
neoload wait cur
```
[An example for Jenkins pipeline is found here.](examples/pipelines/jenkins/Jenkinsfile_slafails)
## Packaging the CLI with Build Agents
Many of the above CI examples include a step to explicitly install the NeoLoad CLI as part of the
build steps. However, if you want the CLI baked into some build agent directly so that it
is ready for use during a job, here's a Docker example:
For Docker builds [See the test harness Alpine-based Dockerfile](https://github.com/Neotys-Labs/neoload-cli/blob/master/examples/docker/Dockerfile)
## IDE Integrations
Since most of what we do in an IDE is create/edit code, we're mostly interested in how to:
- make it easy to write API tests in YAML (automatic syntax validation)
- validate that tests do not contain unanticipated errors even at small scale
- dry-run small (smoke) load tests locally so that code check-ins will work in CI/pipeline tests
Since the latter two cases are already covered by command-line semantics, our primary focus
is to accelerate test authoring by providing NeoLoad as-code DSL (Domain-specific Language) validation
and in some cases editor auto-complete.
Status of IDE / editor integrations
| IDE / Editor | Syntax checks | Auto-complete | Setup steps
|:------------------:|:-------------:|:-------------:|:----------------:|
| Visual Studio Code | [x] | [x] | [see instructions](resources/ides/vscode_settings.json) |
| PyCharm | [x] | [x] | Mark 'neoload' directory as "Sources Root" |
## Contributing
Feel free to fork this repo, make changes, *test locally*, and create a pull request.
### Local Verification
#### Tests
As part of your testing, you should run the built-in test suite with the following command: \
NOTE: for testing from Mac, please change the PYTHONPATH separators below to colons (:) instead of semicolons (;).
```
pytest -v
pytest -v -m "not slow" # Skip slow tests that run tests
# Run on a real Neoload. Mocks are disabled
pytest -v --token <your_personal_token> --url https://neoload-api.saas.neotys.com/ --makelivecalls
# Run integration tests. This will run scripts with real neoload commands and assert json output with jq.
# This require at least 1 controller and 1 LG on the provided zone
./tests/integration/runAllScripts.sh <your_personal_token> --url https://neoload-api.saas.neotys.com/ defaultzone
```
Additionally, any contributions to the DSL validation functionality, such as on the JSON schema or the validate command, should execute the following tests locally before pushing to this repo:
```
./tests/neoload_projects/yaml_variants/validate_all.sh
```
This command executes a number of NEGATIVE tests to prove that changes to the JSON schema or validation process produce failures when their input is malformed in very specific ways (common mistakes).
### Release Process (managed by Neotys team)
#### Auto-generating Changelog
Before tagging a release, merged PRs should update the CHANGELOG.md via the following:
```
github_changelog_generator -u Neotys-Labs -p neoload-cli --token $GIT_CHANGELOG_GEN --exclude-tags-regex ".*(dev|rc).*" --add-sections '{"documentation":{"prefix":"**Documentation updates:**","labels":["documentation"]}}'
```
This utility is a [Ruby-based GEM](https://github.com/github-changelog-generator/github-changelog-generator) that can be installed (also used in CI/Actions) as follows:
```
gem install github_changelog_generator
```
#### Version management on pypi
Suppose X, Y, Z and N are integers, versions will be named as following on pypi: \
**Final release version = X.Y.Z** Example *1.4.0* Install it with ```pip install neoload``` \
**Release candidate version = X.Y.ZrcN** Example *1.5.0rc1* for the next candidate version. Install it with ```pip install neoload --pre``` \
**Development versions = X.Y.Z.devN** Example *1.4.0.dev1* for a development version based on the final release 1.4.0. Install it with ```pip install neoload==1.4.0.dev1```
Release candidate version contains all features planned and in testing by Quality Assurance team.
Development versions may contains work not planned by R&D and not tested by Quality Assurance team. They should always be based on an official release, not on the next release.
**Increment policy:**
- Minor version increment when major feature, for example new top-level command
- Fix version increment when executable changes, for example fixing an existing feature, or update a subcommand to an existing top-level command or update options to an existing command
- No release needed when the executable is not modified, for example when updating the following: automated CI tests, unit tests, README, Pipeline examples, report templates...
%package -n python3-neoload
Summary: A command-line native utility for launching and observing NeoLoad performance tests
Provides: python-neoload
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-neoload
# NeoLoad CLI [](https://github.com/Neotys-Labs/neoload-cli/actions?query=workflow%3A%22Python+package%22+branch%3A%22master%22)
## Overview
This command-line interface helps you launch and observe performance tests on the Neotys Web Platform. Since NeoLoad is very flexible to many deployment models (SaaS, self-hosted, cloud or local containers, etc.), configuration and test execution parameters depend on your licensing and infrastructure provisioning options.
| Property | Value |
| ---------------- | ---------------- |
| Maturity | Stable |
| Author | Neotys |
| License | [BSD 2-Clause "Simplified"](https://github.com/Neotys-Labs/neoload-cli/blob/master/LICENSE) |
| NeoLoad Licensing | License FREE edition, or Enterprise edition, or Professional |
| Supported versions | Tested with NeoLoad Web from version [2.3.2](https://neoload.saas.neotys.com)
| Download Binaries | See the [latest release on pypi](https://pypi.org/project/neoload)|
## TL;DR ... What
The goal of this guide is to demonstrate how you can:
1. create API load tests using code (YAML)
2. run them from any environment
3. visualize test results in web dashboards
## TL;DR ... How
```
pip3 install neoload
neoload login $NLW_TOKEN \
test-settings --zone $NLW_ZONE_DYNAMIC --lgs 5 --scenario sanityScenario createorpatch NewTest1 \
project --path tests/neoload_projects/example_1 upload NewTest1 \
run
```
NOTE: For Windows command line, replace the '\\' multi-line separators above with '^'
## Contents
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Login to Neoload Web](#login-to-neoload-web)
- [Setup a test](#setup-a-test)
- [Setup resources in Neoload Web](#setup-resources-in-neoload-web)
- [Define a test settings](#define-a-test-settings)
- [Upload a Neoload project](#upload-a-neoload-project)
- [Excluding files from the project upload] (#excluding-files-from-the-project-upload)
- [Run a test](#run-a-test)
- [Stop a running test](#stop-a-running-test)
- [Reporting](#reporting)
- [View results](#view-results)
- [Exporting Transaction CSV data](#exporting-transaction-CSV-data)
- [View zones](#view-zones)
- [Create local docker infrastructure to run a test](#create-local-docker-infrastructure-to-run-a-test)
- [Continuous Testing Examples](#continuous-testing-examples)
- [Support for fast-fail based on SLAs](#support-for-fast-fail-based-on-slas)
- [Packaging the CLI with Build Agents](#packaging-the-cli-with-build-agents)
- [IDE Integrations](#ide-integrations)
- [Contributing](#contributing)
## Prerequisites
The CLI requires **Python3**
- Download and install python3 for **Windows 10** from [Python.org](https://www.python.org/downloads/)
- Make sure you check the option 'Add Python to the environment variables' option
- Install pip: ```python -m pip install -U pip```
- Download and install python3 for **Mac OS X** from [Python.org - Python3 on Mac OS X](https://docs.python-guide.org/starting/install3/osx/)
Optional: Install Docker for hosting the test infra on your machine (this feature does not work with Docker for Windows).
## Installation
```
pip3 install neoload
neoload --help
```
NOTE: if you receive SSL download errors when running the above command, you may also need to install sources using the following command:
```
pip3 install certifi
```
## Login to Neoload Web
NeoLoad CLI defaults to using the NeoLoad Web APIs for most operations. That's why you need to login.
```
neoload login [TOKEN]
neoload login --url http://your-onpremise-neoload-api.com/ --workspace "Default Workspace" your-token
```
The CLI will connect by default to Neoload Web SaaS to lease license. \
For self-hosted enterprise license, you must specify the Neoload Web **Api url** with --url. \
\
The CLI stores data locally like api url, token, the workspace ID and the test ID you are working on. **The commands can be chained !**
```
neoload status # Displays stored data
```
## Setup a test
### Optionally Choose a workspace to work with
```
Usage: neoload workspaces [OPTIONS] [[ls|use]] [NAME_OR_ID]
Help: neoload workspaces --help
neoload workspaces use "Default Workspace"
```
Since Neoload Web 2.5 (August 2020), assets are scoped to workspaces.
The CLI allows you to choose your workspace at login or with the "use" sub-command, otherwise the "Default Workspace" is used.\
**/!\\** The zones are shared between workspaces.
### Setup resources in Neoload Web
Run a test requires an infrastructure that is defined in Neoload Web Zones section [(see documentation how to manage zones)](https://www.neotys.com/documents/doc/nlweb/latest/en/html/#27521.htm)
You must at least have either a dynamic or a static zone with one controller and one load generator. At First, you could add resources to the "Default zone" since the CLI use it by default.
### Define a Test
NeoLoad Web Tests contains the configuration of the test and the list of its Test Results. You can analyse transactions values over the latest Test Results to detect regressions.
```
Usage: neoload test-settings [OPTIONS] [[ls|create|put|patch|delete|use|createorpatch]] [NAME]
Help: neoload test-settings --help
neoload test-settings --zone defaultzone --lgs 5 --scenario sanityScenario create NewTest1
```
You can optionally define :
- Which scenario of the Neoload project to use
- The test-settings description
- The controller and load generator's zone to use (defaultzone is set by default)
- How many load generators to use for the zone (1 LG on the defaultzone is set by default)
- Advanced users who already have several zones with available resources in it can write : ```--zone my_controller_zone --lgs lg_zoneA:2,lg_zoneB:3```
To work with a specific test already created and be able to chain commands
```
neoload test-settings use NewTest1
neoload test-settings use 4a5e7707-75c0-4106-bbd4-68962ac7f2b3
```
### Upload a Neoload project
See basic projects examples on github [tests/neoload_projects folder](https://github.com/Neotys-Labs/neoload-cli/tree/master/tests/neoload_projects)
To upload a NeoLoad project zip file or a standalone as code file into a test-settings
```
Usage: neoload project [OPTIONS] [up|upload|meta] NAME_OR_ID
Help: neoload project --help
neoload project --path tests/neoload_projects/example_1/ upload
```
You must specify in which test the project will be uploaded:
* either by doing this command first
<pre><code>neoload test-settings use NewTest1</code></pre>
* or by adding the name or id of the test to the project command
<pre><code>neoload project --path tests/neoload_projects/example_1/ upload NewTest1</code></pre>
:warning: If the Test has no scenario or a scenario that does not exist in the project, then the scenario "Custom" will be selected by default (10 VUs for 5 minutes).
To Validate the syntax and schema of the as-code project yaml files
```
neoload validate sample_projects/example_1/default.yaml
```
### Excluding files from the project upload
If you are uploading a project directory that contains non NeoLoad as-code YAML files (such as .gitlab-ci.yml) you will need to create a .nlignore file (exactly the same as .gitignore) that excludes these files from the project upload process so that NeoLoad Web does not parse them and fail them as if they should be the NeoLoad DSL.
Please see Gitlab and Azure pipeline examples for more detail.
## Run a test
This command runs a test, it produces blocking, unbuffered output about test execution process, including readout of current data points.
At the end, displays the summary and the SLA passed & failed.
```
Usage: neoload run [OPTIONS] [NAME_OR_ID]
Help: neoload run --help
neoload run \ # Runs the currently used test-settings (see neoload status and neoload test-settings use)
--as-code default.yaml,slas/uat.yaml \
--scenario scenario1
--name "MyCustomTestName_${JOB_ID}" \
--description "A custom test description containing hashtags like #latest or #issueNum"
```
- detach option kick off a test and returns immediately. Logs are displayed in Neoload Web (follow the url).
- as-code option specify as-code yaml files to use for the test. They should already be uploaded with the project.
- scenario option specify the scenario name to run. The scenario must be declared in an as-code yaml or in the project, or else it will be the NeoLoad Web Custom scenario (10 VUs 5 minutes).
- Test result name and description can be customized to include CI specific details (e.g. CI job, build number...).
- Reservations can be used with either the reservationID or a reservation duration and a number of Virtual users.
If you are running in interactive console mode, the NeoLoad CLI will automatically open the system default browser to your live test results. \
When hitting Ctrl+C, the CLI will try to stop the test gracefully
### Stop a running test
```
neoload stop # Send the stop signal to the test and wait until it ends.
```
## Reporting
There is basic support in the NeoLoad CLI for viewing and exporting results.
### View results
```
Usage: neoload test-results [OPTIONS] [[ls|summary|junitsla|put|patch|delete|use]] [NAME]
Help: neoload test-results --help
neoload test-results ls # Lists test results .
neoload test-results use # Remember the test result you want to work on. .
neoload test-results summary # The Json result summary, with SLAs
neoload test-results junitsla # Output the summary in a JUnit xml file
```
Metadata on a test can be modified after the test is complete, such as name, description, and status.\
To filter test results based on project, scenario, or status:
```
neoload test-results --filter "project=MyProject;scenario=fullTest" ls
neoload test-results --filter "status=TERMINATED|qualityStatus=FAILED" ls
```
NOTE: you can use either a semicolon OR a pipe, but not both interchangeably in the same filter.
To work with a specific test result and be able to chain commands
```
neoload test-results use 4a5e7707-75c0-4106-bbd4-68962ac7f2b3
```
Detailed logs and results are available on Neoload Web. To get the url of the current result :
```
neoload logs-url # The URL to the test in Neoload Web
```
### The test-results vs. report subcommands
The 'test-results' subcommand is intended for direct operational queries against high-level API data.
The 'report' subcommand is intended to simplify not only common data exporting needs, but also provide
templating capabilities over a standard, correlated data model. In contrast to the test-results
subcommand, 'report' can be used to generate as well as transform test result data.
### Exporting Transaction CSV data
```
Usage: neoload report [OPTIONS] [NAME]
Help: neoload report --help
neoload report --template builtin:transactions-csv "test_result_name_or_id" > temp.csv
```
### Filtering export data by timespan
In many load tests, ramp-up and spin-down time is considered irrelevant to calculate into aggregate statistics,
such as how when warming up, systems may produce higher-than-expected latencies until a steady state is reached.
Therefore, the NeoLoad CLI allows for export of particular time ranges by providing a timespan filter.
```
neoload report --template builtin:transactions-csv --filter "timespan=5m-95%"
neoload report --template builtin:transactions-csv --filter "timespan=15%"
neoload report --template builtin:transactions-csv --filter "timespan=-90%"
```
Timespan format is [Time], then '-' representing to, then another [Time]. Time format can
be either a human readable duration or percentage of overall test duration.
Human readable time duration format is hour|minute|second such as '1h5m30s' or a sub-portion such as '5m'.
Omitting the end [Time] segment will filter results beginning with the time specified to the end of the test.
Similarly, ommiting the start [Time] segment will filter results beginning with the start of the test
to the end time specified.
### Filtering export data by element
It is often useful to narrow analysis and statistics to a particular group of activities, such as
Login processes across multiple workflows (user paths) or other common key business transactions.
Therefore, the NeoLoad CLI allows for exports of specific transcations whose name, parent, or User Path name
matches specific values or patterns.
```
neoload report --template builtin:transactions-csv --filter "elements=Login"
```
You can filter to specific transactions or requests by specifying 'elements' and then a pipe-delimited list
of element GUIDs, full names, or partial name matches. This can also include python-compliant regular expressions.
### Combining timespan and element filters
```
neoload report --template builtin:transactions-csv --filter "timespan=50%-95%;elements=AddToCart"
```
Both timespan and elements filters can be combined in order to get statistics for specific elements
within a precise portion of the test duration. Per the example above, transaction data will be computed
for elements that have 'AddToCart' somewhere in their name, user path, or parent element and calculate
aggregates based on data starting from halfway through the test up to just about the very end.
### Exporting All Test Data and Using Custom Templates
If you would like to use multiple templates to create separate output files for specific test data,
you should dump the test result data using the standard JSON scheme first:
```
neoload report --out-file ~/Downloads/temp.json
```
NOTE: by default, this queries all entity data in test results and may cause multiple API calls
to occur depending on the structure of the user paths and monitoring data in the test result set.
Then you can produce multiple output files from a single data snapshot:
```
neoload report --json-in ~/Downloads/temp.json \
--template builtin:transactions-csv \
--out-file ~/Downloads/temp.csv
neoload report --json-in ~/Downloads/temp.json \
--template /path/to/a/jinja/template.j2 \
--out-file ~/Downloads/temp.html
```
NOTE: built-in reports produce a reduced-scope JSON data model and are therefore faster
that exporting all test data for various templates and output specs.
## View zones
```
neoload zones --human
Help: neoload zones --help
```
Display in a human-readable way the list of all static and dynamic zones registered on Neoload Web, and the resources attached (controllers and load generators).
## Create local docker infrastructure to run a test [EXPERIMENTAL]
***WARNING: Docker features are not officially supported by Neotys as they rely heavily on your own Docker setup and environment. This command is only for local/dev test scenarios to simplify infrastructure requirements.***
In certain environments, such as on a local dev workstation or in a Docker-in-Docker CI build node, it is useful
to "bring your own infrastructure". In other words, when you don't already have a controller and load generators
available in a zone, you can spin some up using Docker before the test starts. An example of an all-on-one approach:
```
neoload docker install
neoload login $NLW_TOKEN \
test-settings --lgs 2 --scenario sanityScenario create NewTest1 \
project --path tests/neoload_projects/example_1 upload \
run
```
What the 'docker install' CLI add step in run command. This step is triggered when zone of controller the test-settings is same than docker.zone (default is defaultzone).
When it is triggered, it launches one controller with number of LG test-settings in docker.zone.
At the end of the run the containers are removed.
The docker container can be launched manually with neoload docker up command and removed with neoload docker down command.
In this case the number of controller and lg is defined by configuration respectively docker.controller.default_count (default: 1) and
docker.lg.default_count (default: 2).
```
Usage: neoload docker [OPTIONS] [up|down|clean|forget|install|uninstall|status]
Help: neoload docker --help
neoload docker up / down # start or delete container depend on configuration
neoload docker install/uninstall # add/remove hooks on run command to up when the controller zone is same and zone is empty. Shut down at the end of test running.
neoload docker forget # remove container from the launched list. That avoid to be removed with down command.
neoload docker clean # remove all container created by neoload-cli even if it was forgotten.
neoload docker status # display configuration and general status.
Options:
--no-wait Do not wait for controller and load generator in zones api
--help Show this message and exit.
Configuration:
- docker.controller.image (default: neotys/neoload-controller:latest)
- docker.controller.default_count (default: 1)
- docker.lg.image (default: neotys/neoload-loadgenerator:latest)
- docker.lg.default_count (default: 2)
- docker.zone (default: defaultzone)
```
NOTE: Docker CLI must be installed on the system using these commands. This will use
the Docker daemon, however it is configured. In a Docker-in-Docker context, this is inferred.
For local workstations, it is sufficient to install Docker Desktop or Docker for Mac.
## CLI configuration
```
neoload config ls
neoload config set docker.lg.default_count=1
Help: neoload config --help
```
The configuration allow customization of CLI behavior. For now, the configuration is used by the docker command (see above).
## Continuous Testing Examples
The main goal of the NeoLoad-CLI is to standardize the semantics of how load tests are executed across development, non-prod, and production environments.
While the above instructions could be run from a contributor workstation, they can easily be translated to various continuous build and deployment orchestration environments, as exampled:
- [Jenkins](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/jenkins)
- [GitHub](https://github.com/Neotys-Labs/neoload-cli/blob/master/examples/pipelines/github/neoload-github-actions-demo.yml)
- [Azure DevOps](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/azure_devops)
- [Gitlab](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/gitlab)
- [AWS](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/aws)
- [Bamboo](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/bamboo-specs)
NB: When chaining commands, the return code of the whole command is the return code of the **last command**. That's why you should not chain the two commands "run" and "test-results junitsla".
NOTE: When combining NeoLoad projects and YAML-based pipeline declarations, please see [Excluding files from the project upload] (#excluding-files-from-the-project-upload) to ensure that unecessary artifacts aren't included in the project upload process.
### Support for fast-fail based on SLAs ###
Not all tests succeed. Sometimes environments are down. Sometimes 3rd parties are surprisingly slow. You don't
want to wait for your build pipelines to conduct the whole test duration if it's possible to identify these
issues early. Applying proper SLAs to your tests allows you to monitor for errors and latency during the test.
Consider the following SLA:
```
sla_profiles:
- name: geo_3rdparty_sla
description: Avg Resp Time >=100ms >= 250ms for cached queries
thresholds:
- avg-resp-time warn >= 100ms fail >= 250ms per interval
- error-rate warn >= 5% fail >= 10% per test
```
If you want to fail the pipeline if either of these thresholds are exceeded over a certain percent of their times,
you must:
- run the test in 'detached' mode to allow for non-blocking execution of a test
- use the fastfail command to monitor for early signals to stop the test if SLAs are violated
- finally wait for the test results
To run the test in detached mode:
```
neoload run \
--detached
```
Then immediately afterwards, use the fastfail command:
```
neoload fastfail --max-failure 25 slas cur
```
In the above example, '25' represents the percent of times where the SLA was violated, such as 'on a particular
request with an SLA applied, 10 out of 50 times it was executed, the SLA failed'.
Finally, because the test was executed in non-blocking mode, you should wait for the final test result.
```
neoload wait cur
```
[An example for Jenkins pipeline is found here.](examples/pipelines/jenkins/Jenkinsfile_slafails)
## Packaging the CLI with Build Agents
Many of the above CI examples include a step to explicitly install the NeoLoad CLI as part of the
build steps. However, if you want the CLI baked into some build agent directly so that it
is ready for use during a job, here's a Docker example:
For Docker builds [See the test harness Alpine-based Dockerfile](https://github.com/Neotys-Labs/neoload-cli/blob/master/examples/docker/Dockerfile)
## IDE Integrations
Since most of what we do in an IDE is create/edit code, we're mostly interested in how to:
- make it easy to write API tests in YAML (automatic syntax validation)
- validate that tests do not contain unanticipated errors even at small scale
- dry-run small (smoke) load tests locally so that code check-ins will work in CI/pipeline tests
Since the latter two cases are already covered by command-line semantics, our primary focus
is to accelerate test authoring by providing NeoLoad as-code DSL (Domain-specific Language) validation
and in some cases editor auto-complete.
Status of IDE / editor integrations
| IDE / Editor | Syntax checks | Auto-complete | Setup steps
|:------------------:|:-------------:|:-------------:|:----------------:|
| Visual Studio Code | [x] | [x] | [see instructions](resources/ides/vscode_settings.json) |
| PyCharm | [x] | [x] | Mark 'neoload' directory as "Sources Root" |
## Contributing
Feel free to fork this repo, make changes, *test locally*, and create a pull request.
### Local Verification
#### Tests
As part of your testing, you should run the built-in test suite with the following command: \
NOTE: for testing from Mac, please change the PYTHONPATH separators below to colons (:) instead of semicolons (;).
```
pytest -v
pytest -v -m "not slow" # Skip slow tests that run tests
# Run on a real Neoload. Mocks are disabled
pytest -v --token <your_personal_token> --url https://neoload-api.saas.neotys.com/ --makelivecalls
# Run integration tests. This will run scripts with real neoload commands and assert json output with jq.
# This require at least 1 controller and 1 LG on the provided zone
./tests/integration/runAllScripts.sh <your_personal_token> --url https://neoload-api.saas.neotys.com/ defaultzone
```
Additionally, any contributions to the DSL validation functionality, such as on the JSON schema or the validate command, should execute the following tests locally before pushing to this repo:
```
./tests/neoload_projects/yaml_variants/validate_all.sh
```
This command executes a number of NEGATIVE tests to prove that changes to the JSON schema or validation process produce failures when their input is malformed in very specific ways (common mistakes).
### Release Process (managed by Neotys team)
#### Auto-generating Changelog
Before tagging a release, merged PRs should update the CHANGELOG.md via the following:
```
github_changelog_generator -u Neotys-Labs -p neoload-cli --token $GIT_CHANGELOG_GEN --exclude-tags-regex ".*(dev|rc).*" --add-sections '{"documentation":{"prefix":"**Documentation updates:**","labels":["documentation"]}}'
```
This utility is a [Ruby-based GEM](https://github.com/github-changelog-generator/github-changelog-generator) that can be installed (also used in CI/Actions) as follows:
```
gem install github_changelog_generator
```
#### Version management on pypi
Suppose X, Y, Z and N are integers, versions will be named as following on pypi: \
**Final release version = X.Y.Z** Example *1.4.0* Install it with ```pip install neoload``` \
**Release candidate version = X.Y.ZrcN** Example *1.5.0rc1* for the next candidate version. Install it with ```pip install neoload --pre``` \
**Development versions = X.Y.Z.devN** Example *1.4.0.dev1* for a development version based on the final release 1.4.0. Install it with ```pip install neoload==1.4.0.dev1```
Release candidate version contains all features planned and in testing by Quality Assurance team.
Development versions may contains work not planned by R&D and not tested by Quality Assurance team. They should always be based on an official release, not on the next release.
**Increment policy:**
- Minor version increment when major feature, for example new top-level command
- Fix version increment when executable changes, for example fixing an existing feature, or update a subcommand to an existing top-level command or update options to an existing command
- No release needed when the executable is not modified, for example when updating the following: automated CI tests, unit tests, README, Pipeline examples, report templates...
%package help
Summary: Development documents and examples for neoload
Provides: python3-neoload-doc
%description help
# NeoLoad CLI [](https://github.com/Neotys-Labs/neoload-cli/actions?query=workflow%3A%22Python+package%22+branch%3A%22master%22)
## Overview
This command-line interface helps you launch and observe performance tests on the Neotys Web Platform. Since NeoLoad is very flexible to many deployment models (SaaS, self-hosted, cloud or local containers, etc.), configuration and test execution parameters depend on your licensing and infrastructure provisioning options.
| Property | Value |
| ---------------- | ---------------- |
| Maturity | Stable |
| Author | Neotys |
| License | [BSD 2-Clause "Simplified"](https://github.com/Neotys-Labs/neoload-cli/blob/master/LICENSE) |
| NeoLoad Licensing | License FREE edition, or Enterprise edition, or Professional |
| Supported versions | Tested with NeoLoad Web from version [2.3.2](https://neoload.saas.neotys.com)
| Download Binaries | See the [latest release on pypi](https://pypi.org/project/neoload)|
## TL;DR ... What
The goal of this guide is to demonstrate how you can:
1. create API load tests using code (YAML)
2. run them from any environment
3. visualize test results in web dashboards
## TL;DR ... How
```
pip3 install neoload
neoload login $NLW_TOKEN \
test-settings --zone $NLW_ZONE_DYNAMIC --lgs 5 --scenario sanityScenario createorpatch NewTest1 \
project --path tests/neoload_projects/example_1 upload NewTest1 \
run
```
NOTE: For Windows command line, replace the '\\' multi-line separators above with '^'
## Contents
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Login to Neoload Web](#login-to-neoload-web)
- [Setup a test](#setup-a-test)
- [Setup resources in Neoload Web](#setup-resources-in-neoload-web)
- [Define a test settings](#define-a-test-settings)
- [Upload a Neoload project](#upload-a-neoload-project)
- [Excluding files from the project upload] (#excluding-files-from-the-project-upload)
- [Run a test](#run-a-test)
- [Stop a running test](#stop-a-running-test)
- [Reporting](#reporting)
- [View results](#view-results)
- [Exporting Transaction CSV data](#exporting-transaction-CSV-data)
- [View zones](#view-zones)
- [Create local docker infrastructure to run a test](#create-local-docker-infrastructure-to-run-a-test)
- [Continuous Testing Examples](#continuous-testing-examples)
- [Support for fast-fail based on SLAs](#support-for-fast-fail-based-on-slas)
- [Packaging the CLI with Build Agents](#packaging-the-cli-with-build-agents)
- [IDE Integrations](#ide-integrations)
- [Contributing](#contributing)
## Prerequisites
The CLI requires **Python3**
- Download and install python3 for **Windows 10** from [Python.org](https://www.python.org/downloads/)
- Make sure you check the option 'Add Python to the environment variables' option
- Install pip: ```python -m pip install -U pip```
- Download and install python3 for **Mac OS X** from [Python.org - Python3 on Mac OS X](https://docs.python-guide.org/starting/install3/osx/)
Optional: Install Docker for hosting the test infra on your machine (this feature does not work with Docker for Windows).
## Installation
```
pip3 install neoload
neoload --help
```
NOTE: if you receive SSL download errors when running the above command, you may also need to install sources using the following command:
```
pip3 install certifi
```
## Login to Neoload Web
NeoLoad CLI defaults to using the NeoLoad Web APIs for most operations. That's why you need to login.
```
neoload login [TOKEN]
neoload login --url http://your-onpremise-neoload-api.com/ --workspace "Default Workspace" your-token
```
The CLI will connect by default to Neoload Web SaaS to lease license. \
For self-hosted enterprise license, you must specify the Neoload Web **Api url** with --url. \
\
The CLI stores data locally like api url, token, the workspace ID and the test ID you are working on. **The commands can be chained !**
```
neoload status # Displays stored data
```
## Setup a test
### Optionally Choose a workspace to work with
```
Usage: neoload workspaces [OPTIONS] [[ls|use]] [NAME_OR_ID]
Help: neoload workspaces --help
neoload workspaces use "Default Workspace"
```
Since Neoload Web 2.5 (August 2020), assets are scoped to workspaces.
The CLI allows you to choose your workspace at login or with the "use" sub-command, otherwise the "Default Workspace" is used.\
**/!\\** The zones are shared between workspaces.
### Setup resources in Neoload Web
Run a test requires an infrastructure that is defined in Neoload Web Zones section [(see documentation how to manage zones)](https://www.neotys.com/documents/doc/nlweb/latest/en/html/#27521.htm)
You must at least have either a dynamic or a static zone with one controller and one load generator. At First, you could add resources to the "Default zone" since the CLI use it by default.
### Define a Test
NeoLoad Web Tests contains the configuration of the test and the list of its Test Results. You can analyse transactions values over the latest Test Results to detect regressions.
```
Usage: neoload test-settings [OPTIONS] [[ls|create|put|patch|delete|use|createorpatch]] [NAME]
Help: neoload test-settings --help
neoload test-settings --zone defaultzone --lgs 5 --scenario sanityScenario create NewTest1
```
You can optionally define :
- Which scenario of the Neoload project to use
- The test-settings description
- The controller and load generator's zone to use (defaultzone is set by default)
- How many load generators to use for the zone (1 LG on the defaultzone is set by default)
- Advanced users who already have several zones with available resources in it can write : ```--zone my_controller_zone --lgs lg_zoneA:2,lg_zoneB:3```
To work with a specific test already created and be able to chain commands
```
neoload test-settings use NewTest1
neoload test-settings use 4a5e7707-75c0-4106-bbd4-68962ac7f2b3
```
### Upload a Neoload project
See basic projects examples on github [tests/neoload_projects folder](https://github.com/Neotys-Labs/neoload-cli/tree/master/tests/neoload_projects)
To upload a NeoLoad project zip file or a standalone as code file into a test-settings
```
Usage: neoload project [OPTIONS] [up|upload|meta] NAME_OR_ID
Help: neoload project --help
neoload project --path tests/neoload_projects/example_1/ upload
```
You must specify in which test the project will be uploaded:
* either by doing this command first
<pre><code>neoload test-settings use NewTest1</code></pre>
* or by adding the name or id of the test to the project command
<pre><code>neoload project --path tests/neoload_projects/example_1/ upload NewTest1</code></pre>
:warning: If the Test has no scenario or a scenario that does not exist in the project, then the scenario "Custom" will be selected by default (10 VUs for 5 minutes).
To Validate the syntax and schema of the as-code project yaml files
```
neoload validate sample_projects/example_1/default.yaml
```
### Excluding files from the project upload
If you are uploading a project directory that contains non NeoLoad as-code YAML files (such as .gitlab-ci.yml) you will need to create a .nlignore file (exactly the same as .gitignore) that excludes these files from the project upload process so that NeoLoad Web does not parse them and fail them as if they should be the NeoLoad DSL.
Please see Gitlab and Azure pipeline examples for more detail.
## Run a test
This command runs a test, it produces blocking, unbuffered output about test execution process, including readout of current data points.
At the end, displays the summary and the SLA passed & failed.
```
Usage: neoload run [OPTIONS] [NAME_OR_ID]
Help: neoload run --help
neoload run \ # Runs the currently used test-settings (see neoload status and neoload test-settings use)
--as-code default.yaml,slas/uat.yaml \
--scenario scenario1
--name "MyCustomTestName_${JOB_ID}" \
--description "A custom test description containing hashtags like #latest or #issueNum"
```
- detach option kick off a test and returns immediately. Logs are displayed in Neoload Web (follow the url).
- as-code option specify as-code yaml files to use for the test. They should already be uploaded with the project.
- scenario option specify the scenario name to run. The scenario must be declared in an as-code yaml or in the project, or else it will be the NeoLoad Web Custom scenario (10 VUs 5 minutes).
- Test result name and description can be customized to include CI specific details (e.g. CI job, build number...).
- Reservations can be used with either the reservationID or a reservation duration and a number of Virtual users.
If you are running in interactive console mode, the NeoLoad CLI will automatically open the system default browser to your live test results. \
When hitting Ctrl+C, the CLI will try to stop the test gracefully
### Stop a running test
```
neoload stop # Send the stop signal to the test and wait until it ends.
```
## Reporting
There is basic support in the NeoLoad CLI for viewing and exporting results.
### View results
```
Usage: neoload test-results [OPTIONS] [[ls|summary|junitsla|put|patch|delete|use]] [NAME]
Help: neoload test-results --help
neoload test-results ls # Lists test results .
neoload test-results use # Remember the test result you want to work on. .
neoload test-results summary # The Json result summary, with SLAs
neoload test-results junitsla # Output the summary in a JUnit xml file
```
Metadata on a test can be modified after the test is complete, such as name, description, and status.\
To filter test results based on project, scenario, or status:
```
neoload test-results --filter "project=MyProject;scenario=fullTest" ls
neoload test-results --filter "status=TERMINATED|qualityStatus=FAILED" ls
```
NOTE: you can use either a semicolon OR a pipe, but not both interchangeably in the same filter.
To work with a specific test result and be able to chain commands
```
neoload test-results use 4a5e7707-75c0-4106-bbd4-68962ac7f2b3
```
Detailed logs and results are available on Neoload Web. To get the url of the current result :
```
neoload logs-url # The URL to the test in Neoload Web
```
### The test-results vs. report subcommands
The 'test-results' subcommand is intended for direct operational queries against high-level API data.
The 'report' subcommand is intended to simplify not only common data exporting needs, but also provide
templating capabilities over a standard, correlated data model. In contrast to the test-results
subcommand, 'report' can be used to generate as well as transform test result data.
### Exporting Transaction CSV data
```
Usage: neoload report [OPTIONS] [NAME]
Help: neoload report --help
neoload report --template builtin:transactions-csv "test_result_name_or_id" > temp.csv
```
### Filtering export data by timespan
In many load tests, ramp-up and spin-down time is considered irrelevant to calculate into aggregate statistics,
such as how when warming up, systems may produce higher-than-expected latencies until a steady state is reached.
Therefore, the NeoLoad CLI allows for export of particular time ranges by providing a timespan filter.
```
neoload report --template builtin:transactions-csv --filter "timespan=5m-95%"
neoload report --template builtin:transactions-csv --filter "timespan=15%"
neoload report --template builtin:transactions-csv --filter "timespan=-90%"
```
Timespan format is [Time], then '-' representing to, then another [Time]. Time format can
be either a human readable duration or percentage of overall test duration.
Human readable time duration format is hour|minute|second such as '1h5m30s' or a sub-portion such as '5m'.
Omitting the end [Time] segment will filter results beginning with the time specified to the end of the test.
Similarly, ommiting the start [Time] segment will filter results beginning with the start of the test
to the end time specified.
### Filtering export data by element
It is often useful to narrow analysis and statistics to a particular group of activities, such as
Login processes across multiple workflows (user paths) or other common key business transactions.
Therefore, the NeoLoad CLI allows for exports of specific transcations whose name, parent, or User Path name
matches specific values or patterns.
```
neoload report --template builtin:transactions-csv --filter "elements=Login"
```
You can filter to specific transactions or requests by specifying 'elements' and then a pipe-delimited list
of element GUIDs, full names, or partial name matches. This can also include python-compliant regular expressions.
### Combining timespan and element filters
```
neoload report --template builtin:transactions-csv --filter "timespan=50%-95%;elements=AddToCart"
```
Both timespan and elements filters can be combined in order to get statistics for specific elements
within a precise portion of the test duration. Per the example above, transaction data will be computed
for elements that have 'AddToCart' somewhere in their name, user path, or parent element and calculate
aggregates based on data starting from halfway through the test up to just about the very end.
### Exporting All Test Data and Using Custom Templates
If you would like to use multiple templates to create separate output files for specific test data,
you should dump the test result data using the standard JSON scheme first:
```
neoload report --out-file ~/Downloads/temp.json
```
NOTE: by default, this queries all entity data in test results and may cause multiple API calls
to occur depending on the structure of the user paths and monitoring data in the test result set.
Then you can produce multiple output files from a single data snapshot:
```
neoload report --json-in ~/Downloads/temp.json \
--template builtin:transactions-csv \
--out-file ~/Downloads/temp.csv
neoload report --json-in ~/Downloads/temp.json \
--template /path/to/a/jinja/template.j2 \
--out-file ~/Downloads/temp.html
```
NOTE: built-in reports produce a reduced-scope JSON data model and are therefore faster
that exporting all test data for various templates and output specs.
## View zones
```
neoload zones --human
Help: neoload zones --help
```
Display in a human-readable way the list of all static and dynamic zones registered on Neoload Web, and the resources attached (controllers and load generators).
## Create local docker infrastructure to run a test [EXPERIMENTAL]
***WARNING: Docker features are not officially supported by Neotys as they rely heavily on your own Docker setup and environment. This command is only for local/dev test scenarios to simplify infrastructure requirements.***
In certain environments, such as on a local dev workstation or in a Docker-in-Docker CI build node, it is useful
to "bring your own infrastructure". In other words, when you don't already have a controller and load generators
available in a zone, you can spin some up using Docker before the test starts. An example of an all-on-one approach:
```
neoload docker install
neoload login $NLW_TOKEN \
test-settings --lgs 2 --scenario sanityScenario create NewTest1 \
project --path tests/neoload_projects/example_1 upload \
run
```
What the 'docker install' CLI add step in run command. This step is triggered when zone of controller the test-settings is same than docker.zone (default is defaultzone).
When it is triggered, it launches one controller with number of LG test-settings in docker.zone.
At the end of the run the containers are removed.
The docker container can be launched manually with neoload docker up command and removed with neoload docker down command.
In this case the number of controller and lg is defined by configuration respectively docker.controller.default_count (default: 1) and
docker.lg.default_count (default: 2).
```
Usage: neoload docker [OPTIONS] [up|down|clean|forget|install|uninstall|status]
Help: neoload docker --help
neoload docker up / down # start or delete container depend on configuration
neoload docker install/uninstall # add/remove hooks on run command to up when the controller zone is same and zone is empty. Shut down at the end of test running.
neoload docker forget # remove container from the launched list. That avoid to be removed with down command.
neoload docker clean # remove all container created by neoload-cli even if it was forgotten.
neoload docker status # display configuration and general status.
Options:
--no-wait Do not wait for controller and load generator in zones api
--help Show this message and exit.
Configuration:
- docker.controller.image (default: neotys/neoload-controller:latest)
- docker.controller.default_count (default: 1)
- docker.lg.image (default: neotys/neoload-loadgenerator:latest)
- docker.lg.default_count (default: 2)
- docker.zone (default: defaultzone)
```
NOTE: Docker CLI must be installed on the system using these commands. This will use
the Docker daemon, however it is configured. In a Docker-in-Docker context, this is inferred.
For local workstations, it is sufficient to install Docker Desktop or Docker for Mac.
## CLI configuration
```
neoload config ls
neoload config set docker.lg.default_count=1
Help: neoload config --help
```
The configuration allow customization of CLI behavior. For now, the configuration is used by the docker command (see above).
## Continuous Testing Examples
The main goal of the NeoLoad-CLI is to standardize the semantics of how load tests are executed across development, non-prod, and production environments.
While the above instructions could be run from a contributor workstation, they can easily be translated to various continuous build and deployment orchestration environments, as exampled:
- [Jenkins](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/jenkins)
- [GitHub](https://github.com/Neotys-Labs/neoload-cli/blob/master/examples/pipelines/github/neoload-github-actions-demo.yml)
- [Azure DevOps](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/azure_devops)
- [Gitlab](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/gitlab)
- [AWS](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/aws)
- [Bamboo](https://github.com/Neotys-Labs/neoload-cli/tree/master/examples/pipelines/bamboo-specs)
NB: When chaining commands, the return code of the whole command is the return code of the **last command**. That's why you should not chain the two commands "run" and "test-results junitsla".
NOTE: When combining NeoLoad projects and YAML-based pipeline declarations, please see [Excluding files from the project upload] (#excluding-files-from-the-project-upload) to ensure that unecessary artifacts aren't included in the project upload process.
### Support for fast-fail based on SLAs ###
Not all tests succeed. Sometimes environments are down. Sometimes 3rd parties are surprisingly slow. You don't
want to wait for your build pipelines to conduct the whole test duration if it's possible to identify these
issues early. Applying proper SLAs to your tests allows you to monitor for errors and latency during the test.
Consider the following SLA:
```
sla_profiles:
- name: geo_3rdparty_sla
description: Avg Resp Time >=100ms >= 250ms for cached queries
thresholds:
- avg-resp-time warn >= 100ms fail >= 250ms per interval
- error-rate warn >= 5% fail >= 10% per test
```
If you want to fail the pipeline if either of these thresholds are exceeded over a certain percent of their times,
you must:
- run the test in 'detached' mode to allow for non-blocking execution of a test
- use the fastfail command to monitor for early signals to stop the test if SLAs are violated
- finally wait for the test results
To run the test in detached mode:
```
neoload run \
--detached
```
Then immediately afterwards, use the fastfail command:
```
neoload fastfail --max-failure 25 slas cur
```
In the above example, '25' represents the percent of times where the SLA was violated, such as 'on a particular
request with an SLA applied, 10 out of 50 times it was executed, the SLA failed'.
Finally, because the test was executed in non-blocking mode, you should wait for the final test result.
```
neoload wait cur
```
[An example for Jenkins pipeline is found here.](examples/pipelines/jenkins/Jenkinsfile_slafails)
## Packaging the CLI with Build Agents
Many of the above CI examples include a step to explicitly install the NeoLoad CLI as part of the
build steps. However, if you want the CLI baked into some build agent directly so that it
is ready for use during a job, here's a Docker example:
For Docker builds [See the test harness Alpine-based Dockerfile](https://github.com/Neotys-Labs/neoload-cli/blob/master/examples/docker/Dockerfile)
## IDE Integrations
Since most of what we do in an IDE is create/edit code, we're mostly interested in how to:
- make it easy to write API tests in YAML (automatic syntax validation)
- validate that tests do not contain unanticipated errors even at small scale
- dry-run small (smoke) load tests locally so that code check-ins will work in CI/pipeline tests
Since the latter two cases are already covered by command-line semantics, our primary focus
is to accelerate test authoring by providing NeoLoad as-code DSL (Domain-specific Language) validation
and in some cases editor auto-complete.
Status of IDE / editor integrations
| IDE / Editor | Syntax checks | Auto-complete | Setup steps
|:------------------:|:-------------:|:-------------:|:----------------:|
| Visual Studio Code | [x] | [x] | [see instructions](resources/ides/vscode_settings.json) |
| PyCharm | [x] | [x] | Mark 'neoload' directory as "Sources Root" |
## Contributing
Feel free to fork this repo, make changes, *test locally*, and create a pull request.
### Local Verification
#### Tests
As part of your testing, you should run the built-in test suite with the following command: \
NOTE: for testing from Mac, please change the PYTHONPATH separators below to colons (:) instead of semicolons (;).
```
pytest -v
pytest -v -m "not slow" # Skip slow tests that run tests
# Run on a real Neoload. Mocks are disabled
pytest -v --token <your_personal_token> --url https://neoload-api.saas.neotys.com/ --makelivecalls
# Run integration tests. This will run scripts with real neoload commands and assert json output with jq.
# This require at least 1 controller and 1 LG on the provided zone
./tests/integration/runAllScripts.sh <your_personal_token> --url https://neoload-api.saas.neotys.com/ defaultzone
```
Additionally, any contributions to the DSL validation functionality, such as on the JSON schema or the validate command, should execute the following tests locally before pushing to this repo:
```
./tests/neoload_projects/yaml_variants/validate_all.sh
```
This command executes a number of NEGATIVE tests to prove that changes to the JSON schema or validation process produce failures when their input is malformed in very specific ways (common mistakes).
### Release Process (managed by Neotys team)
#### Auto-generating Changelog
Before tagging a release, merged PRs should update the CHANGELOG.md via the following:
```
github_changelog_generator -u Neotys-Labs -p neoload-cli --token $GIT_CHANGELOG_GEN --exclude-tags-regex ".*(dev|rc).*" --add-sections '{"documentation":{"prefix":"**Documentation updates:**","labels":["documentation"]}}'
```
This utility is a [Ruby-based GEM](https://github.com/github-changelog-generator/github-changelog-generator) that can be installed (also used in CI/Actions) as follows:
```
gem install github_changelog_generator
```
#### Version management on pypi
Suppose X, Y, Z and N are integers, versions will be named as following on pypi: \
**Final release version = X.Y.Z** Example *1.4.0* Install it with ```pip install neoload``` \
**Release candidate version = X.Y.ZrcN** Example *1.5.0rc1* for the next candidate version. Install it with ```pip install neoload --pre``` \
**Development versions = X.Y.Z.devN** Example *1.4.0.dev1* for a development version based on the final release 1.4.0. Install it with ```pip install neoload==1.4.0.dev1```
Release candidate version contains all features planned and in testing by Quality Assurance team.
Development versions may contains work not planned by R&D and not tested by Quality Assurance team. They should always be based on an official release, not on the next release.
**Increment policy:**
- Minor version increment when major feature, for example new top-level command
- Fix version increment when executable changes, for example fixing an existing feature, or update a subcommand to an existing top-level command or update options to an existing command
- No release needed when the executable is not modified, for example when updating the following: automated CI tests, unit tests, README, Pipeline examples, report templates...
%prep
%autosetup -n neoload-1.3.12
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-neoload -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.12-1
- Package Spec generated
|