如何将 HTTP 请求从设备发送到在 Xamarin Test Cloud 的测试运行器中运行的服务器

How do I send a HTTP requests from a device to a server which runs in the testrunner of Xamarin Test Cloud

我正在使用 Xamarin.UITest 对 Android 和 iOS 应用程序进行自动化测试。此应用向网络服务器发出一些 HTTP 请求。
出于测试目的并轻松响应测试用例所需的数据,我在测试中启动了一个临时 HTTP 服务器(我正在使用 HttpListener)并调整应用程序,因此它向这个临时服务器发出请求。

当我 运行 在我的设备和模拟器上进行本地测试时,一切正常。
当我 运行 Xamarin 测试云中的测试时,我无法连接到 HTTP 服务器。 Url 在这种情况下将是 http://executionhost11.prod:/...

这个用例在 Xamarin 测试云中是否可行?
我是否必须使用某些特定端口(我试过 8081 和 7103)?

Submitting Tests to Xamarin Test Cloud 指南中描述了连接到 Test Cloud 的要求。具体说:

Internet access to the Test Cloud web servers is required. Firewalls should be configured to allow traffic to the Test Cloud servers at the following IP addresses:

  • 195.249.159.238
  • 195.249.159.239

The Test Cloud servers require port 80 and 443.

Android applications must request the INTERNET permission in AndroidManifest.XML.

无论您是在上传测试(这是指南中描述的主要场景),此处的信息都是真实的;并在与服务器通信时保持不变,因为您的服务器将需要访问这些 IP 地址。

Xamarin 支持人员通知我,Xamarin Test Cloud 不支持我的用例。

在设备和执行器之间设置了防火墙,阻止了从设备到测试执行器的连接。

推荐型号为:

  • 启动一个云托管的 HTTP 服务器
  • 在设备上启动 http 服务器