Automating API SDK testing that supports multiple programming languages - testing

I have a requirement to automate testing for an API SDK written in 5 programming languages.
The SDK is similar to jira SDKs.
Writing Tests across all 7 languages will lead to duplicating testing logic in all programming languages.
I want to find a way to call the SDK methods (which are basically API calls internally) from different programming languages in any one language (preferably python) and compare the response with the public api call (SDKs being wrappers for these public APIs.)
So far I have thought of creating a rest server in all languages (wrapper APIs over the SDK methods) and call these wrapper APIs to get the response and then proceed with comparison
I am wondering how the industry soles this problem in general and if there is a simpler solution to this problem which does not involve creating wrapper APIs for SDKs from different languages.

Related

What is the difference between an API wrapper and a SDK?

From my understanding, these two words are used almost interchangeably to refer to code that allows people to use a particular programming language to interact with an API. For example, many Python packages are labeled API wrappers or SDKs while providing essentially the same functionalities.
However, I am interested in hearing all of your opinions regarding the semantics of these two words.

API automation testing for localized languages

I am new to api automation and trying to understand few things. I have a web application and it has its APIs exposed for all basic functionality. But this product is also localized in other foreign languages.
My understanding:
The same APIs are used for all languages. APIs actually test functionality and not the UI. For most cases I need not test these APIs again for other languages.
My question:
Is it possible that there would be separate APIs exposed for different locales?
Or can I pass different locale(foreign language) strings as parameters to the same APIs?
Usually it's not the best practice to expose the various API for the different locales. The API that affected from the language may includes the language id. In this case the internal code may take in the consideration the different languages. Then you have to provide in your tests some variations of such language id.
Other case that you have to consider, the API that includes the strings as the parameter. In this case you will test the strings written in the different languages . Especially you should take in the account the Asia languages like Japanese and Chinese and right to left languages like Arabic and Hebrew.

Difference between API and IDL

Both API and IDL act as an interface between two components of software and play the role of bridge between two components of software or between two software.
What is the difference between them?
API is a concept. It is any external programming interface that a piece of software exposes so that it can accept external input from some other software, run some logic, and provide output. Usually when we talk about API's, like Facebook's Graph API, or the Windows API, we are talking about the types and logic contained within those API's, and how they can be used.
IDL, as the tag says, is a language you can use to describe a API, in a manner that other software may understand. It is platform independent, so can be used to facilitate integration. More information about this language is vastly available if you search for it ;)

Is an API language specific

This is probably a pretty basic question, but are APIs language specific. In General, do certain languages only work with certain APIs or should any language be able to talk to any API.
Specifically, Bing Webmaster Tools API has code example in C#. Does that mean I can't access the API in Python?
Thanks in advance!
If an API is exposed via HTTP and returns a language-neutral format like JSON or XML (which most popular third-party APIs do) then there's no restriction on what programming language you can use to parse the API responses.
Some API providers may provide specific client libraries e.g,. The Facebook JavaScript SDK, but this doesn't preclude using a different language, it just means you'll get less support in doing so.
An API always relates to just one language. However, sometimes interfaces or libraries are created so that they can be accessed by other languages. For example, XML is used for specifying listings in ebay. It is uploaded via HTTP. However there are many libraries, such as for PHP and Java, that abstract that into their terms, but keep a direct correlation between their usage and the XML they send.
It depends. Many APIs are designed for use with one particular language, for example functionality provided by a PHP framework. Having said that, it does not necessarily mean that in the future another language could start using them; for example IronPython making use of the .NET Framework.
It is very common for compiled libraries to be used by multiple languages, e.g. graphics libraries.
You can also have web-service based APIs (e.g. Bing in your example) which respond to HTTP requests. These could be invoked by any language, or anything in general.

For what programs are Objective C and Ruby ideal on the Mac?

as a Mac outsider it seems that two popular programming languages on the Mac appear to be Objective C and Ruby.
From what I understand the main API Cocoa seems to be written in and optimized for Objective C, but it is also possible to use Ruby for that.
Are there different areas where each language is ideal, for example, I could imagine Objective C could be ideal for a GUI layer, or standalone desktop app, and Ruby could be good for web services etc. What about classic business logic, or data access layers?
What language would be a good choice for a library of services for example? Can we write a library in one language and link to it from a main program written in the other language?
If I wanted to write a layered enterprise application using domain driven design and dependency injection which languages could support each concerns? Are things like DDD and DI common amongst Mac devs?
Just a curious outsider.
If I were to write a big application, I would stick to Objective-C only. It’s not hard, it’s the most supported option and for the foreseeable it will stay that way. As for Ruby, there used to be Java support in Cocoa that does not exist anymore. I’d hate to have a large legacy application written in mixture of Java and Objective-C and having the prospect of rewriting the Java parts or sticking with older OS.
(The previous paragraph applies to writing pure desktop applications. If you wanted and could write a part of the application say as a local webservice it would be quite different, as the Ruby support there would be much more dependable. Depends on your people, experience, goals and other variables.)
Dependency Injection and DDD are both abstract ideas, so yes, you can certainly do that in Cocoa. I have no idea about how many Mac devs do it. As for DI, there is strong support for loose coupling in Cocoa and the whole technology stack (see Interface Builder, KVO/KVC or bindings).
Hope that helps.