API Testing - koglak/SWE573 GitHub Wiki

1. Performing API Test

1.1. What is API?

API(Application Programming Interface) is a bridge between database and user interface. When an application has been used on mobile phone, the application has been connected to internet, therefore, it can send data to server. When server received data, it firstly interprets data, secondly takes required action and finally response to mobile phone. The application interprets the response and presents to user. These steps are happened through API. In summary, it is a connection between softwares.

As a real life example, when user tries to book a flight online by using Kayak, skyscanner and so on, API takes the requests, interacts with travel service to take required information from airline's database. When it received information, API shares the response with user.

API provides security for users, because it shared small package of data. Consequently, it became valuable for many business and major companies like Google, eBay, Amazon use it[1].

1.2. What is API Testing?

API testing is kind of software testing which validates API. Main purpose of API testing is controlling the functionality, reliability, security and performance of programming interfaces. Moreover, it is intended to reveal bugs. Testing API is quite important during product development phase. API testing is a step to understand quality of software product[2].

Types of API testing:

  • Functionality
  • Reliability
  • Load
  • Security
  • Creativity
  • Proficency
  • Negativity

1.3. What is Wikidata?

Wikidata is a free and open database. It collects structured data and provides them to Wikipedia, Wikimedia Commons and the other wikies. You can modify, copy, distribute and perform data without permission. It is collaboratively maintained, in other words, Wikidata editors decides the rules of content creation and management. Moreover, it is multilingual, entered data in any language is directly available in all other languages[3].

1.4. Performing API Test for Wikidata

Wikidata Query Service is a tool to provide information about Wikidata's content. SPARQL is a language of quaries for databases. Using this language, you can ask many questions to database as query via Wikidata Query Service and service brings the results[4].

A basic query, which is shared Wikidata:

SELECT ?a ?b ?c
WHERE
{
 x y ?a.
 m n ?b.
 ?b f ?c.
}

As an example which is given in Wikidata:

SELECT ?child
WHERE
{
 #  child "has parent" Bach
 ?child parent Bach.
 # (note: everything after a ‘#’ is a comment and ignored by WDQS.)
}

On Wikidata, items and properties are not identified by human-readable names like “father” (property) or “Bach” (item). For simple WDQS triples, items should be prefixed with wd:, and properties with wdt:. To identify item or property, Q-number of them has been used. As another example:

SELECT ?child
WHERE
{
# ?child  father   Bach
 ?child wdt:P22 wd:Q1339.
}

I wanted to filter ancient cities in Turkey where on İpekyolu. As a result of my query, 3 cities have been listed.

SELECT ?city
WHERE
{
  #ancient city as archeological sit
  ?city wdt:P31 wd:Q839954.
  #located in Turkey
  ?city wdt:P17 wd:Q43.
  #administrative territorial entity is İpekyolu
  ?city wdt:P131 wd:Q16848468 .
}

REFERENCES

[1] What is an API?

[2] API Testing 101: Learn The Basics

[3] Wikidata Introduction

[4] Wikidata:SPARQL tutorial

⚠️ **GitHub.com Fallback** ⚠️