
I have been working in test automation for over five years. Most of all I worked with Windows. We write scripts on Borland SilkTest. I am familiar with other automated test development environments, such as QTP and TestComplete - each product has its own advantages, but, unfortunately, its own drawbacks. There are problems that are very difficult to solve
"without leaving the system" *I will not brag. I am not the most intelligent and not the most experienced person on this Planet, but my experience is quite enough for solving everyday tasks. 5 years ago, I received 3 simple and basic skills that I use in solving new problems so far.
In the 10th grade, I read about DOS commands
This happened even 7 years ago. I became interested in how standard DOS commands work, and that input and output streams of console commands can be output to a text file.
How can this be useful? Everything is very simple. Here is an example.
Suppose in one of the tests you need to get a list of all the files on the C: \ drive before installing the application under test, and compare them with the list of files after the installation. Thus, it will be possible to understand which files were changed / added during the installation process.
')
This is done simply by the following cmd.exe command:
dir C: / B / S> initial_c.txtThe dir C: / B / S command collects all the files, folders, and subfolders on the C: drive and writes the contents to the initial_c.txt file using the stream output redirection function “>”.
I already feel how bearded programmers shout in indignation "Author for a stake!" Yes, so we wrote the program ... Yes, never! ". But let me explain.
Initially, in SilkTest (language 4 Test Script) I already tried to write a recursive function that traveled through the directory tree. The result was that:
- The function was complex. Using handlers on directories, structures with information about directories, recursion - all this can not be simple.
- The function often stumbled over the permissions of certain directories on some systems.
- As it turned out, she worked 25 times slower than dir C: / B / S
Automated testing is akin to programming. But, unlike the developers who create a product that the whole world sees - our tests will not leave the walls of the company. Therefore, it is possible and necessary that the tests remain simple.
Replacing the body of a complex recursive function to obtain a directory tree with a simple dir C: / B / S command is an effective and good practice for the tester.
It also turned out that the xcopy command is more stable than the standard SilkTest SYS_CopyFile function, and the md dir1 \ dir2 \ dir3 command is able to create a directory for the nonexistent directory dir3 in the nonexistent directory dir2 ...
The command line still carries many goodies. It is worth mentioning the systeminfo, which gives a brief, but very useful information about the system; wmic is a command capable of issuing complete system configuration information; msiexec is a separate song that allows you to automate the installation of Windows applications on a test system, the reg * command family, which makes it very easy to get information from the Windows registry; The net * command family used for any necessary network settings.
The command line is very efficient. But, I am writing about this because, according to my observations, 80% of people either do not know it or avoid it.
If I had come up with time management, then I would write the first postulate:
"Learn the command line."I wrote Notepad on pure Win 32 API
I did not just read the book by P. V. Rumyantsev "The
Alphabet of Programming in the Win 32 API ". I immediately tried to realize what I read. I will say right away, creating graphical applications on the Win API is not sugar for you. Then I bow my head in front of those bearded programmers who wrote under Win 3.11 / Win 95 on the Win API, and wanted to impale me at the beginning of this article.
But, I was very interested. After exploring Delphi, jumping from this abstraction of VCL was cool. It turned out that all Windows windows. Yes, any control, any dialog and even the Desktop is a window. Oh, believe me, it was an insight. I learned how to use SendMessage, I understood how all these windows are identified ...
Soon when I started working with SilkTest - knowledge of the Win 32 API helped me a lot. Now, when I come across any problem that I can’t solve with the usual SilkTest tools, I turn to the export of Win API functions.
Fresh example from my practice. Before starting the next test, it was necessary to collect a list of open windows of third-party applications and their child windows. It turned out that in SilkTest there is no such function that would return a list of all open windows. And our existing collection mechanism for open windows was on crutches, it worked very slowly and often failed. After we applied the WinAPI functions
EnumWindows and
EnumChildWindows , the closing time of all windows was reduced 20 times, from 20 minutes to one. And the new and significantly simplified algorithm did not give a huge number of failures, as it was before.
I understand that today programming under Windows is covered with abstractions of the .NET Framework WinForms and Windows Presentation Foundation. But, the experience of programming in Spartan conditions WinAPI, you will be extremely useful. In addition, bearded programmers know that the same .Net Framework 4 cannot provide you with all the functionality that the Windows API provides, so very often, serious projects use the Windows API import of functions, the so-called P / Invoke.
So do
not be lazy to get the programming skills Win32 API.I studied Perl
That was 5 years ago, and a lot of water has flowed from that time, and a lot of views have changed. Now I don’t want to vehemently assure you that Perl is the best programming language on this planet. Perhaps he will be again popular on some other planet on which he is the official international programming language. But, I want to give one piece of advice - learn any dynamic programming language that you like. Now, I feel great potential in Ruby. Perhaps because it is an explosive mixture of Python and Pearl. Before I started writing on Pearl, behind me was the good old laboratory Pascal and a bit of C. You have no idea how many pieces scattered, exploded, my brain. On Pearl for me it was wildly interesting to write scripts. I started with small web scripts from the textbook, and a year later I created the website of my college on my own crooked engine. But, it was very interesting. A year later, after I got a job, I wrote a monitoring and reporting system for our automated testing process. We still use it.
I emphasize, I'm not the only one who uses it, but our entire team and bosses, and this is insanely pleasant.
And all thanks to the negative motivation. Yes, if I hadn’t done this, I would still be sitting and tugging reports from Outlook to Excel. No, rather, thanks to Pearl. Because, at that moment, it was very easy to get a test report from the mail, parse the data and put it into a MySQL table. And then - to raise your server, and display data using your own, but less curved engine.
In addition, more than once Pearl saved me a lot of time and saved me from death from routine work. Once I was given the task to transfer 3 megabytes of text data from the old format to the new one, while it was necessary to be very careful not to make mistakes. Both the old and new data format was very simple. In half a day I wrote and tested the script, which overtook all the necessary data in the next 3 seconds. The next 3 days I did more interesting things, and I handed over the task to the customer a day earlier.
The second postulate of time management I would do: “Learn Perl!”, Well, more politically correct:
"Learn any dynamic programming language"
* It is impossible to solve the problem at the same level at which it arose. You need to be above this problem, rising to the next level.
Albert Einstein