harmonyc 0.1.0 → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 harmony-ac
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # Harmony Code
2
+
3
+ A simple model-based test design tool that generates Cucumber feature files.
4
+
5
+ ## Setup
6
+
7
+ You need to have Node.js installed. Then you can install Harmony Code in your project folder by:
8
+
9
+ ```bash
10
+ npm install harmonyc
11
+ ```
12
+
13
+ And then run it for all `.harmony` files in your `src` folder:
14
+
15
+ ```bash
16
+ harmonyc src/**/*.harmony
17
+ ```
18
+
19
+ This will generate `.feature` files next to the `.harmony` files.
20
+
21
+ ## Syntax
22
+
23
+ A `.harmony` file is a text file with a syntax that looks like this:
24
+
25
+ ```
26
+ Products API:
27
+ + Create:
28
+ + Anonymous:
29
+ - create product => error: unauthorized
30
+ + Admin:
31
+ - authenticate admin
32
+ - create product => product created
33
+ - Delete:
34
+ - delete product => product deleted
35
+ ```
36
+
37
+ Compiling this with `harmonyc` will generate this `.feature` file:
38
+
39
+ ```gherkin
40
+ Feature: change_password
41
+
42
+ Scenario: T1 - Products API - Create - Anonymous
43
+ When create product
44
+ Then error: unauthorized
45
+
46
+ Scenario: T2 - Products API - Create - Admin - Delete
47
+ When authenticate admin
48
+ When create product
49
+ Then product created
50
+ When delete product
51
+ Then product deleted
52
+ ```
53
+
54
+ ### Indentation
55
+
56
+ The lines of a file are nodes of a tree. The tree is specified with the indentation of the lines, which is n times 2 spaces and a `+` or `-` with one more space. The `+` or `-` sign is considered to be part of the indentation.
57
+
58
+ ### Sequences and forks
59
+
60
+ `-` means a sequence: the node follows the previous sibling node and its descendants.
61
+
62
+ `+` means a fork: the node directly follows its parent node. All siblings with `+` are separate branches, they will generate separate scenarios.
63
+
64
+ ### Labels
65
+
66
+ Label are nodes that end with `:`. You can use them to structure your test design.
67
+ They are not included in the test case, but the test case name is generated from the labels.
68
+
69
+ ### Comments
70
+
71
+ Lines starting with `#` or `//` are comments and are ignored.
72
+
73
+ ### Steps
74
+
75
+ All other lines are steps. A step consists of an action, and one or more responses denoted by `=>`.
76
+ Actions will become `When` steps, and responses will become `Then` steps.
77
+
78
+
79
+ ## Running the tests
80
+
81
+ `harmonyc` only compiles `.harmony` files to `.feature` files. To run the tests, you need to set up Cucumber or Specflow, depending on your environment.
82
+
83
+ ## License
84
+
85
+ MIT
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "harmonyc",
3
3
  "description": "Harmony Code - Test design compiler from high-level model to Gherkin",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "author": "Bernát Kalló",
6
6
  "bin": {
7
7
  "harmonyc": "./cli.js"
8
8
  },
9
- "homepage": "https://github.com/harmony-ac/code#readme",
9
+ "homepage": "https://github.com/harmony-ac/harmony-code#readme",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "git+https://github.com/harmony-ac/code.git"
12
+ "url": "git+https://github.com/harmony-ac/harmony-code.git"
13
13
  },
14
14
  "bugs": {
15
- "url": "https://github.com/harmony-ac/code/issues"
15
+ "url": "https://github.com/harmony-ac/harmony-code/issues"
16
16
  },
17
17
  "dependencies": {
18
18
  "fast-glob": "^3.3.2",
@@ -20,9 +20,22 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "keywords": [
23
- "unit test", "unit testing", "cucumber", "bdd", "behavior-driven",
24
- "test design", "test design automation", "gherkin", "cucumber",
25
- "specflow", "harmony.ac", "test framework", "model-based test",
26
- "model-based testing", "test model", "test modeling", "test modelling"
23
+ "unit test",
24
+ "unit testing",
25
+ "cucumber",
26
+ "bdd",
27
+ "behavior-driven",
28
+ "test design",
29
+ "test design automation",
30
+ "gherkin",
31
+ "cucumber",
32
+ "specflow",
33
+ "harmony.ac",
34
+ "test framework",
35
+ "model-based test",
36
+ "model-based testing",
37
+ "test model",
38
+ "test modeling",
39
+ "test modelling"
27
40
  ]
28
41
  }
package/util/xmur3.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.xmur3 = void 0;
4
- // https://stackoverflow.com/a/47593316
4
+ // https://stackoverflow.com/revisions/47593316/25 by bryc (github.com/bryc)
5
5
  function xmur3(str) {
6
6
  let h = 1779033703 ^ str.length;
7
7
  for (let i = 0; i < str.length; i++)