6

Development stack is in Python (flask) and our automation suite(API) is coded in Java.

Can we do code coverage and if Yes, which plugin to use?

2
  • plugins for what ? Jun 1, 2018 at 11:11
  • That really depends on what kind of API you're talking about. If you're talking about REST/HTTP API that is language independent, then you can use different programming languages on client (test) side and server (SUT) side. If you're talking about Python module API then you would need some libraries that can translate Java calls to Python calls and back.
    – dzieciou
    Apr 9, 2020 at 11:50

4 Answers 4

1

The very basic essence of the term API is to provide an interface for external communication. That said, it is perfectly fine and possible to use your tests written in Java to test API endpoint given you respect the specifications (inputs, output). However, a good practice is to ensure consistency by documenting the API with Swagger for instance.

0
  • Flask:
  • API:
    • Sun's Jcov is pretty much complete. If you use Eclipse, there is a plugin called EclEmma that can be easier to setup and use than Jcov.
1
  • Automation tests are in Java (Rest-assured). It is a separate project which is being used to test the Python (Application) rest api's on Ci-Cd. I need coverage of the Python code only from the automation suite. Is it possible? Jan 31, 2018 at 19:11
0

Coverage analysis is typically achieved by hooking the code that looks up methods or functions. A log is then created if which areas have been used, doing this across languages isn't really possible unless you are prepared to coerce them into the same runtime with something like parrot. I would not recommend this as it will be such an unusual situation that the test is unlikely to be meaningful.

You could make a simple version of this by having a log of calls between the two codebases and comparing it to as list of possible calls, this could be done with a protocol specific spy. I'm not aware of generic tools for this as this is a very unusual requirement.

Tests in a compiled language for code in interpreted language is very strange.

0

You can use sonarqube for that check this blog : https://sevastoyanov.blogspot.com/2016/09/install-and-configure-sonarqube-for.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.