Skip to end of banner
Go to start of banner

Integrate TestRail with Karate setup

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Overview

Here are described the steps to connect TestRail with karate integration tests.

Steps 

  • Copy all related files from package org.folio.testrail of acquisitions to your project path
  • Create jUnit test file and extend from AbstractTestRailIntegrationTest like FinanceApiTest

    FinanceApiTest Example
    public class FinanceApiTest extends AbstractTestRailIntegrationTest {
    
    	public FinanceApiTest() {
    		super(new TestRailIntegrationHelper(FINANCE_CONFIGURATION));
    	}
    
    	@Test
    	void budgetExpenseClasses() {
    		runFeatureTest("budget-expense-classes");
    	}
    }
  • Add constructor with your own configuration see FinanceApiTest

  • Add test method that will run your feature file like budget-expense-classes via runFeatureTest method that located in order to FINANCE_CONFIGURATION see budgetExpenseClasses

  • Add your suite Configuration see Integrate TestRail with Karate setup section. For FinanceApiTest we use FINANCE_CONFIGURATION
  • Add two setup mehtods into your test file like financeApiTestBeforeAll (to setup tenant, users and setup data for module run) and financeApiTestAfterAll (to destroy tenant and all related data for module run)


    Note: finance-junit.feature and destroy-data.feature should contain logic to setup and destory data for tenant.
Setup and Destroy methods
@BeforeAll
public void financeApiTestBeforeAll() {
	runFeature("classpath:domain/mod-finance/finance-junit.feature");
}

@AfterAll
public void financeApiTestAfterAll() {
	runFeature("classpath:common/destroy-data.feature");
}

Configuration

For interaction with TestRail we need to Configure our test in constructor with your own configuration. Example:

Configuration example
public FinanceApiTest() { super(new TestRailIntegrationHelper(FINANCE_CONFIGURATION)); }

Finance Configuration use next data for configuration

  • FINANCE_TEST_BASE_PATH - "classpath:domain/mod-finance/features/"
  • FINANCE_TEST_SUITE_NAME - "mod-finance"
  • TEST_SUITE_ID - "111"
  • FINANCE_TEST_SECTION_ID - 1386

To get suite id and section id you can use postman collection Test Rail.postman_collection.json (Note: Update Authorization with basic Auth and your credentials)

Run tests with TestRail integration

Run examples
mvn test -Dtest=FinanceApiTest -pl acquisitions -Dtestrail_url=https://foliotest.testrail.io -Dtestrail_userId=<your_user_id> -Dtestrail_pwd=<password> -Dtestrail_projectId=<test_rail_project_id>

Where you populate your out values like <your_user_id>, <password>, <test_rail_project_id> and instead of "-pl acquisitions" argument you should use your own project.



  • No labels