Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

For identifying a particular Test case is python a new field will be introduced in managed scripts. This new field will be used to mark particular test case as Python or not. The below are the stepwise information on how a particular test case will executed

  1. At first Python test case should be added in automatics, for that when adding a new test case the new test case identification field should be selected as Python and saved in Automatics.
  2. Once a Test case is triggered, Automatics will first check whether the test case is Python or not using the value in the new identification field.
  3. Once Jenkins job for Python script execution is triggered from automatics, it will pull the latest Python code from the configured repo along with the latest automatics core and it will invoke the corresponding Python script using JEP based on the Automation ID of the test case.


Image Added


 Enable Python scripts to use Automatics Core, Test Utils & Props

For unlocking/enabling the access of Automatics Java API's to python scripts, JPype framework can be used. For accessing the Java API's from python test scripts, a new set of Python scripts which contains all the required API's should be developed which will make use of the JPype framework to instantiate and invoke the Java classes and method in Automatics Core and Test Utils. For example, A python script similar to AutomaticsTapApi class can be created to get the Automatics properties configuration and other API's of Automatics core. This python script will in-turn call the AutomaticsTapApi Java class present in the Automatics core project using JPype to enable all the required functions. The below python script will invoke AutomaticsTapApi java class inside automatics-core-2.9.0.jar to get the current execution mode if available
AutomaticsTapAPI.py

# Boiler plate stuff to start the module
import jpype
import jpype.imports
from jpype.types import *
 
# Launch the JVM
jpype.startJVM(classpath=['jars/automatics-core-2.9.0.jar'])
 
# import the Java modules
from com.automatics.tap import AutomaticsTapApi
 
tapApi = AutomaticsTapApi.getInstance()
print(tapApi.getCurrentExecutionMode())