Posts

Showing posts from May, 2016

How to test an API.

Image
Before going to API testing, let's first understand What is an API? API is an acronym for  A pplication  P rogramming  I nterface. It enables communication and data exchange between two separate software systems. A software system implementing an API contains functions/sub-routines which can be executed by another software system. What is API testing? API testing is entirely different from GUI testing and mainly concentrates on the business logic layer of the software architecture. This  testing won't concentrate on the look and feel of an application. Instead of using standard user inputs(keyboard) and outputs, in API Testing, you use software to send calls to the API, get output, and note down the system's response. API Testing requires an application to interact with API. In order to test an API, you will need to Use Testing Tool to drive the API Write your own code to test the API Set-up of API Test environment API testing is different

SQL NULL Functions.

SQL ISNULL(), NVL(), IFNULL() and COALESCE() Functions. Look at the following "Products" table: P_Id ProductName UnitPrice UnitsInStock UnitsOnOrder 1 Jarlsberg 10.45 16 15 2 Mascarpone 32.56 23   3 Gorgonzola 15.67 9 20 Suppose that the "UnitsOnOrder" column is optional, and may contain NULL values. We have the following SELECT statement: SELECT ProductName,UnitPrice*(UnitsInStock+UnitsOnOrder) FROM Products In the example above, if any of the "UnitsOnOrder" values are NULL, the result is NULL. Microsoft's ISNULL() function is used to specify how we want to treat NULL values. The NVL(), IFNULL(), and COALESCE() functions can also be used to achieve the same result. In this case we want NULL values to be zero. Below, if "UnitsOnOrder" is NULL it will not harm the calculation, because ISNULL() returns a zero if the value is NULL: MS Access SELECT ProductName,UnitPrice*(UnitsInStock+IIF(ISNULL(UnitsOnOr...

SQL Injection.

Image
An SQL Injection can destroy your database. SQL in Web Pages When SQL is used to display data on a web page, it is common to let web users input their own search values. Since SQL statements are text only, it is easy, with a little piece of computer code, to dynamically change SQL statements to provide the user with selected data: Server Code txtUserId = getRequestString("UserId"); txtSQL = "SELECT * FROM Users WHERE UserId = " + txtUserId; The example above, creates a select statement by adding a variable (txtUserId) to a select string. The variable is fetched from the user input (Request) to the page. The rest of this chapter describes the potential dangers of using user input in SQL statements. SQL Injection SQL injection is a technique where malicious users can inject SQL commands into an SQL statement, via web page input. Injected SQL commands can alter SQL statement and compromise the security of a web application. SQL Injection B...

How to use Assertions in JMeter.

Image
Assertion help verify that your server under test returns the  expected results. Following are some commonly used Assertion in JMeter: Response Assertion Duration Assertion Size Assertion XML Assertion HTML Assertion Response Assertion The response assertion lets you add pattern strings to be compared against various fields of the server response. For example, you send a user request to the website  http://www.google.com  and get the server response. You can use Response Assertion to verify if the server response  contains  expected pattern string (e.g. "OK"). Duration Assertion The Duration Assertion tests that each server response was received within a  given amount  of time. Any response that takes longer than the given number of milliseconds (specified by the user) is marked as a failed response. For example, a user request is sent to  www.google.com  by JMeter and get a response within  expected  time

How to save image in sql server 2012 database using JAVA.

package Image_data; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; public class Save_Image { public static void main(String[] args) {                      DB db = new DB();                Connection conn=db.dbConnect(                  "jdbc:jtds:sqlserver://localhost:1433/test","sa","");                db.insertImage(conn,"d://filepath//test.JPG");                db.getImageData(conn);       class DB {        public DB() {}