Listing Java, JavaScript, and Python tests
In the last article, we finished identifying a Java project and listing its tests. Let’s see how I did with JavaScript and Python projects:
JAVASCRIPT PROJECTS
My main approach has been the first I described here, I search the package.json and the framework name inside of the project folder in order to identify the stack.
After that, we can simply search into the “test” folder (Mocha and Tape) or “spec” for Jasmine.
It true that is a very volatile solution, mainly because you can change the default folder, or even not use a package.json. But, for the first issue I’ll add a method which will allow to find the specified folder by the user in the settings file; and for the second one simply an exception, adding the package.json as another requirement for this app to work (besides pom.xml for Java).
PYTHON PROJECTS
In order to identify a Python project, we just look for any .py file. And, for listing, we have a very interesting approach:
After some research, I found the discover() function of the unittest library (installed by default in Python2 and 3), which allow us to find every test of a project.
It wasn’t difficult to do a little script which would create a .txt with all the test of my project:


Now with Java we just have to execute the script and then read the file:

For executing python we can also use Jython (the old JPython), an implementation of the Python language for the Java platform. But for now, I want to Keep It Simple (Stupid!), add that improvement to Trello and keep the developing going (incremental development for the win!).
Finally, I build the library, import it to my project and use it as I did in the last article:

The next steps would be to find how to execute these listed tests, so I can select the tests I want to be executed, and avoiding executing all of them.
