我正在使用运行我的功能测试。即使没有WebdriverIO,我也可以通过async/await测试。但我读到一些文章说,async/await是编写javascript以处理承诺的最佳方法。
我对Javascript很陌生,对承诺也很失望。在WebdriverIO中编写代码的最佳方法是什么(使用异步/等待,还是不使用回车(例如:关闭配置中的同步并使用此方法)?
wdio.conf.js配置文件声明如下:
// By default WebdriverIO commands are executed in a synchronous way using
// the wdio-sync pack
考虑下面的类,它负责使用.NET HttpClient与API通信。
public class ApiServiceAgent
{
public async Task<string> GetItem()
{
var client = new HttpClient();
var uri = new Uri("http://stackoverflow.com");
var response = await client.GetAsync(uri);
return await response