Skip to content

Commit

Permalink
Merge pull request #11 from dipjyotimetia/add-confluence-jira-feature
Browse files Browse the repository at this point in the history
Add feature to read from Confluence and Jira and suggest test cases
  • Loading branch information
dipjyotimetia authored Sep 4, 2024
2 parents 4ac9697 + 692c4e4 commit 196f531
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Jarvis simplifies the process by meticulously analyzing provided API specificati
### AI-Driven Test Case Writing
Leveraging the capabilities of language models, Jarvis excels at crafting detailed test cases. It ensures clarity, accuracy, and consistency in the generated test cases, elevating the overall testing process.

### Reading from Confluence and Jira
Jarvis can now read from Confluence and Jira to suggest test cases using Google Gemini. This feature allows you to integrate your documentation and issue tracking systems with Jarvis to generate relevant test cases.

To use this feature, run the following command:
```sh
jarvis read-confluence-jira
```

Experience the future of software testing with Jarvis - where AI meets precision and efficiency.

[Setup Documentation](docs/setup.md)
33 changes: 23 additions & 10 deletions pkg/atlassian/confluence/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,44 @@ import (
"log"
"os"

jira "github.com/ctreminiom/go-atlassian/jira/v2"
confluence "github.com/ctreminiom/go-atlassian/confluence/v2"
)

var (
HOST = os.Getenv("JIRA_HOST")
USER = os.Getenv("JIRA_USER")
ApiToken = os.Getenv("JIRA_API_TOKEN")
HOST = os.Getenv("CONFLUENCE_HOST")
USER = os.Getenv("CONFLUENCE_USER")
ApiToken = os.Getenv("CONFLUENCE_API_TOKEN")
)

type client struct {
*jira.Client
*confluence.Client
}

type Client interface {
GetIssues()
GetProjects()
GetPages() ([]string, error)
}

func New(ctx context.Context) *client {
jiraClient, err := jira.New(nil, HOST)
confluenceClient, err := confluence.New(nil, HOST)
if err != nil {
log.Fatal(err)
}

jiraClient.Auth.SetBasicAuth(USER, ApiToken)
confluenceClient.Auth.SetBasicAuth(USER, ApiToken)

return &client{jiraClient}
return &client{confluenceClient}
}

func (c *client) GetPages() ([]string, error) {
pages, _, err := c.Client.Page.Gets(context.Background(), nil, "", 0)
if err != nil {
return nil, err
}

var pageTitles []string
for _, page := range pages.Results {
pageTitles = append(pageTitles, page.Title)
}

return pageTitles, nil
}
1 change: 0 additions & 1 deletion pkg/atlassian/jira/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ func (c *client) GetIssues() {
log.Fatal(err)
}
fmt.Println(issues.Fields.Description)

}

0 comments on commit 196f531

Please sign in to comment.