Monday, December 30, 2019

Discount on Udemy Courses!



Appium WinAppDriver: Automated UI Testing Windows Apps in C# 


Windows Service Programming, Debugging, Installing in C#.Net

UDP Socket Programming For Distributed Computing in C#.Net (hightest rated course)

https://www.udemy.com/course/udpsocketprogramming/?couponCode=BESTJULY2020

TCP/IP Socket Programming in C# .Net For Coders & Students (best selling course)

These coupons will stay alive only for five days, created as a new year's gift for everyone out there. Enroll in any of my C# .Net Udemy courses for as little as $9.99.
Hurry up, the discount will run out soon.


Hi, 

I hope you’re doing great. All of my courses are now available at the discount price of $9.99 each. Its a limited time offer, please click the links below enrol now. 

Appium WinAppDriver UI Automation Testing Windows Apps in C#(only dedicated course about WinAppDriver on Udemy in a post-CodedUI world)
TCP/IP Socket Programming in C# .Net For Coders & Students(best seller)
UDP Socket Programming For Distributed Computing in C#.Net(highly rated)
Windows Service Programming, Debugging, Installing in C#.Net

Best regards,

Naeem Malik.


Friday, October 11, 2019

What is software testing, software test automation, and functional software testing


Software test automation in Appium WinAppDriver and C# .Net
Software test automation in Appium WinAppDriver and C# .Net

Software testing is the process of using an application according to a test plan to find defects in the application under test.

Automated testing is the discipline that uses various tools to make the machines perform software testing for us with little to no human intervention.

Automated functional testing is one of many types of automated testing.

Functional Testing:
Functional testing is performed through the user interface of an application
A tester performs various operations on the application under test according to certain test cases.
The test cases can be categorized concerning their scope.

Smoke Testing:
Smoke tests are the set of test cases that ensures the application’s basic functionality is intact.
The term originates in the electronics industry, where an appliance is turned on after manufacturing just to ensure it does not burn or give smoke.

Regression Testing: 
Another important classification of test cases is called regression tests,
Regression tests ensure that functionality that was working in the past has not stopped after some application changes.

When to run smoke tests and regression tests?

Smoke tests and regression tests are commonly executed on production systems after changes like

  1. Hardware updates
  2. Firewall (or load balancer)updates
  3. Operating System updates 
  4. General software updates


Common causes of automation testing
The aforementioned reasons mean the testers must perform smoke and regression tests repeatedly after application or system updates.
It is a boring and labor-intensive task. The agony is amplified when the testers have to take screenshots for auditing purposes.
Many such system updates are done during the holidays; the testers have to come and do all testing over the holidays, which adds injury to the insult.

These causes make functional testing a prime candidate for test automation.
For example, my current job(an insurance company) has forty business-critical applications. In the past, about 20 people had to come to the office for testing when a patch was deployed.
But now, all of the work is automated, and only one or two persons come and run all the scripts.

Automated functional testing is performed using various test automation tools
The most powerful way to automate testing is by writing code to perform repeating tasks on the application UI for you.

These scripts also make sure that the application under test is showing the correct expected results
Popular test automation tools also produce test pass/fail reports to give an overview of system health.
Once these scripts are in place, it is possible to configure them with various continuous integration systems such that they can execute the scripts with little or no human intervention
The point to be noted here is that applications under development are unsuitable for automated functional testing.
When an application is under development, it is optimal for testing with other types of automation such as unit testing and integration testing.
A large number of business-critical Windows applications are already deployed across the enterprise world right now
To keep the core business running, these applications must be tested after every system or application update by manual testers.

These applications are the prime candidates for functional test automation
In this course, I will show you how to create test scripts for testing various types of Windows applications such as Win32, WinForms, WPF, and UWP using Microsoft’s next-generation test automation technologies WinAppDriver.

I've launched a course about Automated UI Testing using WinAppDriver with C# .Net; here's a best price discount coupon that will last only 5 days.
https://www.udemy.com/course/appium-winappdriver-automation-testing/?couponCode=0B4AAB139DEA09114D95

After the discount has expired, you may get the course here:
https://www.udemy.com/course/appium-winappdriver-automation-testing/?referralCode=ED22C3A4CE5BB5E22E53

Sunday, August 18, 2019

Software testing and it's relationship with automated testing tools

Software testing is a quality control activity
It is considered to be a repetitive and labor intensive task
Computers in general are you know capable of doing such repetitive, boring, and labor intensive tasks really well.

This is where the test automation tools(Selenium, Appium, WinAppDriver)  come into play.
Test automation tools help us to delegate the labour intensive;  repetitive software testing tasks to the computers, because that’s what the machines do the best.
Making the cyborgs do the boring software testing job frees up time for  Homosepians!, allowing them to be creative; something the machines can’t do well. At least at the time when this course was being created.

Test automation can be divided in two major sections…

  1. “Creating scripts intended to exercise various parts of the software system under test and assert the results shown by the System Under Test or SUT.”
  2. “Running the test scripts to actually exercise the system and display the results.”


Any programming language can be used to write these scripts including but not limited to C# .Net, Java, or Python.

Once the test automation scripts are in place, proper tools are available to run the scripts as well. The job of a test automation engineer doesn't end once the scripts are written. Test engineers are needed maintain the tests in case the application under test is changed.

In general; when we run test scripts they either pass or fail based on the response of system under test. The tests might fail if the test scripts have a bug. Such things can raise a false flag that you've found a defect.

Reports generated by a test run are a work product of automated testing. We can see these reports to assess the correctness of the system in a “quantitative fashion”

Several types of automated testing tools are available in the market

These tools facilitate the process of writing and running test scripts
These tools also commonly include utility software to record user actions and prepare test scripts based on those actions
I will provide you the essential knowledge of the tools related to WinAppDriver and Visual Studio for testing Windows applications and the basic concepts to get you started in the right direction.
The reason for sticking with the basics is that a single course won’t be sufficient to cover all available types of automated testing tools

Monday, July 29, 2019

How to download and run WinAppDriver UI Recorder


Appium WinAppDriver: Automated UI Testing Windows Apps in C#




WinAppDriver UI Recorder is Microsoft's lightweight UI element/object inspector/spy. It is a free product.

Looking for a WinAppDriver tutorial? Check my course on Udemy. It is better than WinAppDriver documentation!

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

WAD UIR(Windows Application Driver UI Recorder) is a part of the WinAppDriver(Windows Application Driver) project, but it can function independently without the WinAppDriver. I find it more accurate, useful, and a better choice than the traditional Windows UI inspector.

WinAppDriver UI Recorder is also known as WAD UIRecorder. After WinAppDriver UI Recorder download, you can use it to identify various UI elements of Windows applications. 

This tutorial will show you how to download and run WinAppDriver UI Recorder with screenshots.

Pre-requisites of Windows Application Driver (WAD) UI Recorder

You don't need to install the WAD UI Recorder. Just download a small zip package, unzip it, and start using it through the .exe file.

You might copy the WinAppDriver UI Recorder folder from one machine to another to run it. You can simply go for WinAppDriver UI Recorder download and use it. 

The WinAppDriverUIRecorder runs only on Windows 10.

You don't need to have Windows 10 Developer Mode turned on to run the WinAppDriver UI Recorder or object spy. This makes it very suitable for day-to-day object inspection on all sorts of  Windows application UI Automation needs on Windows PCs, for test automation or otherwise.

How to download WinAppDriver UI Recorder

Here's the direct download link:

Got to the WinAppDriver GitHub repository by following this link: https://github.com/Microsoft/WinAppDriver

Click on the + {number} release link. 

  1.  
Various versions of WinAppDriver UI Recorder are available for download on this page. Please note that WinAppDriver download items are also available on the same page. 
  1. Right now, I am using "WinAppDriver UI Recorder v1.0 RC". The WinAppDriver UI Recorder version 1.1 RC  has a bug(apparently), and it didn't work on the two machines where I downloaded it. 
  2. WinAppDriver for Windows 10 and windows 11 can be done from the same page.
  3. Click on the "Assets" arrow underneath the release. 
  4. A set of file links will be present on the page, as shown in the screenshot below. 

  5. Click on the link titled "WinAppDriverUIRecorder.zip". 
  6. Unzip the zip file and go inside the newly created "WinAppDriverUIRecorder" folder when the zip file is finished downloading. 
  7. This folder will contain only two files, a file named "WinAppDriverUiRecorder.exe" and another named "UIXPathLib.dll."
  8. To find UI control properties and inspect objects, run the exe file named WinAppDriverUiRecorder.exe file. It is an object spy. 
  9. The file is shown in the screenshot below. There is no specific icon for WinAppDriver UI Recorder file. Although I suppose there has to be one. It deserves to have an icon for itself. 
  10. Double-click the "WinAppDriverUiRecordre.exe" icon to launch it. 
  11. Once launched, the WinAppDriver UI Recorder window will be shown on the screen. A screenshot is given below, FYI. This can be a very helpful tool for automated functional testing because it lets you easily inspect UI objects on a Windows PC and see important information about UI controls. 
  12. Once the UI Recorder is open, it will automatically highlight the UI element under the mouse cursor and show the properties of the highlighted control. 
  13. You might use these properties in UI automation or automated functional testing of Windows applications, especially the enterprise PC applications, which are still widely used inside offices. 
  14. As a sample, I've opened the Windows Calculator application and the WAD UI Recorder side by side. You can see that the number 9 key is highlighted in the calculator, and various properties of these UI elements are shown in the WindowsAppDriver UI Recorder screen. 
You can now use WinAppDriver for windows application automation with confidence. Here is the WinAppDriver tutorial for you(link). 
Please note that WAD UI Recorder provides a full XPath of Windows controls. This makes automated test script writing very easy.

I hope you found this article to be helpful. Please share it on your social media if you think it is useful. 
WinAppDriver for windows application test automation is the best choice. 
You must be careful that the UI element control properties found by the WADUIR are often more helpful. If you find control properties using inspect.exe, they might not be valid with a WAD script. 
If you're looking forward to WinAppDriver Java test automation, you can utilize the examples in the documentation section.

Saturday, June 22, 2019

WinApp Driver vs Coded UI - Windows Test Automation Tools Comparison

Serial
Coded UI
WinAppDriver
1
Coded UI is a Closed source project
Windows Application Driver is a partially Open source project
2
Coded UI is Not hosted on GitHub
WinAppDriver has a repository on GitHub
3
Coded UI is very expensive, it has a hefty license fee, licensed product
[Appium based] WinAppDriver is free software, there's no licensing fee at all
4
Microsoft Coded UI does not follow an industry standard
WinAppDriver is based on WebDriver industry standard(https://www.w3.org/TR/webdriver/)
5
Coded UI is Based on Microsoft’s closed source technologies
WinAppDriver is Based on Appium, WebDriver, and Selenium industry standard open source technologies.
6
Limited to only Microsoft’s chosen programming languages
WinAppDriver Can be extended to support any programming language(C#, Python, Java, C++, you name it). Many APIs already available. If you learn it with one programming language, you can easily take the same cocepts to another language.
7
Coded UI uses a proprietary protocol for communicating with the machines running automation. Remote machines are not supported.
Being based on Appium, WinAppDriver uses JSON wire protocol for communication between an instance of WinAppDriver and test automation scripts. You can also create a grid if need be.
8
Knowing CodedUI won’t land you many jobs in future
Knowing Appium based WinAppDriver makes you suitable for Selenium & Appium mobile automation job. You can switch over to mobile testing with little effort.
9
Supports older versions of Windows OS i.e. Windows 7
Does not support older versions of Windows(works on Windows 10, Windows Server 2016 and above)
10
Almost dead community, not much going on with Coded UI
The community of WinAppDriver is very active online on GitHub.
11
Deprecated, no further enhancements in Coded UI
WinAppDriver is actively in development, continuously improving. Microsoft is pouring resources into it.
12
Coded UI script (C#, VB.Net) runs on a machine directly
A script based on WinAppDriver can control multiple machines using driver instances without even going to the machines under control.
What was CodedUI: CodedUI was a licensed software test automation technology by Microsoft. It was discontinued in 2019.
What is WinAppDriver: WinAppDriver is a free Windows application automation API. It is based on the open-source automation technology Appium. WinAppDriver itself is not open-source.




I've launched a course about Automated UI Testing using WinAppDriver with C# .Net; here's a link:

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

Azure DevOps Build Pipelines: Run Windows UI Automation & CI


This course is a beginner's tutorial about software test automation. It is also a WinAppDriver tutorial and a learning resource. Coded UI is deprecated, and WinAppDriver is the way to go forward.
You're wrong if you think WinAppDriver is only suitable for Windows 10 and want to stay on Windows 7. The support for Microsoft Windows 7 is has ended in 2020.

FYI, the list of essential differences between Coded UI and WinAppDriver(Windows Application Driver) is given above.

Additionally, one Coded UI test could run on one machine only. But a single WinAppDriver script can automate more than one machine. This is very helpful for client-server testing applications.

Appium WinAppDriver Console Window Showing JSON Commands
Appium WinAppDriver Console Window Showing JSON Commands

Please note that my course serves as an excellent WinAppDriver tutorial. You can use it to learn WinAppDriver Windows Desktop automation and use the same concepts with Java or Python languages too.

Almost nobody is focusing on desktop automation and testing because everybody thinks the desktop is dead. But, desktop systems are still the mainstay of many enterprise systems. One such example is ResWare Desktop.
How to test ResWare Desktop?
Automated testing of ResWare is possible using the WinAppDriver. Please see the link to the best WinAppDriver tutorial.



Monday, May 20, 2019

Online Course Introduction: TCP/IP Socket Programming in C#.Net For Coders & Students


Learn socket programming in C# .Net
Big discount coupon link
https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF
Get proficient in computer network socket programming using TCP/IP streaming sockets and become a better professional programmer.



An important concept of socket programming & network communication is covered in every video lecture. Concise C# code examples are supplied in Visual Studio solution form, and a demo after every couple of lectures will show you practical implementation of the concepts described earlier. 
          By the end of this course, you will be able to create CSharp .Net software capable of sending and receiving data over TCP/IP sockets on peer to peer basis with async and await keywords. You will learn not only socket programming, but async/await keywords as well. The course will make you a better programmer.

Why take this course? 
You should take this course if you're a professional(or student) with some coding experience in the past but lack understanding of how computer networks work on a software level(either in C#, Java, or C++). 
You will learn techniques which are useful in real life scenarios commonly faced by programmers. 
Many students of distributed application programming university courses have taken this course in the past and posted positive comments in reviews. They were able to easily complete their assignments on their own after watching this course.                        
Section 1 is available for free, it contains very useful information anybody can benefit from, whether they're familiar with C#.Net or not. 




Minimum upfront theory 
A lot of courses tend to pile up theory ahead of the real code, this course is going take a minimum theory first approach. 
You will learn essentials of network programming and start writing C# code in under 15 minutes. 

Use of Windows Forms and class library
This course will use a class library project in C# along with Win Forms, an approach different from many other courses who use command line projects. My teaching methodology makes the course lot less boring and non-classroom like, practically useful and really suitable for professionals. 
Short, sweet, to the point 
Entire course is designed with the busy professionals in mind and the videos were created to make your online learning experience fruitful and easy.  It is a project based training.
Asynchronous programming with async/await keywords, modern real world solution
async/await keywords were introduced in C# 5.0. In traditional socket programming scenarios, (multi) threading is use to create a responsive server or client. I have bypassed that route and shown you how to use asynchronous sockets directly. I first explain you what are async/await keywords and then I show how to use these for non-blocking network I/O. This part of the puzzle in the key to high traffic enterprise applications.
Reinforced learning 
Each section contains a quiz on the end which is very helpful to ensure that you review and retain important bits of information imparted in relevant course section.
Join an active community
Become a part of the programmers community who have already taken this course. Your questions will be answered by the fellow students and the course instructor as well. Really a wonderful place to start learning!
Learn something new
Sockets are considered an advanced topic, a danger zone in programming parlance. Knowing it means you take your trade seriously.
Object Oriented Programming
This course teaches you how to create a distributed application using the principles of OOP. You are going to bridge the gap between the back-end C#.Net class library and the fron-tend WinForms application using an implementation of Publisher/Subscriber model based on EventHandler classes. This course also shows you what are event handlers and how to create your own event.
Bonus 
You will also learn how to resolve a hostname to IP Address using System.Net.DNS class. You'll also implement various sanity checks using tryparse and try/catch
https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF

You don't need to learn C to work on this course.

Socket Java, python socket udp

Sunday, May 19, 2019

UDP Socket Programming For Distributed Computing in C#.Net



This course teaches UDP socket programming in C# .Net in a hands on and easy fashion. It is a carefully planned and crafted course which takes the student by the hand and teaches them how to create production quality distributed network applications using C# .Net in a step by step fashion.

The first sections of this course cover the basics of computer networks, and UDP socket programming in CSharp dot Net necessary for network and socket programming.
Next two sections will teach how to send and receive UDP broadcast in a command prompt C# .Net application using synchronous sockets with method calls such as Socket.Send and Socket.Receive. You will also learn how to convert between string and byte data types.

Once you're familiar with how distributed network applications function, the course takes you towards asynchronous socket programming. You will also learn about callbacks methods and how you can implement callbacks in C# .Net. I will also show you the publisher subscriber model AKA pub/sub model. We will implement pub/sub model in our library project and the client/server applications using the library as well. We'll create event handlers, delegates, and raise events as well.

We are going to use an Object Oriented approach for this course following the principles of OOP. In next section we're going to implement a publisher/subscriber model in C# .Net to bridge the gap between the API solution classes and the WinForms based front end.

Next, you will learn what is JSON (JavaScript Object Notation) and how you can add JSON functionality to your C# applications with Newtonsoft JSON.Net. We'll start implementing an application level communication protocol in this section.
In the next section, you'll learn how to transmit binary data over a UDP socket in C# .Net. As an example, I'm going to show you how to transfer png image files between multiple clients of your applications through the server. The JSON based protocol implemented in previous section is going to play a key role here.

After watching this course, you'll be able to write your own distributed applications that communicate through the network, either WiFi or Ethernet. You will have the foundation knowledge needed to create C# .Net based applications for IoT, computer telephony, VoIP, online gaming(e.g. Unity), and much more.

This course also shows you how to use String Interpolation which is a C# 6 feature. You'll also learn how to debug network applications in Visual Studio and how to write code faster.

Discounted coupon code link for the UDP socket programming in C# .Net course. 

You don't need to learn C to work on this course.

Socket Java, python socket udp

Sunday, April 14, 2019

Code Recipe: How to generate random alpha numeric string in C# .Net



This C# .Net code is from the Code Recipes series of Test Automation TV YouTube Channel.
The full explanation of the code is available in the video.


public string GenerateRandomString(int stringLength = 10)
        {
            if(stringLength < 1)
            {
                stringLength = 10;
            }

            StringBuilder retVal = new StringBuilder();

            Random rNumberSmallCapsOrSpecialChar = new Random(DateTime.Now.Millisecond);

            int typeOfCharToGenerate = 1;

            for (int i = 0; i < stringLength; i++)
            {
                typeOfCharToGenerate = rNumberSmallCapsOrSpecialChar.Next(1, 4);

                switch (typeOfCharToGenerate)
                {
                    case 1:// generate a number
                        retVal.Append(rNumberSmallCapsOrSpecialChar.Next(0, 9));
                        break;
                    case 2: // generate a small alphabet
                        retVal.Append((char)rNumberSmallCapsOrSpecialChar.Next(97, 122));
                        break;
                    case 3: // generate a capital alphabet
                        retVal.Append((char)rNumberSmallCapsOrSpecialChar.Next(65, 90));
                        break;
                    case 4: // special char
                        retVal.Append((char)rNumberSmallCapsOrSpecialChar.Next(33, 46));
                        break;
                }
            }

            return retVal.ToString();
        }


  [TestMethod]
        public void MakeRandomString()
        {
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine(GenerateRandomString());
                System.Threading.Thread.Sleep(10);
            }
        }

This video also shows how to use Visual Studio 2019 test explorer to run tests.
Other topics included are


  1. typecasting of an int to a char in C#
  2. Using StringBuild.Append method
  3. Using Random class and Next method
  4. Specifying default parameter values in methods
  5. Using Sleep method call



Saturday, April 6, 2019

Visual Studio 2019 New Features


Visual Studio 2019 is  geared towards making developers more productive, and innovative. 
It introduces live code sharing, time travel debugging, data breakpoints, C++ low memory foot print, improved VS on Mac, improved power shortcut keys, and much. 


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.

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