How to configure usage of Browserstack Observability for Appium without a wdio.conf.ts file?

huangapple go评论62阅读模式
英文:

How to configure usage of Browserstack Observability for Appium without a wdio.conf.ts file?

问题

在我们的Appium测试自动化项目中,我们有一个定制的配置,不使用默认的wdio.conf.ts文件。到目前为止,我们没有遇到任何问题:驱动程序配置是在一个单独的类中设置的,测试按预期运行。

最近,我们想尝试一下Browserstack的Observability功能。每当我们在运行wdio.conf.js文件的项目上尝试它时,它可以立即使用,但到目前为止,我还没有找到在我们的自动化项目中激活它的方法:配置被接受,但在Observability中没有显示任何数据。我已经花了几天时间尝试调整配置使其工作,但没有成功。

请注意,我们还联系了Browserstack支持:他们说我们的配置本身是正确的,所以他们现在也不知道为什么数据不会显示。

我设法创建了一个小型示例项目,产生了相同的问题,可以在这里找到。我将它发送给了Browserstack以供调查,但如果这里有人有一些经验或见解,我们将非常乐意听取!如果找到解决方案,我们也会在这里发布。

TLDR:有人能找出为什么这个示例项目中的数据不显示在Observability中,以及如何修复吗?

提前感谢!

英文:

In our Appium test automation project, we have a customized configuration that does not use the default wdio.conf.ts file. So far we did not encounter any issues with this: the driver configuration is set up in a separate class and tests run as expected.

Recently we wanted to try out Browserstacks Observability functionality. This works out of the box whenever we try it on a project running with a wdio.conf.js file, but so far I haven't found a way of activating it in our automation project: the configuration is accepted, but no data shows up in Observability. I've spend a few days now messing around with the configuration to get it working, but to no avail.

Note that we also contacted Browserstack support for it: they say our configuration in itself is correct, so right now they also don't know why the data won't show up.

I managed to create a small sample project that produces the same issue, which can be found here. I send it to Browserstack so they can investigate, but if anyone here happens to have some experience or insights in this, then we'd love to hear it! If a solution is found, then it will be posted here as well.

TLDR: can anyone figure out why the data in this sample project does not show up in Observability, and how to fix this?

Thanks in advance!

答案1

得分: 1

您需要为您的项目和构建名称设置一个静态名称,我看到它们在您的代码中是不同的。

以下是Browserstack官方文档中提到的相同内容:
这是您参考的截图和链接:
https://www.browserstack.com/docs/test-observability/quick-start/webdriverio

请在您的测试中进行相同的设置。

这应该可以解决您面临的问题。

谢谢。

英文:

You need to have a static name for your project and build name I see the are different in your code.

How to configure usage of Browserstack Observability for Appium without a wdio.conf.ts file?

The same is mentioned in Browserstack's official documentation:
Here is the screenshot and link for your reference:
https://www.browserstack.com/docs/test-observability/quick-start/webdriverio
How to configure usage of Browserstack Observability for Appium without a wdio.conf.ts file?

Please incorporate the same in your test.

This should resolve the issue you are facing.

Thanks.

答案2

得分: 0

我检查了共享仓库,发现在可观察性服务配置和测试功能中,projectNamebuildName使用了不同的名称。不确定是否有帮助,但建议在两个地方保持相同的名称,这样可观察性将使用该名称并根据它在可观察性仪表板中填充数据。

英文:

I checked the shared repo and could see that you are using different names in projectName and buildName within the observability service config and the test capabilities. Not sure if this would be helpful but suggestion is to maintain same name for projectName and buildName in both places so that observability picks up that name and populates data based on it in Observability dashboard

答案3

得分: 0

Browserstack 服务台调查了这个问题,最终将其升级给了他们的产品团队。几天后,我们收到了以下回复:

> 团队已经查看了您的项目以及其结构,并表示这个设置是一个独立的设置,不支持在此设置中使用服务。wdio-browserstack-service 仅在 TestRunner 模式下支持。您可以在这里找到更多信息:
>
> https://webdriver.io/docs/setuptypes
>
> 目前我们无法支持这个(但我可以提供有关此问题的产品反馈)。建议是使用支持 wdio-browserstack-service 的设置,或者您可以生成测试的 JUnit XML 报告,并使用以下方式上传:
> https://www.browserstack.com/docs/test-observability/quick-start/junit-reports
> 来获得部分可观察性功能的支持。
>
> 我知道这不是您所期望的答案,但如果您有任何问题,请随时联系

事实证明,TestRunner 模式(wdio.conf.js)是必需的,但它尚未包含在文档中。目前,普通设置无法完成此操作。

然而,乍一看,使用 JUnit XML 报告的建议解决方法似乎是可行的。我们已经设置了 JUnit,我可以快速上传这些报告并使用以下代码在 Observability 中查看它们:

static async uploadReportsToBrowserstack(browserstackUsername: any, browserstackAccessKey: any){
    const reportPath = 'C:/report.xml';
    this.logger.logDebug({reportPath});
    this.logger.logInfo('Upload reports to BrowserStack starts...');
    
    const form = new FormData();
    form.append('data', fs.readFileSync(reportPath), reportPath);
    form.append('projectName', 'Junit report uploads');
    form.append('buildName', 'Observability Sample');
    form.append('tags', 'junit_upload, regression');
    form.append('frameworkVersion', 'mocha, 10.3.2');

    const response = await axios.post('https://upload-observability.browserstack.com/upload',form,
        {
            headers: {
                'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
            },
            auth: {
            username: browserstackUsername,
            password: browserstackAccessKey
            }
        }
    );
}

显然,我需要稍微重构一下这个代码,但是这个概念似乎运行良好。感谢所有提供意见的人!

TLDR: 截止到撰写此文,Test Observability 仅支持 TestRunner (wdio.conf.js) 模式,但可以使用上述的解决方法达到预期的结果。

英文:

The Browserstack servicedesk investigated the issue and eventually escalated it to their product team. A few days after, we got the following response:

> The team have had a look at your project and how it is structured and
> have said that this setup is a standalone setup and that services are
> not supported in this setup. The wdio-browserstack-service is only
> supported in TestRunner mode. You can find more information on that
> here:
>
> https://webdriver.io/docs/setuptypes
>
> We won't be able to support this as of now (I can however; file
> product feedback on this point). The recommendation is to use a setup
> that supports the wdio-browserstack-service or you can generate a
> JUnit XML report for your test and upload that using,
> https://www.browserstack.com/docs/test-observability/quick-start/junit-reports,
> to get partial observability features supported.
>
> I know this isn't the answer you were looking for but please reach out
> if you have any questions

As it turns out, the TestRunner mode (wdio.conf.js) is a requirement for this, which was not included in the documentation (yet). Right now it simply cannot be done by normal setup.

However, at first glance, it seems like the suggested workaround with JUnit XML reports is feasible. We already had JUnit set up, and I can quickly upload these reports and view them in Observability with the following code:

static async uploadReportsToBrowserstack(browserstackUsername: any, browserstackAccessKey: any){
    const reportPath = 'C:/report.xml';
    this.logger.logDebug({reportPath});
    this.logger.logInfo('Upload reports to BrowserStack starts...');
    
    const form = new FormData();
    form.append('data', fs.readFileSync(reportPath), reportPath);
    form.append('projectName', 'Junit report uploads');
    form.append('buildName', 'Observability Sample');
    form.append('tags', 'junit_upload, regression');
    form.append('frameworkVersion', 'mocha, 10.3.2');

    const response = await axios.post('https://upload-observability.browserstack.com/upload',form,
        {
            headers: {
                'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
            },
            auth: {
            username: browserstackUsername,
            password: browserstackAccessKey
            }
        }
    );
}

Obviously I'll need to refactor this a bit, but the concept seems to be working fine. Thanks to everyone who gave their input on this!

TLDR: As of the time of writing, Test Observability only supports TestRunner (wdio.conf.js) mode, but the intended result is possible with the workaround described above.

huangapple
  • 本文由 发表于 2023年6月1日 16:20:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379954.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定