Monday, 19 March 2018

RESTful Web Services Tutorial 1 - Creating a REST API in Visual Studio(.Net C#)

I must say, I never knew how easy and clear this topic of REST API is untill I did it myself. If you have any issues, mention it in the comment box by the left of this page that says: 'Your Opinion Matters' and you will recieve needed assistance.

In this lesson we are going to cover the following

What is RESTful Web Services?

First we anwer the question, what is a web service? A web service is is a piece of software or service that is accessible over the internet. A web services can also be used by other services or applications. For instance the weather service, or the currency exchange rates. If we go to Google and type '100USD to EUR', a web service is called which executes the function to carry out the convertion. Here, 4 things happen:
  • accept the input parameters which are (the currency to convert from, the currency to convert to, and the value to convert)
  • query a database to obtain the exchange rate between the two currencies
  • do the calculation
  • return the result(response) to the client
All of this is handled by a web service
These whole process is just the same as what happens during a function call. But in this case we give it a fancy name 'web service' because it happens seamlessly over the web.

Now there are two types of web services:
SOAP Web Services: SOAP stands for Simple Object Access Protocol and this is the traditional web service that have been around for some time. SOAP is based on XML. Read more about SOAP here.

REST Web Services: REST stands for Representational State Transfer and is a newer type of web service. REST said to be (not a protocol or standard) but an architechtural style. It support both XML and JSON. Read more about REST here.

What is REST API?

Again we need to answer the question, 'what is an API?'. API stands for Application Programmer's Interface and defined as 'a set of sub-routine definitions, tools and protocols for building a computer software'. An API is built using normal software development tools. But they are not complete applications. They are tools to be used by other applications or by a programmer in developing an application.
An API based on REST is called REST API or RESTful API.

Lets not get into the practical aspect as this would help make it clearer for you. We would build a REST API to solve the task below.


Creaate a REST Web Service in .NET that exposes methods to
  • Return a list of employees
  • Return an employee based on employeeID paramenter

Soltion: Creating RESTful API in Visual Studio(Step by Step)

We would cover thes seven simple steps and at the end we would have a complete web service in .Net that we can access through a browser or any other REST client.
You can use Visual Studio 2013, 2015 or 2017.

Step 1: Create an Empty Web API project

When you are creatinga new project, make sure you select Web API project as shown in the Figure 1.

Figure 1: Web API Template

Give the applicaiton a name and Click OK

Figure 2: Choose Empty, Select Web API

Make sure that the Web API checkbox is selected then you can click OK to create the application.
At this point the folders structure of your application is shown in Figure 3

Figure 3: Folder Structure

Step 2: Test the Application

Build and run the application in Chrome or Firefox or any other browser and ensure that the the home page is displayed as shown below. (You can press F5 to run the application)
It opens the browser window and displays the error page shown in Figure 4. This is not a problem.

The error pages is displayed because we have not yet added any model, view or controller to our REST API.
Close the browser window and stop application from running.

Step 3: Add a Controller

Right-click on the Controller folder in the solution explorer and click on Add, an choose Controller
Choose - Web API 2 Controller - Empty

Figure 4: Adding Controller

Give it a name  EmployeeController

Step 4: Add a Model (Employee model)

A controller is another class in the Controllers folder of  the solution that inherits from ApiController class.
  • Right-click on the Model folder in the Solution Explorer and choose Add
  • Click on New and choose Class.
  • Enter the following code to the class to define our employee model.

      public class Employee
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string  City { get; set; }
Listing 1: Employee Model Class

Step 5: Create a List of Employees

Create a hard-coded list of employees in the controller class. This is shown in Listing 2.

        List<Employee> employees = new List<Employee>()
            new Employee{EmployeeId=1, Name="Kindson", City ="Akokwa"},
            new Employee{EmployeeId =2, Name="Oleander", City="Lagos"},
            new Employee{EmployeeId =3, Name="Saffron", City="Gbagada"}
Listing 2: The Employees List

Step 6: Write the two Methods

The first method would be a method that returns a list of employees.
The second method would take a parameter of an employeeId and return a particular employee that matches that particular id.
The two methods is shown in Listing 3

        public IEnumerable<Employee> getEmployees()
            return employees;

        public IEnumerable<Employee> getEmployeeById( int id)
            var Emp = from emp in getEmployees()
                      where emp.EmployeeId.Equals(id)
                      select emp;

            return Emp.ToList<Employee>();
Listing 3: Methods to return list of employee and single employee

At this point the complete controller file would be like shown in Figure 5.

Figure 5: Final Controller File

Step 7: Modify the WebApiConfig.cs file

This file controls what the url that will be typed into the browser to access the data.
Replace routeTemplate code with this one:


The complete WebAPIConfig.cs file  will be as shown below.

Figure 6: WebAPIConfig File

 At this point, we are ready to test our API

Step 8: Test the API 

  • Rebuild  and run the application.
  • Run the applicaiton by pressing F5.
  • The browser opens and displays an error page.

Now, in the browser address bar, append the following /api/Employee/getEmployees 
The output would be as shown in Figure 7.

Figure 7: Final Output
Also test for getEmployeeById
Now replace the url with this one /api/Employee/getEmployeeByID/1
If it displays a single record, then you have successfully completed this tutorial

Next Steps

I would like to let you know that working with Web API does not get more difficult than this. The next steps would also be as easy to follow as this one.
We would now learn about RestClient, which is a tool you use to test web services.
Thank you for reading!

For video lessons, subscribe to my YouTube channel on: Tech and Programming Lessons on YouTube

Friday, 16 March 2018

Chi-Square Test for independence - Question 18 (A publisher is interested...)

Question 18
A publisher is interested in determing whinf of three book cover is most attractive. He interviews 400 people in each of the three states (Califonia, Illinois and New York), and asks each person which of the  cover he or she prefers. The number of preference for each cover is as follows:

Califonia Illinois New York Total
First Cover 81 60 182 323
Second Cover 78 93 95 266
Third Cover 241 247 123 611
Total 400 400 400 1200
Table 1

Do these data indicate that there are regional differences in people's preferences concerning these covers? Use the 0.05 level of significance.

Solution Steps
As usual, we need to understand the problem and decide on which particular test to carry out.

In this case, since the question asks if there are regional differences in people's preference, it means we need to test if the groups of data depends on other groups. So it would be Chi-Square test for independence.
That is the hypothesis we are going to test.

Step 1: State the null and alternate hypothesis
H0: there are no differences in peoples preference
Ha: there are  significant differneces in people's cover

Since we are going to be using Excel to simplify the solving of this problem, I have transfered the table to MS Excel. This is shown in Table 1. You can get the completed excel sheet from here

Step 2: Calculate the Expected values
In this case totals have already been calculated for us. So we go ahead to calculate the expected values.
The expected value for each cell is calculated by multiplying the row total by the column total and dividing by the grand total

For example, the expected value for the first cell, containing 81 is given by

I have calculated for the rest of the values and the result is given in Table 2.

Table 2

Step 4: Calculate Squared Difference (O-E)2
Where O is the observed values in Table 2 and E is the expected values calcualted in Table 3. The first squared for:
O = 81
E = 107.667

I have calculated for the rest of the values and the result is shown in Table 3

Table 3: Squared Differences

Step 5: Divide by Expected Value
This is the squared deviation you calculated in step 4 divided by the corresponding expected values. For the first value it would be

I have done it for all the values and the result is tabulated in Table 4.

Step 6: Calculate the Test Statistic
This is simply the sum  of all the values in the last table

= 6.605 + 21.103 + 51.32 + 1.283 + 0.212 + 0.452 + 6.843 + 9.22 + 31.95
= 128.998

Step 7: Look up the critical Value from Chi-Square table
Get Statistical table from here
First we calcuale the degrees of freedom
df = (3-1) * (3-1) =  4
alpha = 0.01

The critical value from the table of Chi-Square distribution is written as

K0.05, 4 = 14.86

Step 8: State your conclusion
Since the calculated value of the test statistic is greater than the critical value, we therefore reject the null hypothesis and conclude that there are no differences between the groups of data.

The whole tables are shown below, you can also download it for free

What is LUIS (Language Understanding Intelligent Service)

In this lesson, we are going to discuss a very important technology by Microsoft that can help you build in

  1. Overview of LUIS
  2. What is LUIS App
  3. Key Concepts of LUIS
  4. How to Get LUIS
  5. Creating Your LUIS Model
  6. Improving Performance
  7. Final Notes

1. Overview of LUIS

Lauguage Understanding intelligent Service(LUIS) is a service that makes it possible for your application to understand the what the user wants in their own word. It uses machine learning algorithms to help developers create apps that could receive input from user in the form of natural language and extract meaning from it.
A LUIS appliaction that interacts with the user can pass  the user input to a LUIS service and receive relevant information back.

As you know MS Bot Framework works with LUIS to allow a bot to converse with a user through a text input
Bing Speech API converts voice communication into text format which can be passed on to LUIS for processing.

2. What is a LUIS App

 A LUIS application is a domain-specific language model you can build and tailor to you particular needs. You can use an existing modelor create your own model from the scratch. You can even put pieces of a prebuilt domain together and create a customized model.

What is a Model? A model contains a list of general user intention such as the following:
"Book a Meeting"
"Create an Appointment"
"Send an Email"
"Set Alarm"
Then for each intention, you need ot provide example phrases that may correspond to it. The uttrances are labeled with specific details you need LUIS to extract from it. For example, an uttrance that would correspond to the last intent is "Book a meeting for tommorrow by 5 pm with Jones"

However there is already prebuild domain models, that could fit your needs.

After the model is designed, it is trained and published. Then it is ready to recieve and process uttrancess. The LUIS app recieves uttrances in the form of HTTP requests and provided response of user's intentions.
The LUIS app then sends the uttrance to LUIS service which processes it returns an evaluation as JSON object.
You application the takes action base on this evaluation.

3. Key Concepts of LUIS

We would examine three key concept used in LUIS.
Intents: This represents action which the user wants to carry out.The intent is an objective that is expressed in the user's input such as booking a meeting, sending an email or finding a news item. You need to define and name the intents that correspond to these actions. For example "BookMeeting", "SendEmail" etc

Utrances:An uttrance is a text inputed by user that your application needs to understand and process. There can be many different variations of an uttrance with the same intent.

Entities: An entity represents particular information that is relevant to the uttrance. Entities are normally extracted from uttrances.
For example, in the uttrance, "Book a meeting with John", John is an entity which would actuall be a person in your contacts list. LUIS recognized and labels entities recognized from the user's uttrance and in this way  is able to help the application choose how to respond.

4. How to Get LUIS

There a two ways to build the LUIS model
Through the LUIS website
Authoring APIs
Combination of both
Using both of this methods, you can still have complete access to you model and make neccessary modification according to your needs. Additionally, you can use a combination of the two methods. Once your model is completed and published, then you can use it for you client application. This you can do by passing uttrances to it and receiving the JSON object results via enpoint APIs.

5. Creating Your LUIS Model. How to Start

The first step is by making a list of the intents that your client application can resolve. You can reveiw what intents are here.
After idendifying the intents, then create sample uttrances that LUIS needs to map to your intents. For instance, the uttrance "Book a meeting with John at 5 pm" maps to the intent "BookMeeting".
Next you need to label the differen parts of the uttrance that is relevant to your application domain as entities and set a type such as date and person.
Normally, an intent is used to trigger an action while entity are given as arguments to execute an action.

There are three ways to identify entities
  • LUIS Prebuilt Entities: There are several domain models available in LUIS. Each of these models include intents, uttrances and prebuild entities. For a beginner it is safe to use the entities available here than to build your own from the scratch
  • Custom Entities: In this case, you have to option of identifying your own custome entities
  • Phrases in LUIS: Phrase list is provided by LUIS which can also be useful in identifying entities

6. Improving Performance

Just like in any other machine learning system, the model created in LUIS could be improved with time through the learning process. This means that  as users enter real uttrances LUIS could use these uttrances to train your model to improve identification using active learning.
This means that if uttrances are entered that LUIS is not sure on the exact resolution, you can help by providing labels for them. This can be done iteratively and over the time the performance of your model continues to improve

7. Final Notes

What we have discussed in whole lot of theories which is important for you to know before we start building LUIS apps.
Howevers since successully creating a working LUIS model and app depends on a clear understanding of these concepts, I would recomment, you take some more time to read creafully again, making notes of the important points in this lesson.
Then we can go on to How to Build LUIS app.

Thank you for reading! Please do leave a comment using the form at the left side of this page that says "Your Opinion Matters"

Thursday, 15 March 2018

Bot Framework Tutorial 4: Creating a Question and Answer(Qna) Bot

In the Tutorial 2, we learnt how to create a basic bot in Azure. In this lesson, we would take it a step further and learn how to create a question and answer bot.


  1. What is a Question and Answer Bot
  2. Understanding LUIS
  3. The QnaMaker
  4. Steps Build a QnA Bot
    • Step 1: Create the Question and Answer Knowledgebase
    • Step 2: Create New Qna Service
    • Step 3: Create  a Question and Answer Bot
    • Step 4: Link the QnA Bot to the QnA Service
    • Step 5: Test The Bot
  5. Final Notes and Next Step

1. What is a Question and Answer Bot?

This a bot that makes use of a question and answer databases to provide interactions with users by provided responses to user questions.

A question and answer bot allows you to discuss with it and while you ask questions, it provides you with relevant answers based on the content of the knowledgebase.

2. Understanding LUIS

LUIS stands for Lanuguage Understanding Intelligent Service offers a fast and effect way of adding language understanding to applications. Using LUIS, you can use pre-existing models to create Bots that can interact with users in a more natural way.

LUIS allows your application to understand what someone wants in their own words. It makes use of machine learning algorithms to allows developers to build applications taht can recieve input from user in a natural language and then deduce the intended meaning.

Learn more about LUIS from What is LUIS (Language Understanding Intelligent Service)

3. Understanding The QnaMaker

One of the key features of a Bot is to be able to seed it with a list of questions and answers. This list could be in a spreadsheet, document file, pdf, web page etc.

The QnaMaker is a free and easy to use REST API  that trains AI to respond to users' question in a more human and conversational way.

With QnA Maker you can have a list of predefined questions and answers you have created. Then you can load this data to the service to create a knowledgebase and then trains it to respond to cetain variations of the question in the knowledgebase.

In this tutorial, we would create a Qna Service in QnaMaker and then use this service in the Question and Answer bot we would be creating.

You can read more about QnaMaker from the Qna Documentation

Figure 1 Illustrate how QnaMaker integrates with Bot Framework.

Figure 1: Photo taken from

4. Steps to Create a QnA Bot

Take the following easy steps to complete the process of creating a Qna Bot

Step 1: Create the QnA KnowledgeBase
You will create a list of questions and answers that would be used by the bot.You will do this in Microsoft Word or any other text editor you have. Create the question and answers using the format shown in Figure 1.

Save the file with a name. We will upload this file to QnaMaker

Step 2: Create a new QnA Service
Go to
Login using your Microsoft Account

Click on Create new Service.
The new qnaService creation form opens as shown in the Figure.

Enter a name you would like to give to the service
Leave the URL field bland

Scroll down to the Upload File section.
Click Select File and select the file you created in step 1.

After the file have uploaded, click on Create
The window below is displayed. It takes a few seconds to process the request.

When the processing is completed, the next page is displayed

To test the Service, Click on Test on the left side of the page.
Enter 'Hi' to see the response
Enter a question  and see if it responds with the correct answer
After testing, you then click on Publish to publish the qna Service

Click on Publish again the complete the deployment process

Then note donw the KnowledgeBase Id  and the Subcription Key as highlighted in the figure

You have successfully created a qna Service ready to be used in your bot in Microsoft Azure. You can go ahead to close the Window and login to Microsoft Azure

Step 3: Create a Question and Answer Bot in Azure
Follow the bot create process to create a Question and Answer bot in Azure.
See how to create a bot here

Important: In the Bot Template, you must Choos Question and Answer

Step 4: Link the QnA Bot to the Qna Service
Go to the Application Setting. This is under App Service Setting
Scroll down to find QnaKnowledgeBaseID and QnaSubscription Key

Now you need to enter the KnowledgebaseID and Subscription key you got from Step 2

When you are done, click on the Save button at the upper part of the window.
Now, you are ready to roll!

So let's now test our Question and Answer Bot

Step 5: Test thet Bot
Under Bot Managment, Click on Test in Web Chat
Enter one of the questions defined in the Question and Answer file we created
Try some other question
Try entering a question that is not there.😃😄

5. Final Notes

If you have completed this lessons successfully, thumbs up to you! If you have challenges along the line, you can let me know at the form by the left of this page that says, 'Your Opinion Matters'.
I would also like to tell you  that if you did this successfull, then almost every other aspect of bot framework would not be a bid deal for you.
Let't now move on to the next steps,  where we would learn how to configure channels for out bot.

Bot Framework Tutorial 2: Create Your First Chat Bot in Azure(Step by Step)

In this Demo, we are going to build and test a complete bot created in Azure in just few steps!
Watch the video lessons here.


  1. What is Bot Framework?
  2. What you need for this Demo
  3. Step-by-Step Procedure
  4. Final Notes
  5. Next Steps

1. What is Bot Framework?


Bot Framework is a set of tools provided by Microsoft to help you build full functional interactive bots very easily. The Bot Framework was announce just less than two years ago. But somehow, many developer either don't know about it, or they don't know what they can accomplish with it.
To learn more about Bot Frame work read Introduction to MS Bot Framework by Kindson The Genius.

How It Works
Bot Framework is based on the Bot Builder SDK and Bot Framework Connectors

2. What you need for this Demo

You will need the following to complete this demo. Interestingly all you need for this demo is free! You don't need to spend a dime!.

Microsoft Live ID
You can create a Microsoft Account and recieve the ID for free. To create an account if you don't already have one, please visit this link: Create Microsoft Account

An Azure Subscription
You can create an free 30 days trial subscription in Azure. You can create a subscription from here: Create and Azure Subcription.

3. Step-by-step Procedure

This 3-step procedure would take about 7 minutes to complete, depending on your internet  connetion speed.

Step 1: Create an Free MS Azure Subcription
If you have not already created the subscription, you can create a subscription from here: Create and Azure Subcription.

Step 2: Create a Bot using Bot Service
Log in the Microsoft Azure, by visiting
In the Search box Type Bot Service. Bot Service shows up
Click on Bot Service. The windows is show a in Figure 1

Figure 1: Open Bot Services

(A second way to get here is to visit and then click on Create Bot, the window is shown as in Figure 2)
Figure 2: Window

When you click on Bot Service. The next window would open which displays a list of all the bots you have previously created.

Figure 3: Bot Service showing existing bots

To Create a new bot, click on Add Service (Close to the + sign under Bot Services). The next window opens

Figure 4:  Create a Web App Bot

Click on Web App Bot under Bot Services. Then you will see a Create button

Figure 5: Bot Creation Page

Click on the Create button. It would open the Bot creation form so you can fill in the needed information for the new bot.

Figure 6: Bot Creation Form

Fill in the data and click Create
  • Bot Name: Enter the name you want to assign the bot
  • Subscription: Leave this as it is
  • Resource Group: Leave it at Create New. Don't enter anything in the box
  • Location:  Leave it at the default value
  • Pricing: Leave at the default value
  • App Name: Same name as the name you entered as the Bot Name

  • Leave every other item in its default value.
You can also click on Pin to dashboard. So you can see it in the home page
Click on Create.
By now, your bot is created and you can see the name of the bot.
Click on it so it would display a page that can allow you to test the newly created bot. The page below is displayed

Figure 7: Bot Management Window

4. Step 3: Test the Bot

Hurray! You have successfully created a bot and now we are ready to test it on real chat.
We would open the chat, send a message to the bot and see how it responds
Under Bot Managment, Click on Test in Web Chat
You will see 'Authorizing Chat with Bot' displayed for a short time. Then the chat window opens up
Type 'Hello' and press Send

Figure 8: Testing Bot in Web Chat

If you get a response, then you have successfully created you first bot!
If not, or you have some challenges, leave a comment in the comment box at the left side of this page.

5. Final Notes

As you can see, it is quite easy to create a Chat Bot.  However, what we just created is the very basic bot. How it works is that it echoes back the users input back to the user. Not much functionality. In subsequent lessongs, we would actually create a bot that would give an 'intelligent' response to any user input.

6. Next Steps

Go ahead to read about the various types of bot you can create. This is under Learn About Bot Templates

Wednesday, 14 March 2018

Frequently Asked Question

Welcome to Kindson The Genius FAQ Page

Q1. Who is Kindson The Genius?
Kindson The Genius is whose real name is Kindson Munonye is a Nigerian IT Professional who is vast in many fields of study including Mathematics, Sotware Engineering, Project Management, Human Resource Managment etc.

Q2. How can I reach Kindson The Genius?
You can reach him through his blog and filling the form at the left hand side of the page

Chi-Square Test for Independence - Question 17(A research team...)

Question 17
A research team investigated whether there was any significant correlation between the severity of a certain disease runoff and the age of the patients. During the study, data for n = 200 patients were collected and grouped according to the severity of the disease and the age of the patient. The table below shows the result

below 40 40 - 60 above 60
runoff slight 41 34 9
average 25 25 12
serious 6 33 15
Let us decided about the correlation between the age of the patients and the severity of disease progression.

Solution Steps
As usual, we need to understand the problem and decide on which particular test to carry out.

In this case, since the question says to investigate whethere there was any significant correlation between the severity and age, it means that the null hypothesis would be that 'there is correlation between the age and the severity'. That is the hypothesis we are going to test.

Step 1: State the null and alternate hypothesis
H0: there is significant correlation between the severity and the age
Ha: there is no significant correlation between the severity and the age

Since we are going to be using Excel to simplify the solving of this problem, I have transfered the table to MS Excel. This is shown in Table 1. You can get the completed excel sheet from here

Table 1

Step 2: Calcualte the totals
In this step we calculate the totals for each of the row. This i have done using excel formula as you can see in Table 2

Table 2

Step 3: Calculate the expected values
The expected values are calculated by multiplying the corresponding row and column sub-total and dividing  by the grand-total. For example, the first expected value that corresponds to Slight and Below 40 would be calculated as follows:

 Do this for all the 9 observed values. I have used excel to automatically generate these values and it is shown in Table 3

Table 3

Step 4: Calculate Squared Difference (O-E)2
Where O is the observed values in Table 2 and E is the expected values calcualted in Table 3. The first squared difference would be.

Do this for all the the observed values and the corresponding expected values. The resulting sets of values is given in Table 4

Table 4

Step 5: Calculate the Component
This is the squared deviation you calculated in step 4 divided by the corresponding expected values. For the first value it would be

If you repeat this all the values, then the resulting table would be table 5.

Step 6: Calculate the Test Statistic

This is the sum of all the terms in calculated in the table. I calculated this using the Sum() formula in Excel, but you can do this by hand just to verify.

Test Statistic = 3.83 + 0.56 + 2.48 + 0.32 + 0.43 + 0.06 + 9.29 +2.68 + 2.87 = 22.52

Step 7: Look up the critical Value from Chi-Square table
Get Statistical table from here
First we calcuale the degrees of freedom
df = (3-1) * (3-1) =  4
alpha = 0.01

The critical value from the table of Chi-Square distribution is written as

K0.01, 4 = 13.28

Step 8: State your conclusion
Since the calculated value of the test statistic is greater than the critical value, we therefore reject the null hypothesis and conclude that the data is not related.

The whole tables are shown below, you can also download it for free

Download this excel sheet for free

Tuesday, 13 March 2018

Chi-Square Goodness of Fit Test - Question 16 ( A newly developed muesli...)

Question 16

A newly developed muesli contains five types of seeds (A, B, C, D and E). The percentage of which is 35%, 25%, 20%, 10% and 10% according to the product information. In a randomly selected saa, the following volume distribution was found.

Number of Pieces1841451006363

Lets us decide about the null hypothesis whether the composition of the sample corresponds to the distribution indicated on the packaging at alpha = 0.1 significance level.

Solution Steps 

Read the question again and made user you understand it. Think of what values are observed values and what values are expected values

Step 1: State the null and alternate hypothesis
From the question, we are required to verify the null hypothesis whether the product information corresponds to a given specified distribution. Therefore we can state the null hypothesis as:

H0: the data is consistent with a specified distribution
Ha: the data is not consistent with a specified distributions

Step 2: Identify the observed and expected values
In this case, the observed values are the values given in the table that is

A = 184
B = 145
C = 100
D = 68
E = 63

As for the expected values, the question gives us the percentages (of the total) of the expected values
Total = 184 + 145 + 100 + 68 + 63 = 560

So we can calculate the expected values based on the percentages

Expected value for A = 560 * 0.35 = 196
Expected value for B = 560 * 0.25 = 140
Expected value for C = 560 * 0.20 = 112
Expected value for D = 560 * 0.10 = 56
Expected value for E = 560 * 0.10 = 56

Now we have the two important sets of values, the set of observed values and the set of expected values.

Step 3: Calculate the Chi-Square Test Statistic
Now that we have calculated the expected values, the rest of the problem is quite easy. We can get the chi-square statistic using the formular.

If we use the actual values, thene we have the following calculation: 

Step 4: Look up the critical value from tables
We need to look at the table of chi-square distribution.

From the question, alpha = 0.01
Degrees of freedom, df = 5 - 1 = 4

The critical value for alpha = 0.01 and 4 degrees of freedom is written as

K0.1,4 = 7.729

Step 5: State your conclustion
Since the calculated value of the test statistic is less than the critical value, we therefore accept the null hypothesis that the content of the checked sac corresponds to the advertised distribution.

Why I Use Katalon for Automation Testing - Doctoral Researcher

I am currently carrying out research on the performance of some automation solutions on a wide range of platforms. And in the course of time my research would cover as many more automation testing tools available. However, in this article, I would like to share with you 5 reasons why I personally prefer using Katalon

Read about 10 Automation Test Interview Questions and Anwers

What is Katalon?

In case you are new to Automation Testing, Katalon is defined in the Firefox plugin page as "a new Selenium IDE that helps you caption actions, capture web elements on web application, play automation test cases and do reporting quickly and easily".
Someone described is as "the best choice when it comes to balance between function and budget".
It is also called Katalon Recorder since you use it to capture or record actions in a web application.

Let't now consider 7 reasons why I use Katalon for automation testing.

#1 Free to Use

 Both for developers and for enterprises,  cost is one of the constraints considered in any information system development process.
Why Katalo is free to use, they do encourage you to subscribe to their Business Support Services.
For me and many other researchers, the seems to be no better option than a free-to-use, and rich in functonality system like Katalon.

#2. Feature Rich

 Some of the feature of Katalon includes
  • Setup Project: Providing template for organizing test cases, object repositori and keywords.
  • Test Execution: You can execute tests either created within Katalon or imported from another IDE
  • Test Maintenance allow for organizing your tests into suites which helps in manitenability
  • Multi-browser support
  • Integration with Source Control such as Jira, Git, Jenkins and qTest with native plugins
  • And lot more features!

#3. Easy to Set Up

Its really interesting that you could set up Katalon in just few minutes. There are no complicated configuration procedures. In my series of tutorials on Katalon, I explained how to get Katalon up and runing.

#4. Lightweight

This for me is a very important factor in choosing an automation tool(I don't know about you). But for me as a Software Engineer and Researcher, I already have a lot going on on my system. So its is an advantage for me to have a fully functional Automation Testing tool set up on my system without impacting on resources (memory, storage etc) on my system.

#5. Easy to Learn

With no knowledge of programming, you could develop skill in using Katalon. Expecially with a comprehensive documentation provided in their website, and a number of easy to follow tutorials, Katalon ranks one of the easiest to use automation tools out there

#6. Integration with Programming Languages

One good thing I appreciated most the first time I used Katalon was the ease of exporting Automation Test script to C# codes and then editing in Visual Studio
Languages supported by Katalon includes:
  • C#
  • Java
  • Python
  • Ruby

#7. Elaborate Learning Resources

The Katalon website provide series of easy-to-follow tutorials to help you easily master the use of Katalon in Automation Testing. A Question and Answer section is also provided to attend to any questions you may have.

Final Notes

Granted, I have not completed my research on performance evaluation of the various automation testing tool. But from this few point it is very clear that there are benefits of using Katalon are very much. I find this to be especially true for automation testers that doesn't have so many year of experience. So I would recomment for beginners to start with Katalon and with them you can have more experience and be informed on making choices on an automation tool to adopt.

Selenuim/Katalon Tutorials on YouTube 

1. Set up Selenium in Firefox
2. Recording and Running a Test Case - Part 1
3. Recording and Running a Test Script - Part 2
4. Export the Test Script to C#
5. Import and Run the Test Script in Visual Studio

Monday, 12 March 2018

Question 14 - Chi-Square Goodness of Fit Test Problem( Can a dice be considered...)

Question 14

Can a dice be considered regular which is showing the following frequency distribution during 1000 throws?
Thrown Value123456

Solution Steps 

In this case, the questions says to consider whether the dice can be considered regular(consistent). So we use Chi-Square goodness of fit test which is used to determine whether a smple data is consistent with a distribution.

Watch the video explanation here
Get the excel sheet for this question

The formular for chi-square is
O = Observed values
E = Expected value

Step 1: State the Null and althernate hypothesis

H0: the data is consistent with a specified distribution
Ha: the data is not consistent with a specified distributions

Step 2:  Create the Table
I have tranfered the data to excel and created the table as shown in Table 1.

Table 1

Step 3: Calcualte the Expected Value (E)
The expected value is the same as the mean of the sample which I have calculated as shown in the table.

E = 166.67

Step 4: Calculated the Differences
In this step, you need to calculate the Observed Value - Expected Value (O-E) for each of the obseravtion. This I have done and added additional column to the table.

Table 2

Step 5: Calculate the Squared Differences
This is simple the square of the differences calculated in Step 4. I have added another column to our table to hold the squared differences.
Table 3

Step 6: Calculate the Component
This is calculated by dividing the squared difference calculated in step 5 by the expected value for each of the value.
Our table has been updated to include this column as well as the sum of this column
Table 4

Step 7: Calculate the Chi-Square Statistic
The chi-square statistic is calculated as the sum of the last column in our table which is the same as the result of using the formula

Chi-Square Statistic = 4.92

Step 8: Find the P-Value from Tables
You can find the p-value using the calculate chi-square statistic and the degrees of freedom

Degrees of freedom is given by N-1
df = 6 - 1 =5
where N is the number of observation. In this case

See statistical tables here

From the chi-square table we for α = 0.05, df = 5
get a p-value of  11.07

Step 9: State your Conclusion
In this case  the calculated test statistic from the sample which is 4.92 is less than the critical value from the table which is 11.07.
Therefore we accept the null hypothesis

Get this excel file