testeranto 0.199.0 → 0.200.0
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/bin/test_runner +0 -0
- package/bin/testeranto +0 -0
- package/bundle.js +2 -2
- package/cmd/test_runner/main.go +65 -0
- package/cmd/testeranto/main.go +37 -0
- package/dist/common/src/PM/main.js +126 -11
- package/dist/common/src/PM/pitonoRunner.js +54 -0
- package/dist/common/src/components/pure/TestPageView.js +180 -65
- package/dist/common/src/components/stateful/TestPage.js +50 -11
- package/dist/common/src/lib/abstractBase.test/index.js +1 -0
- package/dist/common/src/run.js +48 -82
- package/dist/common/src/{build.js → testeranto.js} +107 -55
- package/dist/common/src/utils/golingvuMetafile.js +116 -0
- package/dist/common/src/utils/logFiles.js +2 -1
- package/dist/common/src/utils/pitonoMetafile.js +67 -0
- package/dist/common/src/utils.js +40 -1
- package/dist/common/testeranto.config.js +23 -21
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/PM/main.js +126 -11
- package/dist/module/src/PM/pitonoRunner.js +47 -0
- package/dist/module/src/components/pure/TestPageView.js +180 -65
- package/dist/module/src/components/stateful/TestPage.js +50 -11
- package/dist/module/src/lib/abstractBase.test/index.js +1 -0
- package/dist/module/src/run.js +49 -45
- package/dist/module/src/{build.js → testeranto.js} +107 -55
- package/dist/module/src/utils/golingvuMetafile.js +109 -0
- package/dist/module/src/utils/logFiles.js +2 -1
- package/dist/module/src/utils/pitonoMetafile.js +60 -0
- package/dist/module/src/utils.js +40 -1
- package/dist/module/testeranto.config.js +23 -21
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/App.js +81 -17
- package/dist/types/src/PM/main.d.ts +2 -0
- package/dist/types/src/PM/pitonoRunner.d.ts +7 -0
- package/dist/types/src/Types.d.ts +1 -1
- package/dist/types/src/run.d.ts +0 -1
- package/dist/types/src/utils/golingvuMetafile.d.ts +19 -0
- package/dist/types/src/utils/logFiles.d.ts +5 -1
- package/dist/types/src/utils/pitonoMetafile.d.ts +7 -0
- package/dist/types/src/utils.d.ts +5 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/index.md +13 -13
- package/example/test_example.py +106 -0
- package/go.mod +3 -0
- package/package.json +2 -2
- package/pitono/__init__.py +54 -0
- package/pitono/base_given.py +131 -0
- package/pitono/base_suite.py +95 -0
- package/pitono/base_then.py +50 -0
- package/pitono/base_when.py +52 -0
- package/pitono/core_generator.py +110 -0
- package/pitono/pitono.egg-info/PKG-INFO +17 -0
- package/pitono/pitono.egg-info/SOURCES.txt +7 -0
- package/pitono/pitono.egg-info/dependency_links.txt +1 -0
- package/pitono/pitono.egg-info/entry_points.txt +2 -0
- package/pitono/pitono.egg-info/top_level.txt +1 -0
- package/pitono/pyproject.toml +26 -0
- package/pitono/setup.py +40 -0
- package/pitono/simple_adapter.py +24 -0
- package/pitono/types.py +78 -0
- package/sampleMetafile.json +56 -0
- package/src/PM/main.ts +146 -17
- package/src/PM/pitonoRunner.ts +49 -0
- package/src/Types.ts +1 -1
- package/src/components/pure/TestPageView.tsx +175 -8
- package/src/components/stateful/TestPage.tsx +57 -16
- package/src/core/types.go +36 -0
- package/src/golingvu/README.md +3 -0
- package/src/golingvu/base_given.go +76 -0
- package/src/golingvu/base_suite.go +39 -0
- package/src/golingvu/base_suite_test.go +197 -0
- package/src/golingvu/base_then.go +21 -0
- package/src/golingvu/base_when.go +21 -0
- package/src/golingvu/golingvu.go +179 -0
- package/src/golingvu/test_adapter.go +33 -0
- package/src/golingvu/types.go +86 -0
- package/src/lib/abstractBase.test/index.ts +1 -0
- package/src/pitono/README.md +3 -0
- package/src/run.ts +48 -48
- package/src/templates/frontpage.html +26 -17
- package/src/{build.ts → testeranto.ts} +128 -58
- package/src/utils/golingvuMetafile.ts +165 -0
- package/src/utils/logFiles.ts +2 -1
- package/src/utils/pitonoMetafile.ts +68 -0
- package/src/utils.ts +38 -1
- package/testeranto/App.js +81 -17
- package/testeranto/metafiles/golang/core.json +72 -0
- package/testeranto/metafiles/node/core.json +21 -459
- package/testeranto/metafiles/pure/core.json +18 -119
- package/testeranto/metafiles/web/core.json +37 -16797
- package/testeranto/reports/core/config.json +8 -40
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/lint_errors.txt +6 -0
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/prompt.txt +12 -1
- package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/lint_errors.txt +2 -0
- package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +11 -1
- package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/lint_errors.txt +2 -0
- package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/prompt.txt +13 -3
- package/testeranto/reports/core/summary.json +9 -45
- package/testeranto.config.ts +25 -21
- package/tsc.log +46 -7
- package/dist/common/src/lib/mocks.test.js +0 -11
- package/dist/module/src/lib/mocks.test.js +0 -11
- package/dist/prebuild/build.mjs +0 -578
- package/dist/prebuild/run.mjs +0 -2290
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/src/lib/mocks.test.d.ts +0 -0
- package/src/lib/mocks.test.ts +0 -11
- package/testeranto/reports/core/src/Pure.test/pure/exit.log +0 -0
- package/testeranto/reports/core/src/Pure.test/pure/lint_errors.txt +0 -0
- package/testeranto/reports/core/src/Pure.test/pure/message.txt +0 -17
- package/testeranto/reports/core/src/Pure.test/pure/prompt.txt +0 -14
- package/testeranto/reports/core/src/Pure.test/pure/type_errors.txt +0 -66
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/debug.log +0 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/error.log +0 -67
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/exit.log +0 -1
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/info.log +0 -2
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/lint_errors.txt +0 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/message.txt +0 -17
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/prompt.txt +0 -16
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/tests.json +0 -68
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/type_errors.txt +0 -56
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/warn.log +0 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/debug.log +0 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/error.log +0 -22
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/exit.log +0 -1
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/info.log +0 -2
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +0 -13
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/message.txt +0 -17
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/prompt.txt +0 -16
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/tests.json +0 -88
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +0 -45
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/warn.log +0 -0
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/debug.log +0 -0
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/error.log +0 -0
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/exit.log +0 -1
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/info.log +0 -2
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/lint_errors.txt +0 -47
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/message.txt +0 -17
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/prompt.txt +0 -17
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/tests.json +0 -57
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/type_errors.txt +0 -99
- package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/warn.log +0 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/exit.log +0 -1
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/lint_errors.txt +0 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/message.txt +0 -17
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/prompt.txt +0 -17
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stderr.log +0 -18
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stdout.log +0 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/type_errors.txt +0 -32
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/exit.log +0 -1
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/lint_errors.txt +0 -15
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/message.txt +0 -17
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/prompt.txt +0 -17
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stderr.log +0 -66
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stdout.log +0 -10
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/type_errors.txt +0 -47
- /package/dist/types/src/{build.d.ts → testeranto.d.ts} +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
package golingvu
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"testing"
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
// Test types to match the TypeScript implementation
|
|
8
|
+
type TestStore struct {
|
|
9
|
+
Name string
|
|
10
|
+
Index int
|
|
11
|
+
TestStore bool
|
|
12
|
+
TestSelection bool
|
|
13
|
+
Error error
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type TestSelection struct {
|
|
17
|
+
TestSelection bool
|
|
18
|
+
Error bool
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// TestBaseSuiteInitialization tests that BaseSuite initializes correctly
|
|
22
|
+
func TestBaseSuiteInitialization(t *testing.T) {
|
|
23
|
+
suite := &BaseSuite{
|
|
24
|
+
Name: "testSuite",
|
|
25
|
+
Givens: map[string]*BaseGiven{
|
|
26
|
+
"testGiven": {
|
|
27
|
+
Name: "testGiven",
|
|
28
|
+
Features: []string{"testFeature"},
|
|
29
|
+
Whens: []*BaseWhen{},
|
|
30
|
+
Thens: []*BaseThen{},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if suite.Name != "testSuite" {
|
|
36
|
+
t.Errorf("Expected suite name 'testSuite', got '%s'", suite.Name)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if len(suite.Givens) != 1 {
|
|
40
|
+
t.Errorf("Expected 1 given, got %d", len(suite.Givens))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
given := suite.Givens["testGiven"]
|
|
44
|
+
if given.Name != "testGiven" {
|
|
45
|
+
t.Errorf("Expected given name 'testGiven', got '%s'", given.Name)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if len(given.Features) != 1 || given.Features[0] != "testFeature" {
|
|
49
|
+
t.Errorf("Expected feature 'testFeature', got %v", given.Features)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// TestBaseSuiteToObj tests the ToObj method
|
|
54
|
+
func TestBaseSuiteToObj(t *testing.T) {
|
|
55
|
+
suite := &BaseSuite{
|
|
56
|
+
Name: "testSuite",
|
|
57
|
+
Givens: map[string]*BaseGiven{
|
|
58
|
+
"testGiven": {
|
|
59
|
+
Name: "testGiven",
|
|
60
|
+
Features: []string{"testFeature"},
|
|
61
|
+
Whens: []*BaseWhen{},
|
|
62
|
+
Thens: []*BaseThen{},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
obj := suite.ToObj()
|
|
68
|
+
if obj["name"] != "testSuite" {
|
|
69
|
+
t.Errorf("Expected obj name 'testSuite', got '%v'", obj["name"])
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// TestBaseSuiteFeatures tests the Features method
|
|
74
|
+
func TestBaseSuiteFeatures(t *testing.T) {
|
|
75
|
+
suite := &BaseSuite{
|
|
76
|
+
Name: "testSuite",
|
|
77
|
+
Givens: map[string]*BaseGiven{
|
|
78
|
+
"testGiven": {
|
|
79
|
+
Name: "testGiven",
|
|
80
|
+
Features: []string{"testFeature"},
|
|
81
|
+
Whens: []*BaseWhen{},
|
|
82
|
+
Thens: []*BaseThen{},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
features := suite.Features()
|
|
88
|
+
if len(features) != 1 || features[0] != "testFeature" {
|
|
89
|
+
t.Errorf("Expected ['testFeature'], got %v", features)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// TestBaseSuiteRun tests the Run method
|
|
94
|
+
func TestBaseSuiteRun(t *testing.T) {
|
|
95
|
+
suite := &BaseSuite{
|
|
96
|
+
Name: "testSuite",
|
|
97
|
+
Givens: map[string]*BaseGiven{
|
|
98
|
+
"testGiven": {
|
|
99
|
+
Name: "testGiven",
|
|
100
|
+
Features: []string{"testFeature"},
|
|
101
|
+
Whens: []*BaseWhen{},
|
|
102
|
+
Thens: []*BaseThen{},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Mock test resource configuration
|
|
108
|
+
testConfig := ITTestResourceConfiguration{
|
|
109
|
+
Name: "test",
|
|
110
|
+
Fs: "/tmp",
|
|
111
|
+
Ports: []int{3000},
|
|
112
|
+
Environment: map[string]string{},
|
|
113
|
+
Timeout: 5000,
|
|
114
|
+
Retries: 3,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Mock artifactory function
|
|
118
|
+
artifactory := func(path string, value interface{}) {}
|
|
119
|
+
|
|
120
|
+
// Mock tLog function
|
|
121
|
+
tLog := func(args ...string) {}
|
|
122
|
+
|
|
123
|
+
// Mock PM
|
|
124
|
+
pm := struct{}{}
|
|
125
|
+
|
|
126
|
+
result, err := suite.Run(nil, testConfig, artifactory, tLog, pm)
|
|
127
|
+
if err != nil {
|
|
128
|
+
t.Errorf("Run failed: %v", err)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if result == nil {
|
|
132
|
+
t.Error("Expected non-nil result from Run")
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// TestBaseGivenAddArtifact tests adding artifacts
|
|
137
|
+
func TestBaseGivenAddArtifact(t *testing.T) {
|
|
138
|
+
given := &BaseGiven{
|
|
139
|
+
Name: "testGiven",
|
|
140
|
+
Artifacts: []string{},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
given.AddArtifact("test/path")
|
|
144
|
+
given.AddArtifact("another/path")
|
|
145
|
+
|
|
146
|
+
if len(given.Artifacts) != 2 {
|
|
147
|
+
t.Errorf("Expected 2 artifacts, got %d", len(given.Artifacts))
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if given.Artifacts[0] != "test/path" || given.Artifacts[1] != "another/path" {
|
|
151
|
+
t.Errorf("Unexpected artifacts: %v", given.Artifacts)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// TestBaseGivenToObj tests the ToObj method
|
|
156
|
+
func TestBaseGivenToObj(t *testing.T) {
|
|
157
|
+
given := &BaseGiven{
|
|
158
|
+
Name: "testGiven",
|
|
159
|
+
Features: []string{"testFeature"},
|
|
160
|
+
Whens: []*BaseWhen{},
|
|
161
|
+
Thens: []*BaseThen{},
|
|
162
|
+
Key: "testKey",
|
|
163
|
+
Artifacts: []string{"test/artifact"},
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
obj := given.ToObj()
|
|
167
|
+
if obj["name"] != "testGiven" {
|
|
168
|
+
t.Errorf("Expected name 'testGiven', got '%v'", obj["name"])
|
|
169
|
+
}
|
|
170
|
+
if obj["key"] != "testKey" {
|
|
171
|
+
t.Errorf("Expected key 'testKey', got '%v'", obj["key"])
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// TestBaseWhenToObj tests the ToObj method for BaseWhen
|
|
176
|
+
func TestBaseWhenToObj(t *testing.T) {
|
|
177
|
+
when := &BaseWhen{
|
|
178
|
+
Name: "testWhen",
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
obj := when.ToObj()
|
|
182
|
+
if obj["name"] != "testWhen" {
|
|
183
|
+
t.Errorf("Expected name 'testWhen', got '%v'", obj["name"])
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// TestBaseThenToObj tests the ToObj method for BaseThen
|
|
188
|
+
func TestBaseThenToObj(t *testing.T) {
|
|
189
|
+
then := &BaseThen{
|
|
190
|
+
Name: "testThen",
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
obj := then.ToObj()
|
|
194
|
+
if obj["name"] != "testThen" {
|
|
195
|
+
t.Errorf("Expected name 'testThen', got '%v'", obj["name"])
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package golingvu
|
|
2
|
+
|
|
3
|
+
// BaseThen represents a Then condition
|
|
4
|
+
type BaseThen struct {
|
|
5
|
+
Name string
|
|
6
|
+
ThenCB interface{}
|
|
7
|
+
ButThenFunc func(store, thenCB, testResource, pm interface{}) (interface{}, error)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Test executes the Then condition
|
|
11
|
+
func (bt *BaseThen) Test(store interface{}, testResourceConfiguration ITTestResourceConfiguration, tLog func(...string), pm interface{}, path string) (interface{}, error) {
|
|
12
|
+
// Implementation would go here
|
|
13
|
+
return nil, nil
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// ToObj converts the Then condition to a serializable object
|
|
17
|
+
func (bt *BaseThen) ToObj() map[string]interface{} {
|
|
18
|
+
return map[string]interface{}{
|
|
19
|
+
"name": bt.Name,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package golingvu
|
|
2
|
+
|
|
3
|
+
// BaseWhen represents a When condition
|
|
4
|
+
type BaseWhen struct {
|
|
5
|
+
Name string
|
|
6
|
+
WhenCB interface{}
|
|
7
|
+
AndWhenFunc func(store, whenCB, testResource, pm interface{}) (interface{}, error)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Test executes the When condition
|
|
11
|
+
func (bw *BaseWhen) Test(store interface{}, testResourceConfiguration ITTestResourceConfiguration, tLog func(...string), pm interface{}, path string) (interface{}, error) {
|
|
12
|
+
// Implementation would go here
|
|
13
|
+
return nil, nil
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// ToObj converts the When condition to a serializable object
|
|
17
|
+
func (bw *BaseWhen) ToObj() map[string]interface{} {
|
|
18
|
+
return map[string]interface{}{
|
|
19
|
+
"name": bw.Name,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
package golingvu
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// Golingvu is the main test runner class (Go implementation of Tiposkripto)
|
|
5
|
+
type Golingvu struct {
|
|
6
|
+
TestResourceRequirement ITTestResourceRequest
|
|
7
|
+
Artifacts []interface{}
|
|
8
|
+
TestJobs []ITestJob
|
|
9
|
+
TestSpecification ITestSpecification
|
|
10
|
+
SuitesOverrides map[string]interface{}
|
|
11
|
+
GivenOverrides map[string]interface{}
|
|
12
|
+
WhenOverrides map[string]interface{}
|
|
13
|
+
ThenOverrides map[string]interface{}
|
|
14
|
+
PuppetMaster interface{}
|
|
15
|
+
Specs interface{}
|
|
16
|
+
assertThis func(t interface{}) interface{}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// NewGolingvu creates a new Golingvu instance
|
|
20
|
+
func NewGolingvu(
|
|
21
|
+
input interface{},
|
|
22
|
+
testSpecification ITestSpecification,
|
|
23
|
+
testImplementation ITestImplementation,
|
|
24
|
+
testResourceRequirement ITTestResourceRequest,
|
|
25
|
+
testAdapter ITestAdapter,
|
|
26
|
+
uberCatcher func(func()),
|
|
27
|
+
) *Golingvu {
|
|
28
|
+
gv := &Golingvu{
|
|
29
|
+
TestResourceRequirement: testResourceRequirement,
|
|
30
|
+
Artifacts: make([]interface{}, 0),
|
|
31
|
+
SuitesOverrides: make(map[string]interface{}),
|
|
32
|
+
GivenOverrides: make(map[string]interface{}),
|
|
33
|
+
WhenOverrides: make(map[string]interface{}),
|
|
34
|
+
ThenOverrides: make(map[string]interface{}),
|
|
35
|
+
assertThis: func(t interface{}) interface{} {
|
|
36
|
+
return testAdapter.AssertThis(t)
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Create classy implementations
|
|
41
|
+
classySuites := make(map[string]interface{})
|
|
42
|
+
for key := range testImplementation.Suites {
|
|
43
|
+
classySuites[key] = func(somestring string, givens map[string]*BaseGiven) *BaseSuite {
|
|
44
|
+
return &BaseSuite{
|
|
45
|
+
Name: somestring,
|
|
46
|
+
Givens: givens,
|
|
47
|
+
AfterAllFunc: func(store interface{}, artifactory func(string, interface{}), pm interface{}) interface{} {
|
|
48
|
+
return testAdapter.AfterAll(store, pm)
|
|
49
|
+
},
|
|
50
|
+
AssertThatFunc: func(t interface{}) bool {
|
|
51
|
+
return testAdapter.AssertThis(t)
|
|
52
|
+
},
|
|
53
|
+
SetupFunc: func(s interface{}, artifactory func(string, interface{}), tr ITTestResourceConfiguration, pm interface{}) interface{} {
|
|
54
|
+
result := testAdapter.BeforeAll(s, tr, pm)
|
|
55
|
+
if result == nil {
|
|
56
|
+
return s
|
|
57
|
+
}
|
|
58
|
+
return result
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
classyGivens := make(map[string]interface{})
|
|
65
|
+
for key, g := range testImplementation.Givens {
|
|
66
|
+
classyGivens[key] = func(name string, features []string, whens []*BaseWhen, thens []*BaseThen, gcb interface{}, initialValues interface{}) *BaseGiven {
|
|
67
|
+
return &BaseGiven{
|
|
68
|
+
Name: name,
|
|
69
|
+
Features: features,
|
|
70
|
+
Whens: whens,
|
|
71
|
+
Thens: thens,
|
|
72
|
+
GivenCB: g,
|
|
73
|
+
InitialValues: initialValues,
|
|
74
|
+
Artifacts: make([]string, 0),
|
|
75
|
+
GivenThatFunc: func(subject, testResource, artifactory, initializer, initialValues, pm interface{}) (interface{}, error) {
|
|
76
|
+
// Type assertion for testResource
|
|
77
|
+
tr, ok := testResource.(ITTestResourceConfiguration)
|
|
78
|
+
if !ok {
|
|
79
|
+
return nil, nil
|
|
80
|
+
}
|
|
81
|
+
return testAdapter.BeforeEach(subject, initializer, tr, initialValues, pm), nil
|
|
82
|
+
},
|
|
83
|
+
AfterEachFunc: func(store interface{}, key string, artifactory, pm interface{}) (interface{}, error) {
|
|
84
|
+
return testAdapter.AfterEach(store, key, pm), nil
|
|
85
|
+
},
|
|
86
|
+
UberCatcherFunc: uberCatcher,
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
classyWhens := make(map[string]interface{})
|
|
92
|
+
for key, whEn := range testImplementation.Whens {
|
|
93
|
+
classyWhens[key] = func(payload ...interface{}) *BaseWhen {
|
|
94
|
+
return &BaseWhen{
|
|
95
|
+
Name: key,
|
|
96
|
+
WhenCB: whEn,
|
|
97
|
+
AndWhenFunc: func(store, whenCB, testResource, pm interface{}) (interface{}, error) {
|
|
98
|
+
return testAdapter.AndWhen(store, whenCB, testResource, pm), nil
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
classyThens := make(map[string]interface{})
|
|
105
|
+
for key, thEn := range testImplementation.Thens {
|
|
106
|
+
classyThens[key] = func(args ...interface{}) *BaseThen {
|
|
107
|
+
return &BaseThen{
|
|
108
|
+
Name: key,
|
|
109
|
+
ThenCB: thEn,
|
|
110
|
+
ButThenFunc: func(store, thenCB, testResource, pm interface{}) (interface{}, error) {
|
|
111
|
+
return testAdapter.ButThen(store, thenCB, testResource, pm), nil
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Set up the overrides
|
|
118
|
+
gv.SuitesOverrides = classySuites
|
|
119
|
+
gv.GivenOverrides = classyGivens
|
|
120
|
+
gv.WhenOverrides = classyWhens
|
|
121
|
+
gv.ThenOverrides = classyThens
|
|
122
|
+
gv.TestResourceRequirement = testResourceRequirement
|
|
123
|
+
gv.TestSpecification = testSpecification
|
|
124
|
+
|
|
125
|
+
// Generate specs
|
|
126
|
+
gv.Specs = testSpecification(
|
|
127
|
+
gv.Suites(),
|
|
128
|
+
gv.Given(),
|
|
129
|
+
gv.When(),
|
|
130
|
+
gv.Then(),
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
// Create test jobs (simplified)
|
|
134
|
+
// Note: This part needs to be adapted from TypeScript more carefully
|
|
135
|
+
gv.TestJobs = []ITestJob{}
|
|
136
|
+
|
|
137
|
+
return gv
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ReceiveTestResourceConfig receives test resource configuration
|
|
141
|
+
func (gv *Golingvu) ReceiveTestResourceConfig(partialTestResource string) (IFinalResults, error) {
|
|
142
|
+
// Implement this method based on the TypeScript version
|
|
143
|
+
return IFinalResults{}, nil
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Suites returns the suites overrides
|
|
147
|
+
func (gv *Golingvu) Suites() map[string]interface{} {
|
|
148
|
+
return gv.SuitesOverrides
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Given returns the given overrides
|
|
152
|
+
func (gv *Golingvu) Given() map[string]interface{} {
|
|
153
|
+
return gv.GivenOverrides
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// When returns the when overrides
|
|
157
|
+
func (gv *Golingvu) When() map[string]interface{} {
|
|
158
|
+
return gv.WhenOverrides
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Then returns the then overrides
|
|
162
|
+
func (gv *Golingvu) Then() map[string]interface{} {
|
|
163
|
+
return gv.ThenOverrides
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// GetTestJobs returns the test jobs
|
|
167
|
+
func (gv *Golingvu) GetTestJobs() []ITestJob {
|
|
168
|
+
return gv.TestJobs
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// GetSpecs returns the generated specs
|
|
172
|
+
func (gv *Golingvu) GetSpecs() interface{} {
|
|
173
|
+
return gv.Specs
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// AssertThis is a helper function for assertions
|
|
177
|
+
func (gv *Golingvu) AssertThis(t interface{}) interface{} {
|
|
178
|
+
return gv.assertThis(t)
|
|
179
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package golingvu
|
|
2
|
+
|
|
3
|
+
// SimpleTestAdapter is a basic implementation of ITestAdapter
|
|
4
|
+
type SimpleTestAdapter struct{}
|
|
5
|
+
|
|
6
|
+
func (a *SimpleTestAdapter) BeforeAll(input interface{}, tr ITTestResourceConfiguration, pm interface{}) interface{} {
|
|
7
|
+
return input
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
func (a *SimpleTestAdapter) AfterAll(store interface{}, pm interface{}) interface{} {
|
|
11
|
+
return store
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
func (a *SimpleTestAdapter) BeforeEach(subject, initializer interface{}, testResource ITTestResourceConfiguration, initialValues interface{}, pm interface{}) interface{} {
|
|
15
|
+
return subject
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
func (a *SimpleTestAdapter) AfterEach(store interface{}, key string, pm interface{}) interface{} {
|
|
19
|
+
return store
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func (a *SimpleTestAdapter) AndWhen(store, whenCB interface{}, testResource interface{}, pm interface{}) interface{} {
|
|
23
|
+
return store
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func (a *SimpleTestAdapter) ButThen(store, thenCB interface{}, testResource interface{}, pm interface{}) interface{} {
|
|
27
|
+
return store
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
func (a *SimpleTestAdapter) AssertThis(t interface{}) bool {
|
|
31
|
+
// Simple implementation - always return true for now
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
package golingvu
|
|
2
|
+
|
|
3
|
+
// Ibdd_in_any represents the input types for BDD
|
|
4
|
+
type Ibdd_in_any interface {
|
|
5
|
+
Iinput() interface{}
|
|
6
|
+
Isubject() interface{}
|
|
7
|
+
Istore() interface{}
|
|
8
|
+
Iselection() interface{}
|
|
9
|
+
Then() interface{}
|
|
10
|
+
Given() interface{}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Ibdd_out_any represents the output types for BDD
|
|
14
|
+
type Ibdd_out_any interface{}
|
|
15
|
+
|
|
16
|
+
// ITestSpecification defines the test specification function
|
|
17
|
+
type ITestSpecification func(suites, givens, whens, thens interface{}) interface{}
|
|
18
|
+
|
|
19
|
+
// ITestImplementation defines the test implementation structure
|
|
20
|
+
type ITestImplementation struct {
|
|
21
|
+
Suites map[string]interface{}
|
|
22
|
+
Givens map[string]interface{}
|
|
23
|
+
Whens map[string]interface{}
|
|
24
|
+
Thens map[string]interface{}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ITestAdapter defines the adapter interface
|
|
28
|
+
type ITestAdapter interface {
|
|
29
|
+
BeforeAll(input interface{}, tr ITTestResourceConfiguration, pm interface{}) interface{}
|
|
30
|
+
AfterAll(store interface{}, pm interface{}) interface{}
|
|
31
|
+
BeforeEach(subject, initializer interface{}, testResource ITTestResourceConfiguration, initialValues interface{}, pm interface{}) interface{}
|
|
32
|
+
AfterEach(store interface{}, key string, pm interface{}) interface{}
|
|
33
|
+
AndWhen(store, whenCB interface{}, testResource interface{}, pm interface{}) interface{}
|
|
34
|
+
ButThen(store, thenCB interface{}, testResource interface{}, pm interface{}) interface{}
|
|
35
|
+
AssertThis(t interface{}) bool
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ITTestResourceConfiguration represents test resource configuration
|
|
39
|
+
type ITTestResourceConfiguration struct {
|
|
40
|
+
Name string
|
|
41
|
+
Fs string
|
|
42
|
+
Ports []int
|
|
43
|
+
BrowserWSEndpoint string
|
|
44
|
+
Timeout int
|
|
45
|
+
Retries int
|
|
46
|
+
Environment map[string]string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ITTestResourceRequirement represents test resource requirements
|
|
50
|
+
type ITTestResourceRequirement struct {
|
|
51
|
+
Name string
|
|
52
|
+
Ports int
|
|
53
|
+
Fs string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ITTestResourceRequest represents a test resource request
|
|
57
|
+
type ITTestResourceRequest struct {
|
|
58
|
+
Ports int
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// DefaultTestResourceRequest provides a default request
|
|
62
|
+
var DefaultTestResourceRequest = ITTestResourceRequest{
|
|
63
|
+
Ports: 0,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// DefaultTestResourceRequirement provides a default requirement
|
|
67
|
+
var DefaultTestResourceRequirement = ITTestResourceRequirement{
|
|
68
|
+
Name: "default",
|
|
69
|
+
Ports: 0,
|
|
70
|
+
Fs: "./",
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// IFinalResults represents the final results of a test run
|
|
74
|
+
type IFinalResults struct {
|
|
75
|
+
Failed bool
|
|
76
|
+
Fails int
|
|
77
|
+
Artifacts []interface{}
|
|
78
|
+
Features []string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ITestJob represents a test job
|
|
82
|
+
type ITestJob interface {
|
|
83
|
+
ToObj() map[string]interface{}
|
|
84
|
+
Runner(pm interface{}, tLog func(...string)) (interface{}, error)
|
|
85
|
+
ReceiveTestResourceConfig(pm interface{}) (IFinalResults, error)
|
|
86
|
+
}
|
package/src/run.ts
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import ansiC from "ansi-colors";
|
|
2
|
-
import readline from "readline";
|
|
1
|
+
// import ansiC from "ansi-colors";
|
|
2
|
+
// import readline from "readline";
|
|
3
3
|
|
|
4
|
-
import { PM_Main } from "./PM/main";
|
|
5
|
-
import { ITestconfig, IBuiltConfig, IProject } from "./Types";
|
|
4
|
+
// import { PM_Main } from "./PM/main";
|
|
5
|
+
// import { ITestconfig, IBuiltConfig, IProject } from "./Types";
|
|
6
6
|
|
|
7
|
-
readline.emitKeypressEvents(process.stdin);
|
|
8
|
-
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
7
|
+
// readline.emitKeypressEvents(process.stdin);
|
|
8
|
+
// if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
9
9
|
|
|
10
|
-
console.log(ansiC.inverse("Press 'q' to initiate a graceful shutdown."));
|
|
11
|
-
console.log(ansiC.inverse("Press 'x' to quit forcefully."));
|
|
10
|
+
// console.log(ansiC.inverse("Press 'q' to initiate a graceful shutdown."));
|
|
11
|
+
// console.log(ansiC.inverse("Press 'x' to quit forcefully."));
|
|
12
12
|
|
|
13
|
-
process.stdin.on("keypress", (str, key) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
13
|
+
// process.stdin.on("keypress", (str, key) => {
|
|
14
|
+
// if (key.name === "x") {
|
|
15
|
+
// console.log(ansiC.inverse("Shutting down forcefully..."));
|
|
16
|
+
// process.exit(-1);
|
|
17
|
+
// }
|
|
18
|
+
// });
|
|
19
19
|
|
|
20
|
-
const projectName = process.argv[2];
|
|
20
|
+
// const projectName = process.argv[2];
|
|
21
21
|
|
|
22
|
-
const mode = process.argv[3] as "once" | "dev";
|
|
23
|
-
if (mode !== "once" && mode !== "dev") {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
22
|
+
// const mode = process.argv[3] as "once" | "dev";
|
|
23
|
+
// if (mode !== "once" && mode !== "dev") {
|
|
24
|
+
// console.error("the 2nd argument should be 'dev' or 'once' ");
|
|
25
|
+
// process.exit(-1);
|
|
26
|
+
// }
|
|
27
27
|
|
|
28
|
-
const f = process.cwd() + "/" + "testeranto.config.ts";
|
|
28
|
+
// const f = process.cwd() + "/" + "testeranto.config.ts";
|
|
29
29
|
|
|
30
|
-
console.log("config file:", f);
|
|
30
|
+
// console.log("config file:", f);
|
|
31
31
|
|
|
32
|
-
import(f).then(async (module) => {
|
|
33
|
-
|
|
32
|
+
// import(f).then(async (module) => {
|
|
33
|
+
// const bigConfig: IProject = module.default || module;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// const rawConfig: ITestconfig = bigConfig.projects[projectName];
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
// if (!rawConfig) {
|
|
38
|
+
// console.error(`Project "${projectName}" does not exist in the configuration.`);
|
|
39
|
+
// console.error("Available projects:", Object.keys(bigConfig.projects));
|
|
40
|
+
// process.exit(-1);
|
|
41
|
+
// }
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
// if (!rawConfig.tests) {
|
|
44
|
+
// console.error(projectName, "appears to have no tests: ", f);
|
|
45
|
+
// console.error(`here is the config:`);
|
|
46
|
+
// console.log(JSON.stringify(rawConfig));
|
|
47
|
+
// process.exit(-1);
|
|
48
|
+
// }
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
// const config: IBuiltConfig = {
|
|
51
|
+
// ...rawConfig,
|
|
52
|
+
// buildDir: process.cwd() + "/" + `testeranto/${projectName}.json`,
|
|
53
|
+
// };
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// const pm = new PM_Main(config, projectName, mode);
|
|
56
|
+
// pm.start();
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
58
|
+
// process.stdin.on("keypress", (str, key) => {
|
|
59
|
+
// if (key.name === "q") {
|
|
60
|
+
// pm.stop();
|
|
61
|
+
// }
|
|
62
|
+
// });
|
|
63
|
+
// });
|