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

Need help, unable to update test cases #4

Closed
needhamm opened this issue Aug 4, 2022 · 6 comments
Closed

Need help, unable to update test cases #4

needhamm opened this issue Aug 4, 2022 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@needhamm
Copy link

needhamm commented Aug 4, 2022

Hello, I am hoping that you could give me a hand in getting this service working. I have added the service as per https://webdriver.io/docs/gmangiapelo-wdio-azure-devops-service/ and as far as I can tell have it setup correctly but test cases are not being updated in Azure.

I have looked through issue #1 but have still not been able to get it working. Below is the setup that I have in wdio and Azure. Any help would be greately appreciated, thanks in advance.

PAT setup with the following:
image

wdio.conf.js setup as so:

    services: [
        [driverService], 
        [AzureDevopsService,
            {
            pat: 'pat',
            organizationUrl: 'https://dev.azure.com/org',
            projectId: 'projectid',
            planId: 30584,
            suiteId: 37063,
            caseIdRegex: '@?[cC](\d+)',
            runName: 'AzureDevops Test',
            },
        ],
    ],

When querieng the through Postman I am able to return test cases with no issues using the pat, org, projectId, planId and suiteId
GET https://dev.azure.com/{org}/{projectid}/_apis/test/Plans/30584/suites/37063/testcases?api-version=5.0

"testCase": {
                "id": "37064",
                "url": "https://dev.azure.com/{org}/_apis/wit/workItems/37064",
                "webUrl": "https://dev.azure.com/{org}/web/wi.aspx?pcguid=########-####-####-####-############&id=37064"
            },

Test case setup, I have tried with lower and upper case C:

describe('Test 1', () => {


    it( 'C37064 Test case', async () => {
        
  
    });

});

After running the test Azure is not updated:
image

I have set the logging to:

logLevel: "trace",
outputDir: path.join(__dirname, "/logs"),

But can see no mention of this service in any of the logs.

@gianlucamangiapelo gianlucamangiapelo added the help wanted Extra attention is needed label Aug 4, 2022
@gianlucamangiapelo
Copy link
Owner

Hi @needhamm,
seems that your configuration is okay.

You can try to remove from wdio.conf.js the caseIdRegex property, because you can use the default regex.

Here the configuration that you can try:

services: [
        [driverService], 
        [AzureDevopsService,
            {
            pat: 'pat',
            organizationUrl: 'https://dev.azure.com/org',
            projectId: 'projectid',
            planId: 30584,
            suiteId: 37063,
            runName: 'AzureDevops Test',
            },
        ],
    ],

Let me know if you have some progress on that.

Thanks

@needhamm
Copy link
Author

needhamm commented Sep 1, 2022

Hi @gianlucamangiapelo

Thanks for getting in touch. I have tried removing the regex but no change.

There is still no mention of the service in the wdio.log when logging set to trace. Would this suggest that the service isnt being called for some reason?

@gianlucamangiapelo
Copy link
Owner

@needhamm Probably is not loaded.

At the top of the wdio.conf.js are you importing
import AzureDevopsService from "@gmangiapelo/wdio-azure-devops-service";

the plugin is listed in your dependencies in package.json?

@daveplummer20
Copy link

Hi.
I'm working with @needhamm on this and have now managed to get the service to update tests in the suite to In Progress, however no test result is being added to the test case.
image

I can see the service being initialised at the beginning of the log, but can't see any reference to it after that:
@wdio/utils:initialiseServices: initialise custom service "AzureDevopsService"

Is there anything else we can check to try and debug?

Thanks

@daveplummer20
Copy link

I managed to get this working.
We're using jasmine which doesn't seem to include the title on the test object, which from what I could gather from your code is one of the things that is used to parse the test case id.
For now I've added the following to the afterTest hook and the test cases are now being updated with the correct result.
test.title = test.description;

Might be something to think about adding in a future version?

@gianlucamangiapelo
Copy link
Owner

gianlucamangiapelo commented Sep 13, 2022

That's great news!
Yeah, this is something that I can add in a future version.

@daveplummer20 I'm closing this issue and opening a new one for enhancement: #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants