How do I write test automation tools like QTP and winrunner using .net?

I would like to know how test automation tools like winrunner, QTP, etc. work. Does this tool use any of the testing API provided by windows or does it depend on IPC and events. I couldn't figure out how they work. For me, the QTP recording and playback feature seems to be magic. Any guidance would be much appreciated?

+2


source to share


4 answers


In fact, WatiN is a good place to start. It's not really a unit testing system. It may look like one at first, but it is used to write a functional test. It's entirely up to you if you run them as unit tests. I wrote the same test using WatiN in two ways (functional test that simulated user actions on a web page):

1) Writing a script in Powershell when run from the command line just like any other PS script. It was fun, although you have to write a lot of code for reporting, exception handling, and more.
2) Writing a unit test to MSVS in C # using the C # unit test from the MSVS project type. It was fun because you just ran it in MSVS like a unit test, but you have support for an environment to write code, generate reports, work, etc.



So, if you want to start with something to look at WatiN, especially since WatiN has a special recorder that records actions and outputs the code in C #. By looking at the internals of the library and tool, you get started.

Only one thing is just the web. The desktop is completely different. With web, you have a hook in IE, you can query the html document for objects, check the browser state, and so on. With a desktop, this can be tricky. You need to connect to the app, possibly through the Win32hooks mentioned. Maybe try with Microsoft Scripting Host.

+1


source


I don't know much about QTP. But if you want to know the internals, you can download open source projects like Watin for dotnet and Watir for ruby and see what's going on inside. Both are used to automate web testing. And the code is freely available.



If you're looking for a unit testing framework like Nunit. they are attribute driven. Nunit identifies classes with TestFixtures and methods with Test attributes. It scans the entire application for these test methods and runs the tests.

0


source


I am assuming they are using Win32 Hooks.

edit : here's an example of defining hooks in .NET.

0


source


It should be Win32 / 64 programming in C, C ++ using COM, OLE technologies and they can use Active acceibility API. They could definitely create a large API for these technologies. Even they may have used a bit of programming to build as well.

-1


source







All Articles