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

Failed Tests #66

Open
toertchn opened this issue Jan 6, 2021 · 20 comments
Open

Failed Tests #66

toertchn opened this issue Jan 6, 2021 · 20 comments

Comments

@toertchn
Copy link

toertchn commented Jan 6, 2021

I start running the test cases on one of our JIRA projects. Here are the results (each post) a test case.

Over all: Is there a way to add a simple call to the TestBase constructor to check for user/pass and avoid all further requests? I normally get blocked when I try to enter the wrong password some times :-)

JIraTests > TestGetServerInfoAsync()

// This should be changed when the title changes
Assert.EndsWith("JIRA", serverInfo.ServerTitle);

Failed: Our ServerTitle ends with "Jira" ... but doesn't really needed to check?

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.ProjectTests.TestGetIssueCreatorsAsync

await Client.Server.GetAvatarAsync<Bitmap>(firstCreator.Avatars);

Failed: System.NotSupportedException : Unsupported result type Bitmap & image/png combination.

The request to the avatar url seems to work: https://jiraserver/secure/useravatar?ownerId=admin&avatarId=11307
Result is an PNG file.

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.UserTests.TestSearchUsersAsync

Failed: Dapplo.Jira.JiraException : BadRequest(400)

Request: https://jiraserver/rest/api/2/user/search?query=krom&includeActive=True&includeInactive=False&startAt=0&maxResults=20

Result: {"errorMessages":["Der Abfrageparameter "username" wurde nicht angegeben"],"errors":{}}

Dapplo.Jira.Tests.UserTests.TestSearchUsersByQueryAsync

https://jiraserver/rest/api/2/user/search/query?query=is assignee of BUG&startAt=0&maxResults=20

Failed: Dapplo.Jira.JiraException : null for uri

Request: https://jiraserver/rest/api/2/user/search/query?query=is%20assignee%20of%20BUG&startAt=0&maxResults=20

I'm not sure but I think there it needs to be also called lik: /search?query=

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.WorkTests.TestWorklogs

Request: https://jiraserver/rest/api/2/issue/SDLA-813/worklog
Result: {"startAt":0,"maxResults":0,"total":0,"worklogs":[]}

Reason so far: We don't use worklogs, but add/update works fine ;-)

Note from JIRA Doc: Work logs won't be returned if the Log work field is hidden for the project.

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.FilterTests.TestCreateAsync

Request: https://jiraserver/rest/api/2/filter/my
Result: 404

Without the "my" I get a 405
Seems that this api is deprecated and replaced by Search for Filters

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.IssueTests.Test_GetIssue

This Test case fails for me at the point: "Assert.True(issue.Fields.TimeTracking.TimeSpentSeconds > 0);" because TimeSpentSeconds = 0 (Time Tracking not enabled in the project)

Don't know if the "JiraConfig.ExpandGetIssue" array needs a reset to default after the call?

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.IssueTests.Test_CreateIssue

Fails: System.InvalidOperationException : Sequence contains no matching element

Reason: We don't have an IssueType named Bug. Later it will fail for me because I don't have the rights to delete issues.

@Lakritzator
Copy link
Member

The issue with integration tests, is that it's really a lot of work to make them work on a different servers.
I guess I could make some work more reliantly, e.g. the previous comment describes a problem with the issue type, here I could call to get a list of issue types, and use it to create the issue with. But this has some implications, maybe the create screen for the other issue type is different.

Still there is a lot of valuable information in your comments.... I will go through them.

I don't think I can make all tests so generic so they work everywhere, without making compromises.
It might be good to have some switch, where some tests skip as it's not running on an especially crafted Jira server to test with.

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.IssueTests.Test_Assign

Fails: Assert.Equal(issueAssignedToMe.Fields.Assignee, issueBeforeChanges.Fields.Assignee);
Works: Assert.Equal(issueAssignedToMe.Fields.Assignee.Name, issueBeforeChanges.Fields.Assignee.Name);

The user interface (or nearly all classes) miss the IComparable interface?

@Lakritzator
Copy link
Member

Lakritzator commented Jan 6, 2021

I start running the test cases on one of our JIRA projects. Here are the results (each post) a test case.

Over all: Is there a way to add a simple call to the TestBase constructor to check for user/pass and avoid all further requests? I normally get blocked when I try to enter the wrong password some times :-)
Good point, I can add a password check and store the result. Still the tests need to fail, so you might need an "Assert.True(isPasswordValid)"

JIraTests > TestGetServerInfoAsync()

// This should be changed when the title changes
Assert.EndsWith("JIRA", serverInfo.ServerTitle);

Failed: Our ServerTitle ends with "Jira" ... but doesn't really needed to check?

Well I need to check if the server information comes over somehow, so I might just check that the length is > 0

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.ProjectTests.TestGetIssueCreatorsAsync

await Client.Server.GetAvatarAsync<Bitmap>(firstCreator.Avatars);

Failed: System.NotSupportedException : Unsupported result type Bitmap & image/png combination.

The request to the avatar url seems to work: https://jiraserver/secure/useravatar?ownerId=admin&avatarId=11307
Result is an PNG file.

This is usually the case when there is no converter registered, and I noticed that these tests are depending on other tests to have run before. My bad....

@Lakritzator
Copy link
Member

Lakritzator commented Jan 6, 2021

Dapplo.Jira.Tests.WorkTests.TestWorklogs

Request: https://jiraserver/rest/api/2/issue/SDLA-813/worklog
Result: {"startAt":0,"maxResults":0,"total":0,"worklogs":[]}

Reason so far: We don't use worklogs, but add/update works fine ;-)

Note from JIRA Doc: Work logs won't be returned if the Log work field is hidden for the project.

This is not something easy to fix, for the tests to go green I need that. Did it give an error?
I would need to add a setting for a project name where worklog is enabled?

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.IssueTests.Test_GetIssue

This Test case fails for me at the point: "Assert.True(issue.Fields.TimeTracking.TimeSpentSeconds > 0);" because TimeSpentSeconds = 0 (Time Tracking not enabled in the project)

Don't know if the "JiraConfig.ExpandGetIssue" array needs a reset to default after the call?
Changing the global settings is bad practice, I might use the expand option I added recently.

I should separate some of the asserts in this unit test, so it gets more clear what is being tested.

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.IssueTests.Test_CreateIssue

Fails: System.InvalidOperationException : Sequence contains no matching element

Reason: We don't have an IssueType named Bug. Later it will fail for me because I don't have the rights to delete issues.

I wanted to see if I can query the rights a uses has, the unit-tests NEED certain rights otherwise your JIRA system would be cluttered with countless issues. Taking another issue type might not give the correct result, as mentioned before there might be different fields. I actually created a specific test user and a test project to run my unit-tests.

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.FilterTests.TestCreateAsync

Request: https://jiraserver/rest/api/2/filter/my
Result: 404

Without the "my" I get a 405
Seems that this api is deprecated and replaced by Search for Filters

Ok, good to know, will check that out.
Btw.
Can you specify against what server version you are testing??

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.IssueTests.Test_Assign

Fails: Assert.Equal(issueAssignedToMe.Fields.Assignee, issueBeforeChanges.Fields.Assignee);
Works: Assert.Equal(issueAssignedToMe.Fields.Assignee.Name, issueBeforeChanges.Fields.Assignee.Name);

The user interface (or nearly all classes) miss the IComparable interface?

That might be a valuable addition 😊

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.UserTests.TestSearchUsersAsync

Failed: Dapplo.Jira.JiraException : BadRequest(400)

Request: https://jiraserver/rest/api/2/user/search?query=krom&includeActive=True&includeInactive=False&startAt=0&maxResults=20

Result: {"errorMessages":["Der Abfrageparameter "username" wurde nicht angegeben"],"errors":{}}

Dapplo.Jira.Tests.UserTests.TestSearchUsersByQueryAsync

https://jiraserver/rest/api/2/user/search/query?query=is assignee of BUG&startAt=0&maxResults=20

Failed: Dapplo.Jira.JiraException : null for uri

Request: https://jiraserver/rest/api/2/user/search/query?query=is%20assignee%20of%20BUG&startAt=0&maxResults=20

I'm not sure but I think there it needs to be also called lik: /search?query=

That seems weird, I will need to check this.

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.FilterTests.TestCreateAsync
Request: https://jiraserver/rest/api/2/filter/my
Result: 404
Without the "my" I get a 405
Seems that this api is deprecated and replaced by Search for Filters

Ok, good to know, will check that out.
Btw.
Can you specify against what server version you are testing??

We are running 8.5.3

@toertchn
Copy link
Author

toertchn commented Jan 6, 2021

Dapplo.Jira.Tests.WorkTests.TestWorklogs
Request: https://jiraserver/rest/api/2/issue/SDLA-813/worklog
Result: {"startAt":0,"maxResults":0,"total":0,"worklogs":[]}
Reason so far: We don't use worklogs, but add/update works fine ;-)
Note from JIRA Doc: Work logs won't be returned if the Log work field is hidden for the project.

This is not something easy to fix, for the tests to go green I need that. Did it give an error?
I would need to add a setting for a project name where worklog is enabled?

It gives me the error @ Assert.True(worklogs.Elements.Count > 0); because the Count is null.

But this can also a bug/feature in the api. In the webbrowser I see on the right bar the entries "Zeitverfolgung" and "Zeiterfassung". But on the bottom called "Arbeitsprotokoll" there is nothing.

Don't know if this can cause problems in other cases but I don't really need this feature.

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.FilterTests.TestCreateAsync
Request: https://jiraserver/rest/api/2/filter/my
Result: 404
Without the "my" I get a 405
Seems that this api is deprecated and replaced by Search for Filters

Ok, good to know, will check that out.
Btw.
Can you specify against what server version you are testing??

We are running 8.5.3

For cloud servers the function is not deprecated: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-filters/#api-rest-api-2-filter-my-get
But there doesn't seem to be an implementation for the server: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.3/#api/2/filter

I just added (version pending) a SearchFilterAsync to solve the issue, which is called indirectly by the GetMyFiltersAsync.

@Lakritzator
Copy link
Member

Dapplo.Jira.Tests.UserTests.TestSearchUsersAsync

Failed: Dapplo.Jira.JiraException : BadRequest(400)

Request: https://jiraserver/rest/api/2/user/search?query=krom&includeActive=True&includeInactive=False&startAt=0&maxResults=20

Result: {"errorMessages":["Der Abfrageparameter "username" wurde nicht angegeben"],"errors":{}}

Dapplo.Jira.Tests.UserTests.TestSearchUsersByQueryAsync

https://jiraserver/rest/api/2/user/search/query?query=is assignee of BUG&startAt=0&maxResults=20

Failed: Dapplo.Jira.JiraException : null for uri

Request: https://jiraserver/rest/api/2/user/search/query?query=is%20assignee%20of%20BUG&startAt=0&maxResults=20

I'm not sure but I think there it needs to be also called lik: /search?query=

Oh man, yes I think I remember what is the issue here... There is this funny separation between Jira Server & Cloud. For Cloud Atlassian no longer is using usernames... due to GDPR rules.
I'll need to check out how to handle this, I didn't notice due to me testing against cloud here.

Lakritzator added a commit that referenced this issue Jan 6, 2021
* Added SearchFiltersAsync
* Added a way to do equals on many entities
* Improved testing stability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants