在单元测试方法中打开Windows窗体 [英] Open Windows form in unit testing method

查看:100
本文介绍了在单元测试方法中打开Windows窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MS单元测试或NUnit单元测试项目中,如何在测试方法中打开一个窗体。

In MS unit test or NUnit unit test project, How to open a windows form in Test methods.

我想打开一个窗体并在表单中输入输入。

I want to open a windows form and enter the inputs in the Form.

根据输入的输入值,我想验证相关数据并显示测试结果

Based on input values entered, I want to validate the relevant data and show the test results

如果这不可能,我们可以从windows应用程序执行单元测试方法吗?

If this not possible, can we executed the unit test methods from windows application?

推荐答案

MS单元测试和NUint用于测试您的代码。   您将创建一个测试方法,该方法可以调用您的代码并验证您所期望的内容。

MS unit tests and NUint are for testing your code.   You would create a test method which would call your code and verify what you expect back is what you get back.

https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-mstest

如果你想测试一个Windows窗体,你需要查看自动UI测试

If you want to test a windows form you would need to look at the automated UI tests

https:// docs.microsoft.com/en-us/visualstudio/test/use-ui-automation-to-test-your-code?view=vs-2019


这篇关于在单元测试方法中打开Windows窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆