{"id":1559,"date":"2022-03-31T08:28:29","date_gmt":"2022-03-31T08:28:29","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1559"},"modified":"2022-03-31T08:28:29","modified_gmt":"2022-03-31T08:28:29","slug":"introduction-to-api-testing","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2022\/03\/31\/introduction-to-api-testing\/","title":{"rendered":"Introduction to API Testing"},"content":{"rendered":"<p>API testing\u00c2\u00a0is a type of\u00c2\u00a0software testing\u00c2\u00a0that involves testing\u00c2\u00a0application programming interfaces\u00c2\u00a0(APIs) directly and as part of\u00c2\u00a0integration testing\u00c2\u00a0to determine if they meet expectations for functionality, reliability, performance, and security.\u00c2\u00a0Since APIs lack a\u00c2\u00a0GUI, API testing is performed at the\u00c2\u00a0message layer.\u00c2\u00a0API testing is now considered critical for automating testing because APIs now serve as the primary interface to\u00c2\u00a0application logic\u00c2\u00a0and because\u00c2\u00a0GUI tests\u00c2\u00a0are difficult to maintain with the short release cycles and frequent changes commonly used with\u00c2\u00a0Agile software development\u00c2\u00a0and\u00c2\u00a0DevOps.<\/p>\n<p>API testing involves testing APIs directly (in isolation) and as part of the end-to-end transactions exercised during integration testing.\u00c2\u00a0Beyond\u00c2\u00a0RESTful APIs, these transactions include multiple types of endpoints such as\u00c2\u00a0web services,\u00c2\u00a0ESBs,\u00c2\u00a0databases,\u00c2\u00a0mainframes,\u00c2\u00a0web UIs, and\u00c2\u00a0ERPs. API testing is performed on APIs that the development team produces as well as APIs that the team consumes within their application (including third-party APIs).<\/p>\n<p>API testing is used to determine whether APIs return the correct response (in the expected format) for a broad range of feasible requests, react properly to\u00c2\u00a0edge cases\u00c2\u00a0such as failures and unexpected\/extreme inputs, deliver responses in an\u00c2\u00a0acceptable amount of time, and respond securely to potential\u00c2\u00a0security attacks.\u00c2\u00a0Service virtualization\u00c2\u00a0is used in conjunction with API testing to isolate the services under test as well as expand test environment access by simulating APIs\/services that are not accessible for testing.<\/p>\n<p>API testing commonly includes testing\u00c2\u00a0REST\u00c2\u00a0APIs or\u00c2\u00a0SOAP\u00c2\u00a0web services\u00c2\u00a0with\u00c2\u00a0JSON\u00c2\u00a0or\u00c2\u00a0XML\u00c2\u00a0message payloads\u00c2\u00a0being sent over\u00c2\u00a0HTTP,\u00c2\u00a0HTTPS,\u00c2\u00a0JMS, and\u00c2\u00a0MQ.\u00c2\u00a0It can also include message formats such as\u00c2\u00a0SWIFT,\u00c2\u00a0FIX,\u00c2\u00a0EDI\u00c2\u00a0and similar fixed-length formats,\u00c2\u00a0CSV,\u00c2\u00a0ISO 8583\u00c2\u00a0and\u00c2\u00a0Protocol Buffers\u00c2\u00a0being sent over\u00c2\u00a0transports\/protocols\u00c2\u00a0such as\u00c2\u00a0TCP\/IP,\u00c2\u00a0ISO 8583,\u00c2\u00a0MQTT,\u00c2\u00a0FIX,\u00c2\u00a0RMI,\u00c2\u00a0SMTP,\u00c2\u00a0TIBCO Rendezvous, and\u00c2\u00a0FIX.<\/p>\n<p>API Testing is recognised as being more suitable for\u00c2\u00a0test automation\u00c2\u00a0and\u00c2\u00a0continuous testing\u00c2\u00a0(especially the automation used with\u00c2\u00a0Agile software development\u00c2\u00a0and\u00c2\u00a0DevOps) than GUI testing.\u00c2\u00a0Reasons cited include:<\/p>\n<ul>\n<li>System complexity:\u00c2\u00a0GUI tests can&#8217;t sufficiently verify functional paths and back-end APIs\/services associated with multitier architectures. APIs are considered the most stable interface to the system under test.<\/li>\n<li>Short release cycles with fast feedback loops:\u00c2\u00a0Agile and DevOps teams working with short iterations and fast feedback loops find that GUI tests require considerable rework to keep pace with frequent change. Tests at the API layer are less brittle and easier to maintain.<\/li>\n<\/ul>\n<p>For these reasons, it is recommended that teams increase their level of API testing while decreasing their reliance on GUI testing. API testing is recommended for the vast majority of test automation efforts and as much edge testing as possible. GUI testing is then reserved for validating typical use cases at the system level, mobile testing, and usability testing.<\/p>\n<p>API testing typically involves the following practices:<\/p>\n<ul>\n<li>Unit testing\u00c2\u00a0&#8211; Testing the functionality of individual operations.<\/li>\n<li>Functional testing\u00c2\u00a0&#8211; Testing the functionality of broader scenarios, often using unit tests as building blocks for end-to-end tests. Includes test case definition, execution, validation, and\u00c2\u00a0regression testing.<\/li>\n<li>Load testing\u00c2\u00a0&#8211; Validating functionality and performance under load, often by reusing functional test cases.<\/li>\n<li>Runtime error detection\u00c2\u00a0&#8211; Monitoring an application the execution of automated or manual tests to expose problems such as race conditions, exceptions, and resource leaks.<\/li>\n<li>Security testing\u00c2\u00a0&#8211; Includes\u00c2\u00a0penetration testing\u00c2\u00a0and\u00c2\u00a0fuzz testing\u00c2\u00a0as well as validating authentication, encryption, and access control.<\/li>\n<li>Web UI testing\u00c2\u00a0&#8211; Performed as part of end-to-end integration tests that also cover APIs, enables teams to validate GUI items in the context of the larger transaction.<\/li>\n<li>Interoperability testing &#8211; (SOAP only) Checking conformance to\u00c2\u00a0Web Services Interoperability\u00c2\u00a0profiles.<\/li>\n<li>WS-*\u00c2\u00a0compliance testing &#8211; (SOAP only) Checking compliance to WS-* standards such as WS-Addressing, WS-Discovery, WS-Federation, WS-Policy, WS-Security, and WS-Trust.<\/li>\n<li>Penetration testing\u00c2\u00a0&#8211; testing a computer system, network or Web application to find vulnerabilities that an attacker could exploit.<\/li>\n<li>Fuzz-testing\u00c2\u00a0&#8211; massive amounts of purely random data, sometimes referred to as \u00e2\u20ac\u0153noise\u00e2\u20ac\u009d or \u00e2\u20ac\u0153fuzz,\u00e2\u20ac\u009d is forcibly input into the system in order to attempt a forced crash, overflow, or other negative behavior. This is done to test the API at its absolute limits, and serves somewhat as a \u00e2\u20ac\u0153worst case scenario.\u00e2\u20ac\u009d<\/li>\n<\/ul>\n<p>The above is a brief about API Testing. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>API testing\u00c2\u00a0is a type of\u00c2\u00a0software<\/p>\n","protected":false},"author":1,"featured_media":1561,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[457,458,7],"tags":[459,460,18],"class_list":["post-1559","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api-testing","category-software-testing","category-techtrends","tag-api-testing","tag-software-testing","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1559"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1559\/revisions"}],"predecessor-version":[{"id":1560,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1559\/revisions\/1560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1561"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}