简体   繁体   English

Xamarin移动应用程序的NodeJS移动应用程序服务(基于天蓝色)的测试设置是什么?

[英]What is the testing setup of NodeJS Mobile App Service (Azure Based) for Xamarin Mobile Apps?

The current documentation gives no guide on testing the app service backend. 当前文档没有提供有关测试应用程序服务后端的指南。 What are the tools or setup needed for unit testing a Xamarin Mobile App Service (based on Nodejs)? 单元测试Xamarin移动应用程序服务(基于Nodejs)需要哪些工具或设置?

There are a bunch of ways to answer this. 有很多方法可以解决这个问题。

Firstly, let's talk about the table controllers. 首先,让我们谈谈表控制器。 These can be "imported" and the functions tested with a mock service. 可以“导入”这些,并使用模拟服务测试功能。 Just supply a mock context with an execute() method on it. 只需提供一个带有execute()方法的模拟上下文即可。 You may find this useful: http://tobyho.com/2015/12/16/mocha-with-promises/ - remember that the table controller methods return promises. 您可能会发现这很有用: http : //tobyho.com/2015/12/16/mocha-with-promises/-请记住,表控制器方法返回promise。

Next, let's talk about the APIs. 接下来,让我们讨论一下API。 You can build up your entire environment and then use Supertest to test the API: https://www.codementor.io/nodejs/tutorial/testing-express-apis-with-supertest 您可以构建整个环境,然后使用Supertest测试API: https : //www.codementor.io/nodejs/tutorial/testing-express-apis-with-supertest

A great source of tests are the tests that are supplied with the node SDK. 测试的一个很好的来源是节点SDK随附的测试。 They can give you great information about how we test the Node SDK before it is released. 他们可以为您提供有关如何在发布Node SDK之前对其进行测试的重要信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM