简体   繁体   English

控制台应用程序开始CodedUI测试

[英]Console App to start a CodedUI test

I have a coded ui test that I want to start by using batch, its a .dll file. 我有一个编码的ui测试,我想通过使用批处理(一个.dll文件)开始。

The reason I'm calling it from a batch file is that the server has to be restarted before this test can be carried out. 我从批处理文件中调用它的原因是,必须先重新启动服务器,然后才能执行此测试。

Is it just a simple call test.dll or do I have to do other stuff? 它只是一个简单的call test.dll还是我必须做其他事情?

Update Code Found 找到 更新 代码

Playback.Initialize();
TestProject.CodedUITest1 coded = new TestProject.CodedUITest1();
coded.CodedUITestMethod1();
Playback.Cleanup();

Take from Here , Its missing two reference addings from the private assemblies: 此处获取 ,它缺少私有程序集中的两个参考添加:

  1. Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.dll Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.dll
  2. Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll

Hope this helps other people looking to do this 希望这可以帮助希望这样做的其他人

You can't run a Dll file like you can an exe. 您无法像执行exe一样运行Dll文件。 A Dll contains code intended to be used by a program, it means one source of code can be used by many programs, which saves duplicating the code. Dll包含打算由程序使用的代码,这意味着许多程序可以使用一个代码源,从而节省了重复代码的时间。

Usually the Dll will have documented functions you can call via a program, unless you built it yourself in which case you would know :) 通常,Dll具有可以通过程序调用的文档化功能,除非您自己构建了它,否则您将知道:)

Try and find the program that uses the Dll and call that, or find the docs for it and run the function from rundll32 as @PA. 尝试找到使用Dll的程序并对其进行调用,或者为其找到文档,然后以@PA的身份运行rundll32中的函数。 suggested. 建议。

DLLs are dynamic libraries that need to be linked and called from an application program. DLL是动态库 ,需要从应用程序进行链接和调用。 Every DLL has its own exported interface, or collection of entry points to be called from the external executable, or, may be, from another DLL. 每个DLL都有其自己的导出接口,或要从外部可执行文件(也可以从另一个DLL)调用的入口点的集合。

Windows provides a set of calls to help caller programs to load, detect entry points, and unload DLLs. Windows提供了一组调用来帮助调用程序加载,检测入口点和卸载DLL。 Beyond this limited common functionality, there are endless combinations of ways of using a DLL, in the calling conventions, in the ways of passing parameters, in the types of the parameters, in the ways of returning data, in the ways of synchronizing, notifying events, interrupting, multithreading, in almost every aspect of programming models. 除了这种有限的通用功能之外,在调用约定,传递参数的方式,参数的类型,返回数据的方式,同步,通知的方式中,DLL的使用方式还有无穷无尽的组合。编程模型的几乎每个方面都有事件,中断,多线程。

Having said so, it is possible that your DLL is expected to be called from some specific application program, and thus is possibly following and strict and well defined API. 话虽这么说,但您的DLL有望从某些特定的应用程序中被调用,因此可能遵循并严格定义好API。 One such type of DLLs are Windows System DLLs that are intended to be run with rundll executable program. 一种此类DLL是Windows系统DLL,旨在与rundll可执行程序一起运行。 rundll32.exe is the Windows system executable that launches and invokes functions that are packed and shipped in .dll files, from a DLL that is explicitely programmed to be called this way. rundll32.exe是Windows系统可执行文件,它从显式编程为以这种方式调用的DLL中启动和调用以.dll文件打包和运送的功能。

to invoke your TestFunction inside your TEST.DLL, passing 1234 as a parameter, you'd use 调用TEST.DLL内的TestFunction,将1234作为参数传递,您可以使用

RUNDLL32  TEST.DLL, TestFunction 1234

Rundll will perform for you the following tasks Rundll将为您执行以下任务

  • Load TEST.DLL via LoadLibrary(). 通过LoadLibrary()加载TEST.DLL。
  • Address the TestFunction function via GetProcAddress(). 通过GetProcAddress()寻址TestFunction函数。
  • Call TestFunction function, passing the rest of the command line 调用TestFunction函数,并传递其余命令行
  • Unload the DLL and exit. 卸载DLL并退出。

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

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