# Automation Tracker

Use this package to quickly track your automation projects and usage. It has been developed to ensure easy and 
seamless integration with any third party automation tool.

Documentation: https://automation-tracker.readthedocs.io/en/latest/ for more information.

## Examples of How To Use it on your Robot Framework

### Setup Robot Framework

```robotframework
*** Settings ***
Library    AutomationTracker
```

### Usage of the library in Robot Framework

```robotframework
*** Test Cases ***
Example
    Start Tracker    ${PROJECT_NAME}    ${PROJECT_VERSION}    ${PROJECT_DESCRIPTION}    ${PROJECT_URL}    ${PROJECT_EMAIL}
    Start Suite    ${SUITE_NAME}    ${SUITE_DOCUMENTATION}
    Start Test    ${TEST_NAME}    ${TEST_DOCUMENTATION}
    Start Keyword    ${KEYWORD_NAME}    ${KEYWORD_DOCUMENTATION}
    End Keyword
    End Test
    End Suite
    End Tracker
```

### Examples of How To Use it on your Python


```python
#import the DB tracker and use functions from it
from RobotTracker.TrackerDB import *

#invoke the tracker
TrackerDB("https://your_ip_or_domain").manually_start_tracker_detailed("POS",
"justus","UAT", "CRQ-1234","Q-OPS", "testType","API", "200", "100", "50","150","0","0","0","0", 
 "0","0", "0","100", "100", "0", "200","TEST-1234")
```

### Using a listener to listen to your code runs and track the testcase runs

#### Setup the robot framework listener

```robotframework
*** Settings ***
Library    AutomationTracker
Suite Setup    Start Tracker    ${PROJECT_NAME}    ${PROJECT_VERSION}    ${PROJECT_DESCRIPTION}    ${PROJECT_URL}    ${PROJECT_EMAIL}
Suite Teardown    End Tracker
Test Setup    Start Test    ${TEST_NAME}    ${TEST_DOCUMENTATION}
Test Teardown    End Test
```

#### Create a folder in your directory Tracking and create file Justus_Shared.robot eg:

below is an example image of how the file should look like

![Demo_Image](https://ziscotechglobal.com/Automation/tracker_file_demo.png)

#### Copy the below code into the file Justus_Shared.robot

```robotframework
*** Settings ***
Documentation     This example demonstrates how to use current library and test status in a listener.
Library      ListenerLibrary
#import another python file
Library   ../Functions/tracker.py

*** Keywords ***
Listener Keyword
    [Arguments]    ${projectName}    ${userName}    ${crqReference}    ${uniqueRunRef}
	
	Log To Console  This line is always executed, ${TEST NAME} : ${TEST STATUS}
	# https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#automatic-variables
    
	#send request to track testcase
	tracker.Track Test Case  ${TEST NAME}    ${TEST STATUS}    ${projectName}    ${userName}    ${crqReference}    ${uniqueRunRef}   

	IF  "${TEST STATUS}" == "FAIL"
	Log To Console  **********This line is only executed when the test failed.**********
		Another Keyword
	END

Another Keyword
	Log To Console  This keyword only gets called by the listner when the test failed.

Teardown Keyword
	Log To Console  The teardown is called after the Listener Keyword, ${TEST NAME}: ${TEST STATUS}
	IF  "${TEST STATUS}" == "FAIL"
		Yet Another Keyword
	END

Yet Another Keyword
	Log To Console  This keyword only gets called by the teardown when the test failed.
```
#### Create 'tracker.py' inside your Functions folder and copy the below code into it

```python:
Please contact mwangijustus12@gmail.com for the source code or be part of the development team.
```



