Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suite: add a 'description' property #770

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ In `venom` a testsuite is written in one `YAML` file respecting the following st
```yaml

name: Title of TestSuite
description: A detailed description of the TestSuite, in markdown.
testcases:
- name: TestCase with default value, exec cmd. Check if exit code != 1
steps:
Expand Down
9 changes: 5 additions & 4 deletions process_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ func (v *Venom) readFiles(ctx context.Context, filesPath []string) (err error) {
}

ts := TestSuite{
Name: testSuiteInput.Name,
TestCases: make([]TestCase, len(testSuiteInput.TestCases)),
Vars: testSuiteInput.Vars,
Secrets: testSuiteInput.Secrets,
Name: testSuiteInput.Name,
Description: testSuiteInput.Description,
TestCases: make([]TestCase, len(testSuiteInput.TestCases)),
Vars: testSuiteInput.Vars,
Secrets: testSuiteInput.Secrets,
}
for i := range testSuiteInput.TestCases {
ts.TestCases[i] = TestCase{
Expand Down
30 changes: 17 additions & 13 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,19 @@ type TestSuiteXML struct {
}

type TestSuiteInput struct {
Name string `json:"name" yaml:"name"`
TestCases []TestCaseInput `json:"testcases" yaml:"testcases"`
Vars H `json:"vars" yaml:"vars"`
Secrets []string `json:"secrets" yaml:"secrets"`
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
TestCases []TestCaseInput `json:"testcases" yaml:"testcases"`
Vars H `json:"vars" yaml:"vars"`
Secrets []string `json:"secrets" yaml:"secrets"`
}

type TestSuite struct {
Name string `json:"name" yaml:"name"`
TestCases []TestCase `json:"testcases" yaml:"testcases"`
Vars H `json:"vars" yaml:"vars"`
Secrets []string `json:"secrets" yaml:"secrets"`
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description"`
TestCases []TestCase `json:"testcases" yaml:"testcases"`
Vars H `json:"vars" yaml:"vars"`
Secrets []string `json:"secrets" yaml:"secrets"`

// computed
ShortName string `json:"shortname" yaml:"-"`
Expand Down Expand Up @@ -357,8 +359,10 @@ func RemoveNotPrintableChar(in string) string {
return strings.Map(m, in)
}

var Red = color.New(color.FgRed).SprintFunc()
var Yellow = color.New(color.FgYellow).SprintFunc()
var Green = color.New(color.FgGreen).SprintFunc()
var Cyan = color.New(color.FgCyan).SprintFunc()
var Gray = color.New(color.Attribute(90)).SprintFunc()
var (
Red = color.New(color.FgRed).SprintFunc()
Yellow = color.New(color.FgYellow).SprintFunc()
Green = color.New(color.FgGreen).SprintFunc()
Cyan = color.New(color.FgCyan).SprintFunc()
Gray = color.New(color.Attribute(90)).SprintFunc()
)
6 changes: 6 additions & 0 deletions venom_output.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/yamljs/0.3.0/yaml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<style>

@media (min-width: 768px) {
Expand Down Expand Up @@ -209,6 +210,11 @@ <h5 class="modal-title" id="varsModalLabel">Test Suite Variables</h5>
var data = a.test_suites[this.id];

var info = "";
if (data.description) {
var converter = new showdown.Converter(),
html = converter.makeHtml(data.description);
info += html;
}
info += '<ul>'

info += '<li>Filepath: <code class="nt">'+data.filepath+'</code></li>';
Expand Down