Giter Club home page Giter Club logo

katalon-testlink-event-listener's People

Contributors

skechav avatar

Watchers

 avatar  avatar

katalon-testlink-event-listener's Issues

Not working

Hello! I'm just trying to set up code in katalon and running it but isnt doing any update in testlink.
The test is having the same status "Not Run".
Do you know why?

imagen

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import internal.GlobalVariable as GlobalVariable

import com.kms.katalon.core.annotation.BeforeTestCase
import com.kms.katalon.core.annotation.BeforeTestSuite
import com.kms.katalon.core.annotation.AfterTestCase
import com.kms.katalon.core.annotation.AfterTestSuite
import com.kms.katalon.core.context.TestCaseContext
import com.kms.katalon.core.context.TestSuiteContext

// Import Testlin API related jars
import testlink.api.java.client.TestLinkAPIClient
import testlink.api.java.client.TestLinkAPIException
import testlink.api.java.client.TestLinkAPIResults

import java.util.concurrent.atomic.AtomicInteger

WebUI.openBrowser('')

WebUI.navigateToUrl('https://katalon-demo-cura.herokuapp.com/')

WebUI.click(findTestObject('Object Repository/Page_CURA Healthcare Service/a_Make Appointment'))

WebUI.closeBrowser()

class UpdateResults
{
/**
* Executes before every test case starts.
* @param testCaseContext related information of the executed test case.
*/
AtomicInteger passedTC = new AtomicInteger(0);
AtomicInteger failedTC = new AtomicInteger(0);

public static String DEVKEY="ae04f917c60875c7e21ac03f68abf00f";

public static String URL="http://localhost/testlink-1.9.19/testlink-1.9.19/lib/api/xmlrpc/v1/xmlrpc.php";


public static void reportResult(String TestProject,String TestPlan,String Testcase,String Build,String Notes,String Result) throws TestLinkAPIException
{
	TestLinkAPIClient api = new TestLinkAPIClient(DEVKEY, URL);
	api.reportTestCaseResult(TestProject, TestPlan, Testcase, Build, Notes, Result);
}

@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext)
{
	/*
		..You can put code to do stuff BEFORE test case execution here e.g :
		
	
				println testCaseContext.getTestCaseId();
				println testCaseContext.getTestCaseVariables();
				println "testCaseContext.getTextCaseId()=${testCaseContext.getTestCaseId()}";
	*/
	
}

/**
 * Executes after every test case ends.
 * @param testCaseContext related information of the executed test case.
 */
@AfterTestCase
def sampleAfterTestCase(TestCaseContext testCaseContext)
{
		
	
	//String testCase="Check connection information";
	
	UpdateResults	testlinkUpdate 	= new UpdateResults();
	
	String testProject				="KatalonAutomation";
	String testPlan					="AutomationTestPlan";
	/* Get the TestCase Name from Katalon . This means that a testcase
	 * should have same name in both Katalon and TestLink */
	String testCase					= "Check connection information"; // remove the "Test Cases/" part of testCaseContext.getTestCaseId()
	String build					="Sprint1Build";
	String notes					=null;
	String result					=null;
		
	if (testCaseContext.getTestCaseStatus() == 'PASSED')
	{
			
		result = TestLinkAPIResults.TEST_PASSED;
		notes="Executed and updated successfully from Katalon test automation framework ";
		testlinkUpdate.reportResult(testProject, testPlan, testCase, build, notes, result);
		passedTC.getAndIncrement();
	}
	else if (testCaseContext.getTestCaseStatus() == 'FAILED')
	{
			
		result=TestLinkAPIResults.TEST_FAILED;
		notes="Execution failed.This test has been executed on Katalon automation framework.";
		testlinkUpdate.reportResult(testProject, testPlan, testCase, build, notes, result);
		failedTC.getAndIncrement();
	}

		println testCaseContext.getTestCaseId();
		println testCaseContext.getTestCaseStatus();
	
}

/**
 * Executes before every test suite starts.
 * @param testSuiteContext: related information of the executed test suite.
 */
@BeforeTestSuite
def sampleBeforeTestSuite(TestSuiteContext testSuiteContext)
{
	println testSuiteContext.getTestSuiteId();

	
	
}

/**
 * Executes after every test suite ends.
 * @param testSuiteContext: related information of the executed test suite.
 */
@AfterTestSuite
def sampleAfterTestSuite(TestSuiteContext testSuiteContext)
{
	println "Number of passed TCs is: " + passedTC.get();
	println "Number of failed TCs is: " + failedTC.get();
	
	
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.