Closed Avinash-Kannan closed 2 years ago
Hi @Avinash-Kannan Can you provide your wdio configuration file and useful information for troubleshooting? Thanks
@gianlucamangiapelo I have added below lines of code in wdio config file and added package using npm install.
import AzureDevopsService from "@gmangiapelo/wdio-azure-devops-service";
// wdio.conf.js
exports.config = {
// ...
// =====
// Setup
// =====
services: [ ['appium', {
command : 'appium'
}],
[ AzureDevopsService,
{
pat: 'token',
organizationUrl: 'https://dev.azure.com/org',
projectId: 'id',
planId: id,
suiteId: id,
runName: 'FE regression tests for TestPlan',
},
],
],
// ...
};
It didn’t throw me any error / logs related to added service. My Appium mobile tests got passed and couldn’t find anything useful in logs related to azure-devops service added. Kindly share an example repo if any for reference.
@Avinash-Kannan What scope you set when you have generated the PAT?
The scope for the token should be Test Management with Read&Write permission.
Yes exactly , I have did the same. Custom defined to read & write access for test management. Will there be any logs printed in console related to this service - example, any success message kind of? @gianlucamangiapelo
Steps that i followed : @gianlucamangiapelo
it("12345 Validate Login")
Test got passed, nothing got updated in Azure test plan. I saw the report example screenshot in your repo readme. But couldn’t find anything as such. Am i missing something ?
@Avinash-Kannan
All the steps that are you doing are correct, except for the 4. point.
In the title of the test cases, you have to add the testCaseID that you collect from AzureTestPlan preceded by the letter "c":
it("c12345 Validate Login")
To help in troubleshooting you can enable in your wdio.conf.js one of the loggers adding these lines:
logLevel: "trace",
outputDir: path.join(__dirname, "/logs"),
This will produce in the /logs folder a wdio.log file and inside it, you can search for the keyword: @gmangiapelo and see if any errors are produced.
Let me know your findings.
Right now any boilerplate/example repositories are available, I'll try to work on it.
Hi @gianlucamangiapelo, I have tried this service with below code and getting errors.
wdio.conf.js file:
import AzureDevopsService from "@gmangiapelo/wdio-azure-devops-service";
services: ['chromedriver', [AzureDevopsService,
{
pat: 'token',
organizationUrl: 'https://dev.azure.com/org',
projectId: 'id',
planId: id,
suiteId: id,
runName: 'FE regression tests for TestPlan',
},
],
],
Spec file: it('c1234 Verify that the user can train the document type -> regression', async () => { ..... });
Errors: ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook undefined ERROR @wdio/cli:utils: A service failed in the 'onComplete' hook Error: {"count":1,"value":{"Message":"The requested resource does not support http method 'PATCH'."}}
Do we need to encode the token in base64 format?
Am I missing anything?
Thanks in advance
Hi @bhumireddy100, can you copy the entire log file? Thanks
PS: the plugin itself is doing the right encoding
Hi @gianlucamangiapelo, here is the two logs. wdio.log: 2022-08-01T10:12:21.896Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package 2022-08-01T10:12:21.991Z DEBUG @wdio/utils:initialiseServices: initialise custom service "AzureDevopsService" 2022-08-01T10:12:22.009Z INFO @wdio/cli:launcher: Run onPrepare hook 2022-08-01T10:12:22.013Z INFO chromedriver: Start Chromedriver (C:\Users\Venkata.Bhumireddy\Project\workspace\TestAutomationFramework\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --port=9515 --url-base=/ 2022-08-01T10:12:23.939Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook undefined
Continue...
2022-08-01T10:12:23.939Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 1930ms
2022-08-01T10:12:23.941Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-08-01T10:12:23.941Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2022-08-01T10:12:23.942Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,wdio.conf.js
2022-08-01T10:13:03.148Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 0
2022-08-01T10:13:03.149Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2022-08-01T10:13:03.149Z DEBUG @wdio/cli:utils: Finished to run "onWorkerEnd" hook in 0ms
2022-08-01T10:13:03.150Z INFO @wdio/cli:launcher: Run onComplete hook
2022-08-01T10:13:04.144Z ERROR @wdio/cli:utils: A service failed in the 'onComplete' hook
Error: {"count":1,"value":{"Message":"The requested resource does not support http method 'PATCH'."}}
at RestClient.
Continue... 2022-08-01T10:13:04.145Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 995ms 2022-08-01T10:13:04.176Z INFO @wdio/local-runner: Shutting down spawned worker 2022-08-01T10:13:04.434Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
wdio-0-0.log::
2022-08-01T10:12:25.372Z INFO @wdio/local-runner: Run worker command: run
2022-08-01T10:12:25.676Z DEBUG @wdio/config:utils: Found '@babel/register' package, auto-compiling files with Babel
2022-08-01T10:12:27.073Z DEBUG @wdio/local-runner:utils: init remote session
2022-08-01T10:12:27.078Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
2022-08-01T10:12:27.177Z DEBUG @wdio/utils:initialiseServices: initialise custom service "AzureDevopsService"
2022-08-01T10:12:27.552Z DEBUG @wdio/local-runner:utils: init remote session
2022-08-01T10:12:27.553Z INFO webdriver: Initiate new session using the WebDriver protocol
2022-08-01T10:12:27.658Z INFO webdriver: [POST] http://localhost:9515/session
2022-08-01T10:12:27.658Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
firstMatch: [ {} ]
},
desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
}
2022-08-01T10:12:28.788Z DEBUG @wdio/utils:shim: Finished to run "before" hook in 0ms
2022-08-01T10:12:28.795Z DEBUG @wdio/utils:shim: Finished to run "beforeSuite" hook in 0ms
2022-08-01T10:12:28.801Z DEBUG @wdio/utils:shim: Finished to run "beforeTest" hook in 0ms
2022-08-01T10:12:28.803Z INFO webdriver: COMMAND maximizeWindow()
2022-08-01T10:12:28.804Z INFO webdriver: [POST] http://localhost:9515/session/88eced843703537f5e163102f1ca6c40/window/maximize
2022-08-01T10:12:28.928Z INFO webdriver: RESULT { height: 840, width: 1552, x: -8, y: -8 }
2022-08-01T10:12:28.942Z INFO webdriver: COMMAND setTimeouts(5000, 60000, 300000)
2022-08-01T10:12:28.942Z INFO webdriver: [POST] http://localhost:9515/session/88eced843703537f5e163102f1ca6c40/timeouts
2022-08-01T10:12:28.942Z INFO webdriver: DATA { implicit: 5000, pageLoad: 60000, script: 300000 }
2022-08-01T10:12:28.953Z INFO webdriver: COMMAND navigateTo("url")
2022-08-01T10:12:28.953Z INFO webdriver: [POST] http://localhost:9515/session/88eced843703537f5e163102f1ca6c40/url
2022-08-01T10:12:28.953Z INFO webdriver: DATA { url: 'url' }
2022-08-01T10:12:58.623Z INFO webdriver: COMMAND findElement("xpath", ".//button[normalize-space() = "Upload"]")
2022-08-01T10:12:58.623Z INFO webdriver: [POST] http://localhost:9515/session/88eced843703537f5e163102f1ca6c40/element
2022-08-01T10:12:58.623Z INFO webdriver: DATA { using: 'xpath', value: './/button[normalize-space() = "Upload"]' }
2022-08-01T10:12:59.634Z INFO webdriver: RESULT {
'element-6066-11e4-a52e-4f735466cecf': '5be40385-7d63-4199-9dd0-4a0b25a01501'
}
2022-08-01T10:12:59.657Z INFO webdriver: COMMAND executeScript(
Thanks in advance
@bhumireddy100 One possible issue could be that you're passing in the configuration wrongs
projectId: '',
planId: ,
suiteId: ,
Can you double check and share how you're retrieving this data (attach screenshot if feasible) Thanks
Hi @gianlucamangiapelo, thank for your quick help. Now I am able to update test results in test plan. Actually plan id 'XXXX'(e.g. 1234) is displaying in ADO and it is not working. I got plan id (e.g. 1233) through the api end point and it is working fine. API End Point: https://dev.azure.com/orgname/projectname/_apis/test/plans?api-version=5.0
I have 6 test cases in ADO suite and running only 2 test cases from automation code(not developed automation test scripts for 4 test cases). Service created Run with all 6 test cases under Test results tab(2 tc's are passed and another 4 tc's are unspecified). Also 4 test cases(don't have automation scripts) are displaying with outcome 'In Progress' under Execute tab. Is it actual behavior?
Ciao @bhumireddy100, happy to read good news.
Also 4 test cases(don't have automation scripts) are displaying with outcome 'In Progress' under Execute tab. Is it actual behavior?
Yes right now it's the expected behavior, need to figure out if I can set another status.
Tried this service as per documents : https://webdriver.io/docs/gmangiapelo-wdio-azure-devops-service But couldn’t find anything reflected in my Azure Test plans.