Basic information for Ready API (SoapUI): API Testing

API-Testing_The-Accountability-of-Testers-or-Developers

What is SoapUI?

SoapUI is an open-source web service testing application for service-oriented architectures (SOA) and representational state transfers (REST). Its functionality covers web service inspection, invoking, development, simulation and mocking, functional testing, load and compliance testing.

Basic kick off with SoapUI:

Once you get SoapUI installed, it will have the dashboard as shown below:

RA10

To add sample test, we need to select between SOAP or REST:

RA1

We will select URL as we want to test REST API. Once URL is selected, we need to provide the URL we need to test. For example I am using StackOverflow public API to get the users:

RA2

Once we click on Next, it will create one new project and in that project it will create a TestSuite where all your test will reside:

RA3

Once we run the test, it will show green or Red color whether the test is passed or failed:

RA4

If the test is passed, it will show the response in JSON which we have got with REST GET request:

RA5

Now as it is mentioned in very first image, if we perform some security tests then it will ask about the things we need to add in security test as shown below:

RA7

Once we click on Finish, it will show the result as below:

RA8

We can get detailed report as well:

RA9

I created one sample Web API on my machine which returns 2 values and I published the API project. When I gave localhost URL in ReadyAPI, It created one new project in ReadyApi and it gave the result as shown below:

RA11

So if the API would be installed on IIS then also APIs can be tested using Ready Api.

As it works with GET, it can work with POST\PUT\DELETE as well:

RA12

Virtual service:

SoapUI provides a feature called Virt in which we can create a virtual service, so if testers want to mock the service without calling the actual REST API, it is possible with SoapUI. We need to create a new Virt as below:

RA15

This Virt can behave as GET\POST etc as per your need and Once the Virt is created, we can even host that Virt on localhost by applying some settings.

To conclude this, if we want to test the scenario of a user account creation, we will create one project and in that there would be a test suite named “Test account creation” and in that suite we can add different test cases as shown below:

RA14

Try it out.

 

Infosys interview questions for experienced .Net developers

dot-net-interview-questions-for-experienced

Below are some of the most important questions which were asked during Infosys interview recently.

  • Tell me about yourself

This is the best place where you can showcase yourself. Tell as much as you can about yourself which should highlight all your achievements but that too in very short words. Do not stretch it for so long that interviewer gets bored.

  • Explain the architecture of your current project

https://softwareengineering.stackexchange.com/questions/92509/how-do-you-answer-explain-current-architecture-of-your-project-question-in-int

  • Write a program to swap 2 numbers, if you will be able to achieve it using the third variable then he would ask it to di it without using the third variable

http://www.sanfoundry.com/csharp-programs-generate-swap/

http://www.c-sharpcorner.com/blogs/swap-two-numbers-without-using-third-variable-in-c-sharp1

  • Tell everything about OOPS

In this, you should tell everything you know about OOPS, each and every concept which you know

  • How to achieve load balancing in SQL Server

http://searchsqlserver.techtarget.com/tip/Top-load-balancing-methods-for-SQL-Server

  • Tell me about the SDLC methods you have used

You can explain each and everything about Agile here

  • Different methods for passing data from controller to view in MVC

http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/various-ways-to-pass-data-from-controller-to-view-in-mvc/

  • Explain different state management techniques in .Net

You can explain all state management techniques of Web forms and also explain the same for MVC

https://www.codeproject.com/Articles/492397/State-Management-in-ASP-NET-Introduction

http://dotnet-helpers.com/mvc/state-management-in-asp-net-mvc/

  • If you reset IIS then will it reset all application data?
  • How to know, how many times an object is initiated?

By using a static counter in the constructor. Explain by writing code

  • Explain the life cycle of .Net

https://www.tutorialspoint.com/asp.net/asp.net_life_cycle.htm

  • Explain the life cycle of MVC

https://www.tutorialspoint.com/asp.net_mvc/asp.net_mvc_life_cycle.htm

  • Explain all the joins in SQL

http://www.sql-join.com/

  • Explain about Clustered and Non clustered indexes in SQL

https://docs.microsoft.com/en-us/sql/relational-databases/indexes/clustered-and-nonclustered-indexes-described

  • Difference between function overloading and function overriding

https://stackoverflow.com/questions/11912022/differentiate-between-function-overloading-and-function-overriding

  • What are Telerik controls, and why do we require them?

https://stackoverflow.com/questions/18981214/why-should-i-use-telerik-radcontrols-over-visual-studio-built-in-controls

  • What is Ajax and write a sample code of Ajax call in Javascript or jQuery

https://www.w3schools.com/jquery/ajax_ajax.asp

  • Difference between stored procedure and functions

http://www.dotnettricks.com/learn/sqlserver/difference-between-stored-procedure-and-function-in-sql-server

  • How jQuery is better than Javascript?

https://blog.udemy.com/jquery-vs-javascript/

I will be adding new questions if I get to know it from somone, meanwhile you may also add them in below comments.

 

 

Query string in .Net core and MVC 6

download

As you all know that from MVC6 we are seeing some changes in our regular coding techniques.

We were using below lines in MVC5 for getting values from query string:

var myQueryString = Request.QueryString[“myQueryString”]

But in MVC6, above lines will throw errors in your code.

So, you might be wondering how can we achieve this in MVC6.

Below is the way:

We can use Request.Query which is new in ASPNET 5 and MVC6.

var myQueryString = Request.Query;

For example, you have an URL like:

http://www.myWebsite.com/Home/Index?myQueryString1=abc&myQueryString2=xyz

So to get all keys we will write below code:

var myQueryString = Request.Query;

Here myQueryString.keys contains all the keys which are there in your query string.

Now to take those keys out one by one, we will write below code:

foreach(var key in myQueryString.Keys)
{
   //// Do the operations as per your need with the key
}

That is it. You can easily get your values from the Query string in MVC6 and .Net core.

Visual studio 2015 exception: Connected to the…. but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates

Since last some days, I have observed that some people are seeing some errors while publishing the MVC6 project from Visual Studio 2015 so, I decided to write a post with the solution.

So generally people get below error while publishing:

ERROR_CERTIFICATE_VALIDATION_FAILED

Connected to the remote computer (“XXXXXXXXX”) using the specified process (“Web Management Service”), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates.

To solve this, we need some option to allow untrusted certificates in publishing settings.

Solution:

Currently, there are not any options available to allow untrusted certificates so we need to do some tweaks which are as below:

  • Please search for Publish profile file within  /Properties/PublishProfiles folders and open it
  • set AllowUntrustedCertificate to True (<AllowUntrustedCertificate>True</AllowUntrustedCertificate>) inside the <PropertyGroup> element
  • Add below lines in the same file if tags are not available

<UseMsDeployExe>true</UseMsDeployExe>
<UserName>myuser</UserName>
<Password>mypass</Password>

That is it. It should not throw the exception now.

Hope it helps.

Best tools for S3 : Amazon Web Service(AWS)

s3

All those who are using AWS might have a requirement to download\sync\upload etc with your S3 bucket.

There are several ways to achieve that which includes some third party tool and even there are some ways via Visual Studio.

Let us check them one by one, we will take the example of downloading entire S3 bucket using below tools:

AWS CLI

The AWS Command Line Interface is a unified tool that provides a consistent interface for interacting with all parts of AWS.

Install AWS CLI using command sudo pip install awscli and then follow below command to download entire S3 bucket:

aws s3 sync s3://mybucket 

Using s3cmd and S3Express

s3cmd is a third party tool which is a Command Line S3 Client and Backup for Linux and Mac and S3Express is Command Line S3 Client and S3 Backup for Windows.

You can download it from above link.

Once downloaded you can configure it as below:

s3cmd --configure
s3cmd sync s3://bucketnamehere/folder /destination/folder

You can even create and remove buckets using above tools. Have a look here for more details.

Using Visual Studio

You can download entire S3 bucket using Visual Studio. For that, you would be required to download AWS toolkit for visual studio which can be downloaded from here.

Once it is installed, go to Visual Studio – AWS Explorer – S3 – Your bucket – Double click

In the window, you will be able to select all files. Right click and download files.

Using Cyberduck

One more awesome tools for this is Cyberduck.

Cyberduck is a Libre FTP, SFTP, WebDAV, Amazon S3, Backblaze B2, Microsoft Azure & OneDrive and OpenStack Swift browser for Mac and Windows.

It just requires your AWS credentials and you can use the simple interface to download/upload/sync any of your buckets/folders/files.

Using Rclone

Rclone is a command line program to sync files and directories to and from

  • Google Drive
  • Amazon S3
  • Openstack Swift / Rackspace cloud files / Memset Memstore
  • Dropbox
  • Google Cloud Storage
  • Amazon Drive
  • Microsoft OneDrive
  • Hubic
  • Backblaze B2
  • Yandex Disk
  • SFTP
  • The local filesystem

You can sync your S3 bucket by giving below commands:

rclone sync /home/local/directory remote:bucket

Using S3Browser

S3 Browser is also one tool which can be used for above purpose. It is windows only tool.

S3 Browser is a freeware Windows client for Amazon S3 and Amazon CloudFront. Amazon S3 provides a simple web-services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. Amazon CloudFront is a content delivery network (CDN). It can be used to deliver your files using a global network of edge locations.

If you know any other awesome tools then do share it here.

Happy learning.

Amazon Rekognition : The rise of Artificial intelligence

reko14

By looking at the word Rekognition you would feel as if it is a wrongly spelled word 🙂 It is nothing but an awesome gift from Amazon to us.

First let us see some background, I attended a training of Artificial intelligence some days back and in that training, we were shown below picture and were told to recognize what it is:

reko9

Within a second everyone said it is an elephant. We can recognize this elephant within seconds because we have years of experience of learning.

Then trainer asked what if a system wants to recognize it within seconds, is it possible? It might be very difficult because if we compare our years of experience with a system’s experience then there is a huge difference, we will have to teach the system to identify what is there in an image.

But the answer of trainer’s question is yes, it is possible with the help of AI. There are millions of images already there on the internet which can be used for Big Data or for AI.

Let us get back to Amazon Rekognition.

It was introduced in re:Invent of Amazon in 2016:

reko1

So basically it takes the image as input and returns data which can be used for different analysis purpose.

So what is Amazon Rekognition?

Amazon Rekognition is a service that makes it easy to add image analysis to your applications.

With Amazon Rekognition you can:

  • Detect objects
  • Detect scenes
  • Detect faces
  • Search and compare faces
  • Identify inappropriate content in images

Amazon Rekognition provides:

reko3

  • Object and Scene Detection
  • Image Moderation
  • Facial Analysis
  • Face Comparison
  • Facial Recognition

Let us see some use cases for different features of Amazon Rekognition:

Facial Recognition:

reko8

Sentiment Analysis:

reko7

Face-Based User Verification:

reko6

Image Moderation:

reko5

Searchable Image Library:

reko4

Interesting isn’t it?

Below are few screenshots of the actual Amazon Rekognition application:

reko10

reko11

reko12

You can see more details about the API and step by step process here if you want to know more.

It may remind you about the God’s eye from the movie The Fast & furious 7\8. That day is near as well with the rise of AI along with AWS 🙂

Happy learning.

Encryption in Amazon Simple Queue Service (SQS)

encryption-locks

As I come from .Net background, I have always used MSMQ which is obviously very good. Now a days I am working a bit with Amazon Simple Queue Service(SQS) and I find it very cool.

Amazon Simple Queue Service (SQS) is a fully-managed message queuing service for reliably communicating among distributed software components and micro services – at any scale.

Recently Amazon has added one more useful feature into SQS which is Server-Side Encryption.

In the context of Message Queuing, encryption is the process for encoding and decoding messages, ensuring they cannot be read or used by unauthorized persons so now Amazon SQS is even more secured than before.

It gives you ability to store encrypted messages in either standard queue or FIFO queue. You can add it while creating new queue or you can set it in any existing queue as well.

AWS by default provides standr key for all customers which is unique and it is called  Customer Master Key (CMK). You can use this key or you can create your own keys for encryption. If you choose to use your own keys, don’t forget to update your KMS key policies so that they allow for encryption and decryption of messages.

sqs_set_encrypt_2

So what exactly it encrypts in SQS?

It encrypts the body of a message in an Amazon SQS queue.

It doesn’t encrypt the following components:

  • Queue metadata (queue name and attributes)
  • Message metadata (message ID, timestamp, and attributes)
  • Per-queue metrics

Give it a try!