Monday, March 11, 2019

Coded UI deprecated, WinAppDriver & Appium is the future


Learn automated testing with WinAppDriver in my latest course. Five day course launch limited time coupon @$9.99: 
https://www.udemy.com/course/appium-winappdriver-automation-testing/?couponCode=0B4AAB139DEA09114D95

https://www.udemy.com/course/appium-winappdriver-automation-testing/?referralCode=ED22C3A4CE5BB5E22E53

WinAppDriver Vs. Coded UI is a pointless question to ask. Just use WinAppDriver if you're starting UI test automation of your Windows application from scratch. Yes, there will be support for Coded UI for a while, but ultimately it will be phased out. 
The differences between WinAppDriver and Coded UI are given here
You read it right, Microsoft's flagship test automation tool, the CodedUI is dead. Microsoft has started to announce it that it is deprecating Coded UI publicly as well. The C# and VB.Net Coded UI project types are now showing deprecated written right next to them. Various MSDN help articles state clearly that Coded UI won't be supported after Visual Studio 2019. 
This is it, the end of road for Coded UI, see the image below :'(

Proof that Microsoft Coded UI is deprecated


Screenshot, CodedUI C# VB.Net Projects Deprecated


I came to notice this fact when I installed Visual Studio 2019 RC on my Windows 10 PC, in Feb/March 2019. 
I've been using(or wresting with) Coded UI for a quite a few years now. I naturally thought what will be the next solution for UI test automation of Windows applications. 
The Future of Windows Test Automation
The answer was right there alongside the death announcement of Coded UI. The new way to go is according to Microsoft, their free & open source WinAppDriver combined with Appium WebDriver. 
Microsoft recommendation is Selenium and Appium instead of Coded UI
Windows Application Driver a.k.a WinAppDriver is going to be need Windows 10 to run tests. That too in developer mode. Automated functional testing of legacy Win32 applications will be possible on Windows 10. This includes testing WPF, WinForms, and UWP applications using WinAppDriver.
 
You'll need to install Node.js and WinAppDriver for this purpose. Microsoft .Net framework is needed to make it work.
Microsoft Coded UI is dead and deprecated WinAppDriver with Appium in C#.Net is future
You also must have developer mode enabled in Windows 10 to run WinAppDriver.
I will be publishing more tutorials about this topic in the future. Subscribe to my channel and stay tuned. 
The WinAppDriver can be downloaded from the Git repository here
A UI recorder is also available for helping you in identifying control properties. 
Microsoft Coded UI is dead and deprecated WinAppDriver with Appium in C#.Net is future
Your scripts are going to communicate with the WinAppDriver using http. The UI automation code might be written in C# .Net or many other languages available. 
The UI or test automation code can be placed on the same machine as the driver, or on a different machine. 
Microsoft Coded UI is dead and deprecated WinAppDriver with Appium in C#.Net is future
Just in case you want to learn what is Windows Application Driver or WinAppDriver for short all about. I am working to prepare an online Udemy course for the subject. I'm using C# .Net and Visual Studio community edition for the instructions shown in this course. Don't worry, Microsoft is killing a closed source proprietary tool which was pretty evil anyway. The WinAppDriver is free & open source. Entire code base is available for you to see on GitHub. In fact it is a pretty active repository. 
The UI recorder that comes bundled with WinAppDriver is also pretty neat for finding controls and generating XPath for location them. 

Sunday, March 10, 2019

Using text logging library Log4Net in automated tests



https://www.udemy.com/windows-service-programming/?couponCode=HALF

https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF

https://www.udemy.com/udpsocketprogramming/?couponCode=HALFPRICE

https://www.udemy.com/course/windows-ui-automation-on-azure-devops-build-pipelines/?referralCode=31F4FCC272434D3B1C3C

It is possible to add text logging functionality to our Windows Service or test automation scripts using Log4Net. You can also add Log4J-based test logging to your test automation scripts if you're working on the Java platform. 

Why do we need text logging?
We need it because it allows us to learn about the internal state of our test automation scripts or Windows Service. The applications which don't have a console available to print information can write a text log which can then be used to trace their state for debugging. 
Writing everything to the system log is not viable. That's why putting information in a text file is a common practice. So that you can know what flow leads to an error or a service crash
I'm going to introduce you to the Log4Net logging library
Apache Log4Net is a free & open-source logging library. It is used to generate rolling text log files
Rolling means that the library is responsible for rolling the log files
In other words, creating new files when the file size exceeds a set threshold or the date is changed
Log4Net can be used to write information to various logging targets, including network and databases
Using a logging library means we're not reinventing the wheel.
It helps us to change what gets written to the log file based on specific configuration values
Now that you know why we're using a logging library, you can go to Visual Studio and continue coding.