Monday, March 11, 2019

Coded UI deprecated, WinAppDriver & Appium is the future


Learn Windows desk app test work with my course, Windows Desktop Applications Test Automation in WinAppDriver. Use code CBP2026AU to save on it: 
https://www.udemy.com/course/appium-winappdriver-automation-testing/?couponCode=CBP2026AU

Update (2026): Coded UI is now fully gone, not just marked as old. The call made here back in 2019 held up. WinAppDriver is still the free, go-to start point most folks use, and it is what this whole blog and my course lean on. Fair note though: by 2026, its own upkeep has slowed a lot, so once you know the core ideas here, it is worth a look at newer tools like FlaUI too. The core skill here, how you call a driver with WebDriver style calls, moves with you no matter which tool you end up on.

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 the 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 will need Windows 10 (it also runs on Windows 11) to run tests. That too in developer mode. Automated functional testing of legacy Win32 applications will be possible on Windows 10 and 11. 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 Windows Application Driver, or WinAppDriver for short, is all about: I now have a full Udemy course on it, Windows Desktop Applications Test Automation in WinAppDriver (code CBP2026AU). It uses C# .Net and Visual Studio for all the steps shown. Don't worry, Microsoft moved away from a closed, paid tool that was not great to begin with. WinAppDriver is free and open source, code and all, up on GitHub for you to see. Just know that by 2026, its GitHub repo does not move as fast as it once did, so treat it as a solid base to learn from more than a tool that gets new work often. 
The UI recorder that comes bundled with WinAppDriver is also pretty neat for finding controls and generating XPath to find them. 
If you want it all in one place, my course above has it all.

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.

Thursday, February 21, 2019

How to install a .Net based Windows Service using InstallUtil.exe, see its status, start/stop it



How to Install a Windows Service Using InstallUtil and command prompt from Naeem Akram on Vimeo.




A demo day be really frustrating or it can be the happiest day of an IT professional's life.
Now I'm going to demonstrate the stuff which we've created so far in this course

You may join my course with special discount using the link given below.

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


The windows service solution is already open
I'll go and click build and build solution
Now I'm going to expand solution explorer
And click the button , "Show all Files"
Next I'm going to expand the "bin" folder
 then I'll right click the "debug" folder and select "open folder
 location"
 Take a brief look at the contents of this folder
The file Udemy Windows Service dot exe is going to run as our service.
For this purpose, we're going to use installutil.exe
It is shipped along with Microsoft .Net framework.
For this purpose I'm going to launch the developer command prompt
I'll click the Windows Button and type "Developer command prompt"
The developer command prompt for vs is showing on top
I'll right click this shortcut and select menu option "Run as
administrator"
Now I'm going to type the command installutil.exe space -i space
And then the path of the file which we want to install as a service.
I'll go back to the debug folder and shift right click the Udemy
Windows Service .exe file
I'll select the context menu option "Copy as path"
Now I'll go back to the command prompt windows
I'll right click it and select context menu option edit
And then select Paste

The full command is installtuil.exe pace minus i space path of
our windows service exe file
I will hit enter key on command prmopt

The system shows that the commit phase completed successfuly

Let us see if the service is showing up service control managter
or not
I'll open the SCM by pressing Windows R and typing services.msc
Inside the name column, I'll look for Udemy Demo Service
We can click inside the name column and press Udemy
You can see our very own Windows Service named "Udemy Windows Service"
 along with the descritpion
"My hello world servoce" right here
And it has got logon as "Local System"
You'll see that status of the service will change to "Running"
The actions button on top right will also change from start to stop
 and restart
I'm now going to click the stop link and that should stop the service
without any fuss
You see a progress bar popup
And the service status is changed to stopped.
That is it for this video
In the next one we'll take a look at the event log



Wednesday, February 6, 2019

Difference between a Windows Service Solution and a Console Application By Example


Windows Services are the engine that most people never see, these are entirely different beasts. Common differences between Windows Services & Console/Windows/Web applications shown in this image. Learn Windows Service Programming with C# in my Udemy course, here's 50% off discount.

Learn Windows Service Programming on Udemy Message Box

There are some major differences between a Windows Service executable and simple exe files. This difference is also present in Visual Studio Solution. 
Learn Windows Service Programming in C# .Net by enrolling in my Udemy course now, here's a discount coupon code. 


Let’s open a console application project in Visual Studio.
First of all I will press ‘Control + F5’
You will see the console application starts working right away
Now let’s go to a Windows Service project and try the same, when I press F5 the exe does not start to run.


Let me explain a couple short things first.

OnStart method of a windows service is being shown on the screen

Learn Windows Service Programming on Udemy Message Box


The OnStart method of the service is called by Windows when a user clicks “Start” link on the Service Control Manager
In our demo code, we are writing some text to the debugging console in this method
Let me press ‘Control+F5’ keyboard shortcut once again
Learn Windows Service Programming on Udemy Message Box
Boom! a message box says you can’t run a Windows Service from debugger baby.

This is the first difference

You can't just hit Ctrl+F5 to run a Windows Service Solution. 


Now let’s head back to the console application project
Inside the main method, I will place a breakpoint on a Console.WriteLine which prints Hello World!

And I will click ‘Debug’ menu and select the menu item ‘Start Debugging’
You see, the breakpoint is hit instantly

I’ll press F5 so that the application continues execution
Let’s try to do the same with the Windows Service project
I will place a on Debugger dot writeline
Go to ‘Debug’ menu and click ‘Start Debugging’

The same error shows up again

Learn Windows Service Programming on Udemy Message Box


This is difference number two


Finally, let us go to the output directory of our console application(any console application)

Double click HelloWorld.exe file
You see, the application starts working right away
Let’s go to the output directory of the service project and try to run it by double clicking the .exe file in a similar fashion
Oops! It won’t start dancing to your tunes
This is the third difference

We need to install the a Windows Service before we can run it

You will learn how to install a Windows Service in next section of my course. Please sign up here. 



MPORTANT: The source code for section 1 can be downloaded from my Windows Service Course .

Monday, February 4, 2019

What is socket programming?


Socket programming is, first of all, a means of boosting ego among the geeks and nerds who know it.
There are two types of programmers, one who has done socket programming and one who has not.

You may learn socket through the discounted links below; I teach two courses about socket programming on Udemy.

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

https://www.udemy.com/course/udpsocketprogramming/?referralCode=9A39D0BAEBF79DBDE6A3


Aside from this difference, the term "socket" is referred to a software-level construct that can be used to access a computer network. The term "access" encompasses two things:

  1. A computer reading data from the network sent by another computer
  2. A computer writes data to the network to send it to another computer

It appears simple when we send a message over a computer network using an app like Whatsapp. But there's a lot of complexity going on underneath it. Even the programmers must be shielded from the radiation of things like the OSI model and BGP. That's where sockets come in. Let me give you the simple definition of a socket.

Socket: 
A socket is a variable you can create in a high-level programming level, such as C#, Java, or C++. Once you have the socket, you can send and receive data using the computer network.
A socket is like an abstraction. It hides a lot of complexity under it and lets the coders write code that results in transmitting their data through WiFi, Ethernet, or any other means.
Sockets are often exposed through various APIs.

A few examples of socket APIs are given below, along with their mother languages.

  1. Java - java.net.*
  2. C# - System.Net.*
  3. C++ - socket.h

Windows provides an implementation of sockets through WinSock2 API. This is, in turn, used by runtimes like JVM(Java Virtual Machine) and .Net CLR(Common Language Runtime).
You don't need to learn C to work on this course.