October 11, 2020

Difference between SoapUI and Postman



Both SoapUI and Postman are very famous tools for API testing and API Automation. Below are the major differences between SoapUI and Postman and the criteria for choosing them for REST API.

1. SoapUI covers the testing of all API protocols like Soap, REST and GraphQL whereas Postman supports only REST API Testing

2. SoapUI provides 14 days trial and then you have to pay to get a license whereas Postman is a free Chrome browser extension

3. SoapUI supports customization of Reports in different formats whereas Postman supports reporting only in JSON and HTML formats.

4. SoapUI is one of the most trustworthy tool for API automation testing whereas Postman is a used for REST APIs manual as well as exploratory testing

5. SoapUI is a heavy tool in-comparison to Postman as this is a chrome extension

6. In Soap UI,you can use Groovy or JavaScript for more complicated automation such as validating the results, extracting data, using external Java libraries or running system processes. Groovy IDE is compatible with Java and you can easily write your code in Java with very few modifications.But in Postman there is no concept of groovy.

I hope the above information will clarify your doubts in terms of differences and criteria to select one of them depending upon the requirement.

HTTP Status Code



HTTP STATUS CODE- 


200 OK- The request has succeeded. The meaning of the success depends on the HTTP method:
GET: The resource has been fetched and is transmitted in the message body.
HEAD: The entity headers are in the message body.
PUT or POST: The resource describing the result of the action is transmitted in the message body.
TRACE: The message body contains the request message as received by the server.

201 Created- The request has succeeded and a new resource has been created as a result. This is typically the response sent after POST requests, or some PUT requests.

202 Accepted - The request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is intended for cases where another process or server handles the request, or for batch processing.

204 No Content- There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.

Redirection messages--

300 Multiple Choice- The request has more than one possible response. The user-agent or user should choose one of them. 

301 Moved Permanently- The URL of the requested resource has been changed permanently. The new URL is given in the response.

302 Found- This response code means that the URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.


Client error responses-

400 Bad Request-The server could not understand the request due to invalid syntax.

401 Unauthorized- Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.

403 Forbidden-The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.

404 Not Found- The server can not find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. 

405 Method Not Allowed- The request method is known by the server but has been disabled and cannot be used.

Server error responses-

500 Internal Server Error- The server has encountered a situation it doesn't know how to handle.

501 Not implemented- The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.

502 Bad Gateway- This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.

503 Service Unavailable -The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. T

504 Gateway Timeout - This error response is given when the server is acting as a gateway and cannot get a response in time.

505 HTTP Version Not Supported -The HTTP version used in the request is not supported by the server.

October 10, 2020

SQL Commands

 select 

AS forcolumn name 

select name, continent as "continent name" from Country order by Name;

select name, continent as "continent name" from Country order by Name;

select name, continent , region from Country where continent= "Europe" order by Name LIMIT 5 offset 5;

select name as "Country" from Country;

select count(*) from Country where population> 100000 AND Continent= "Europe";

    

 select * from customer;

insert into customer(name,address, city, state, zip)

values("FRD ","abc","KK","CL","334");

update customer SET address= "klllll" where id = 2;

delete from customer where id = 4;

select * from customer ;

create table test(

a integer,

b text

);

insert into test values (1,'a');

insert into test values (2,'b');

insert into test default values;

select * from test;

drop table test ;

drop table if exists test;



create table test(

a integer not null,

b text not null,

c text


);


insert into test values (1,'this','that');

insert into test (a,b,c) values ('one','two','');

select * from test;


 

null is not a value the null state represnts a lack  of value 

Constraints in SQL

 not nul, uniques 


create table test (a Text unique, b text, c text default 'cat');

insert into test (a,b) values ('one','two');

insert into test (a,b) values ('three','two');

select * from test;


alter table test add e text default 'dog';

select * from test;


alter table test add e text default 'dog';

select * from test;


select name, population from country

where population <50000 OR population is null order by population desc;

select name, population, continent from country


create table left (id integer, description text);

create table right(id integer, description text);

insert into left values (1, 'leftone'); 

insert into left values (2, 'lefttwo');

insert into left values (3, 'leftthree');

insert into left values (4, 'leftfour');

insert into left values (5, 'leftfive');

insert into left values (6, 'leftsix');

insert into left values (7, 'leftseven');

insert into left values (8, 'lefteight');


insert into right values(1, 'rightone');

insert into right values(2, 'righttwo');

insert into right values(3, 'rightthree');

insert into right values(4, 'rightfour');

insert into right values(5, 'rightfive');


insert into right values(6, 'rightsix');

insert into right values(7, 'rightseven');

select * from left;

select  *from right;

select l.description as left , r.description as right 

    from left as l

    left join right as r on l.id= r.id

    ;

where continent in ('Asia', 'Europe') order by name;


select distinct continent from country; more unique results 



select s.id as sale ,i.name, s.price

from sale as s

join item as i on s.item_id= i.id;


insert into customer (name) values ('jane smith');

select * from customer;

select c.name as cust, c.zip, i.name as item,i.description, s.quantity as quan,s.price as price

from sale as s

join item as i on s.item_id= i.id

join customer as c on s.customer_id= c.id

order by cust, item

;



insert into customer (name) values ('jane smith');

select * from customer;

select c.name as cust, c.zip, i.name as item,i.description, s.quantity as quan,s.price as price

from customer as c

left join sale as s on s.customer_id= c.id

left join item as i on s.item_id= i.id

order by cust, item

;





strings- 


select released,

substr(released, 1, 4) as year,

substr(released, 6, 2)as month,

substr(released, 1, 4) as day

from album order by released 

;





select released,

substr(released, 1, 4) as year,

substr(released, 6, 2)as month,

substr(released, 1, 4) as day

from album order by released;


select  RTRIM ('   string');

select 'string'= 'STRing';

select LOWER('string')= lower('STRing');

select upper('string')= lower('STRing');





numeric type --

select typeof(1+1);

select typeof(1+1.2);

select typeof('first');

select typeof('first' + 'name');

select 1/2;

select cast(1 as real)/2;

select 17/5;

select round(2.455555);

select 17%5;


date and time

select datetime('now');

select date('now');

select time('now');

select datetime('now','+1 day');



aggregates:

having for aggregate data 

where by for non aggregate data 



select a.title as album , count(t.track_number) as tracks

from track as t

join album as a

on a.id= t.album_id

group by a.id

order by Tracks desc,album

;






Use the __distinct___ keyword to remove duplicates from a result

Use the _group by ____ clause to collate groups of results before calling an aggregate function.
















You can undo an unfinished transaction by using the ___rollback__ statement.

begin transction

end transaction







create table updatesale(id interger primary key, itemid integer, quan integer, covalue integer);

insert into updatesale(itemid, quan ,covalue) values (31,2,33);

create trigger updatesale before update on sale

Begin

select raise(rollback ,"can not update") from updatesale

where id=new.id and covalue= 1;

End

;

Begin transaction;

update updatesale set quan= 9 where id=3;

End Transaction;

select * from updatesale;









The SELECT ___distinct__ statement removes duplicates from a result set.




To insert a blank row use the _default____ clause.




To delete a table, use the ___drop__ statement.

What are the three arguments for the SUBSTR() function in SQLite?



You are correct!


string to evaluate, starting position, length of string


The type of trigger to use for preventing updates to reconciled rows is _____


delete rows - delete cmd


delete table- drop table


alter table - add new coulmn


id integer primary key


substr(stringstart,end)


length


trim


upper lower




Commonly Used Attributes in Nunit

 Catagory- The Category attribute provides an alternative to suites for dealing with groups of tests. Either individual test cases or fixtures may be identified as belonging to a particular category

Description - -The Description attribute is used to apply descriptive text to a Test, TestFixture or Assembly

expected Condition -This is the way to specify that the execution of a test will throw an exception. This attribute has a number of positional and named parameters, which we will discuss in separate sections according to the purpose they serve.

Explicit -The Explicit attribute causes a test or test fixture to be ignored unless it is explicitly selected for running. The test or fixture will be run if it is selected in the gui, if its name is specified on the console runner command line as the fixture to run or if it is included by use of a Category filter.

ignore-The ignore attribute is an attribute to not run a test or test fixture for a period of time. The person marks either a Test or a TestFixture with the Ignore Attribute

Platform-The Platform attribute is used to specify platforms for which a test or fixture should be run

Properly -The Property attribute provides a generalized approach to setting named properties on any test case or fixture, using a name/value pair.

 

SetUp -This is the attribute that marks a class that contains the one-time setup or teardown methods for all the test fixtures under a given namespace. The class may contain at most one method marked with the SetUpAttribute 

TearDown-This attribute is used inside a TestFixture to provide a common set of functions that are performed after each test method is run. A TestFixture can have only one TearDown method

TestFixture -This is the attribute that marks a class that contains tests and, optionally, setup or teardown methods.

TestFixture Set Up- This attribute is used inside a TestFixture to provide a single set of functions that are performed once prior to executing any of the tests in the fixture.

TestFixture Tear Down--This attribute is used inside a TestFixture to provide a single set of functions that are performed once after all tests are completed

 Parallel test execution - do not declare static 

use [parallelizable]


What is Specflow???


SpecFlow is a test automation solution for .NET built upon the BDD paradigm. Use SpecFlow to define, manage and automatically execute human-readable acceptance tests in .NET projects (Full Framework and .NET Core).

SpecFlow tests are written using  Ghekin, which allows you to write test cases using natural languages. SpecFlow uses the official Gherkin parser, which supports over 70 languages.

These tests are then tied to your application code using so-called  bindings, allowing you to execute the tests using the testing framework of your choice.

You can also execute your tests using SpecFlow’s own dedicated test runner, SpecFlow+ Runner.

The automation that connects the Gherkin specifications to source code is called a binding. The binding classes and methods can be defined in the SpecFlow project

The step definition that automates the scenario at the step level. This means that instead of providing automation for the entire scenario, it has to be done for each separate step.

hooks can be used to perform additional automation logic on specific events, e.g. before executing a scenario.

what is Scenario Outline:   Multiple iteration of same scenario with different data.










October 09, 2020

Data Driven Testing in SpecFlow-



Data Driven Testing in SpecFlow-


1.  Parameterization without Example Keyword-

LogIn_Feature.feature






2.  Data Driven Testing in SpecFlow using Scenario Outline-

Parameterization with Example Keyword
@mytag
Scenario Outline: Successful Login with Valid Credentials
Given User is at the Home Page
And Navigate to LogIn Page
When User enter <username> and <password>
And Click on the LogIn button
Then Successful LogIN message should display
Examples:
| username | password |
| testuser_1 | Test@123 |
| testuser_2 | Test@153 |


3.Parameterization using Tables

Transform Table into Dictionary using Table.Rows
Transform Table into DataTable using Table.Header
Tables – CreateInstance
Tables – CreateSet

here is the link:
https://www.toolsqa.com/specflow/tables-in-specflow/

4. Data Driven Testing in SpecFlow using External Files-

Parameterization using Excel Files
Parameterization using Json
Parameterization using XML

October 05, 2020

BDD vs TDD vs ATDD


TDD-
It is an iterative development process . Each iteration starts with a set of tests written for a new piece of functionality. Test cases are created before the code is written. It instructs the developer to write new code once the test has failed .
Re-factoring refers to the process of modifying the code without changing its main functionality or behaviour.

Benefits of Test-Driven Development--
Unit test cases are covered early.
Helps reduce the amount of time required for rework.
Helps explore bugs or errors very quickly.
Helps get faster feedback.
Encourages the development of cleaner and better designs.
Enhances the productivity of the programmer.
Allows any team member to start working on the code in the absence of a specific team member. This encourages knowledge sharing and collaboration.
Gives the programmer confidence to change the large architecture of an application.

Steps- 
Add a test , Run tests  if fails write code to fix it , Run test, Refactor code, Repeat 

For Example--

The test you write might look like this:
Describe('sum()', function () { it('should return the sum of given numbers', function () { expect(simpleCalculator.sum(1,2)).to.equal(3); expect(simpleCalculator.sum(5,5)).to.equal(10); }); })

Your implementation is currently empty. You haven’t implemented yet, so the tests will fail. You want to verify that your test is deterministic: it will tell you when it should fail or pass.
var Calculator = function () { return true // implementation goes here }
Implement it. Make the test pass. Here we’ll write the code that will make the test pass.
var Calculator = function () { return{ sum: function(number1, number2){ return number1 + number2; } }; }

Now your test will be satisfied, because we’ve added the function.

Disadvantage- Rewrite the test when the requirement change.

RED-GREEN-REFACTOR

BDD- 

User-acceptance testing (UI-driven testing) builds on this user acceptance criteria and user story. UI-driven testing usually uses tools like  selenium or cucumber which help test against the user’s journey on a site that’s up and running.

The user journey story represents a user’s behaviour. Using the business requirements provided, the developer can think about scenarios of how a user will use this new functionality. And those scenarios can be used to write the tests. This is called behaviour-driven development (BDD).

BDD is a widely-used method in UI-driven testing. It is written in a structure known as “Given, When and Then.”
Given - the state of the system that will receive the behaviour/action
When - the behaviour/action that happens and causes the result in the end
Then - the result caused by the behaviour in the state


Business-Driven Development (BDD) is a testing approach derived from the Test-Driven Development (TDD) methodology. In BDD, tests are mainly based on systems behaviour. This approach defines various ways to develop a feature based on its behaviour. 

Let’s take an example for better understanding:
Given the user has entered valid login credentials
When a user clicks on the login button
Then display the successful validation message

Key benefits of Behavioral-Driven Development approach:

Helps reach a wider audience by the usage of non-technical language
Focuses on how the system should behave from the customer’s and the developer’s perspective
BDD Is a cost-effective technique
Reduces efforts needed to verify any post-deployment defects.


ATDD-
Acceptance Test-Driven Development is very similar to Behavioral-Driven Development. However, a key difference between them is: BDD focuses more on the behavior of the feature, whereas ATDD focuses on capturing the accurate requirement

October 02, 2020

Jenkins with Github

Hello everyone, I am going to share some screenshots how to proceed -
I have done the procedure both manually and automatically.


firsly I have created a java project and run that project into command line . 


I run the java project in cmd line and start my jenkins from there only using -  java -jar jenkins.war command.


What next???
Then I created a job in jenkins and was able to run that project.

These commands  I have used in  Execute windows batch command in build- 


 Cd /Users/Reyansh/eclipse-workspace/firstproject/src
javac firstproject/firstproject.java
java firstproject/firstproject

Now comes to automation-

firstly make github account and create a remote repo and make a connection between local and remote repo.

Now, check git install plugin in jenkins.

create a job -


I have set up poll SCM-



Now if I start run my project, it will run but what I have done i went back to my project and made some changes and without click on build, It started the job itself.  As I have set up 
Poll SCM , it will check git repo every minute .

you can see in the output , it started by scm change-






JENKINS



Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies.

1. Download the software from https://www.jenkins.io/ and Double click


2.  Click on Next

3. Click on Next



4. click on run on localsystem

5. Warning Symbol will get converted into green tick. Click on Next




6. Enter the port number as 8080 or 8081 and click on Test port to get the warning button get converted into green tick. Then click on next

7. Click on next


8. Choose option under Firewall Exception and click on next


9. Click on Install





10.





11. Jenkins will be Installed and will automatically open the page localhost:8080/



12. Fill Details





13. Jenkin Dashboard




Key concepts in Pipeline

 1. Agent- To build your code or deploy your software using azure pipelines, you need at least one agent. Two types of agent- Microsoft host...