Skip to content

Files

Latest commit

 

History

History
174 lines (132 loc) · 6.25 KB

hyperexecute-background-services.md

File metadata and controls

174 lines (132 loc) · 6.25 KB
id title hide_title sidebar_label description keywords url site_name slug
hyperexecute-background-services
Background Services in HyperExecute
true
Background Services
This documentation will help you
hyperexecute background services
LambdaTest
hyperexecute-background-services/
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "LambdaTest", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Background Services", "item": "https://www.lambdatest.com/support/docs/hyperexecute-background-services/" }] }) }} ></script>

Background Services

Background Services is a feature of HyperExecute which is generally used to run the long running Application Servers. You can trigger the background services by using either the background or backgroundDirectives property in the HyperExecute YAML file.

This feature is useful for the following cases:

  • Web Applications or Servers.
  • Running databases.
  • Providing file sharing or streaming services.
  • Running messaging or chat applications.
  • Providing APIs for other applications to use.

Enable Background Service


There are two methods to enable the Background Service from the HyperExecute YAML file:

1. Using backgroundDirectives

backgroundDirectives:
  shell: bash
  commands:
    - name: YOUR_SERVICE_NAME
      command: npx static-server
    - name: Database
      command: mysql-server

The shell property defines the terminal it should use to run the background service.

The command property specifies the command to be executed in the background.

The name property specifies the name of your Background Service.

2. Using background

background:
  - npx static-server
  - mysql-server

Background Service Logs


To check the background service logs, follow the below mentioned steps:

Step 1: After executing your job, go to the HyperExecute Dashboard to check the status of the job.

Step 2: Click on the Background Service button. <img loading="lazy" src={require('../assets/images/hyperexecute/features/background-service/Step2.png').default} alt="automation-dashboard" width="1920" height="868" className="doc_img"/>

Step 3: Click on the desired background service you have triggered to check its logs. <img loading="lazy" src={require('../assets/images/hyperexecute/features/background-service/Step3.png').default} alt="automation-dashboard" width="1920" height="868" className="doc_img"/>

Sample YAML File


---
version: 0.1
globalTimeout: 100
testSuiteTimeout: 90
testSuiteStep: 90
retryOnFailure: false
runson: ${matrix.os}
cypress: true
maxRetries: 0
parallelism: 1
concurrency: 2
autosplit: true

pre:
  - npm install

cacheKey: '{{ checksum "package.json" }}'
cacheDirectories:
  - node_modules

matrix:
   os: [win]
   browser: ["chrome-103.0","chrome-104.0","chrome-105.0"]

#highlight-next-line
background:
#highlight-next-line
  - npx static-server
  #highlight-next-line
  - mysql-server

testDiscovery:
  mode: dynamic
  type: raw
  command: ls cypress/integration | sed -n 1,'10p'

testRunnerCommand: npx cypress run  --spec ./cypress/integration/$test --browser=${matrix.browser} --headed --config video=false

cypressOps:
 Build: "Hyperexecute Cypress Sample Build"
 Tags: ["Hyperexecute","Cypress", "Windows", "Hybrid", "V9"]
 BuildTags: ["Hyperexecute-Cypress"]

jobLabel: [cypress-v9, hybrid]

Frequently Asked Questions

Is the service intended to operate within the same Virtual Machine or externally? Yes, the service will run within the same Virtual Machine.
What is the service's commencement and cessation schedule?

It initiates the execution of all background commands concurrently with the pre-stage and continues until the completion of post-run command execution.

Will the Database, for example, run on a single VM and be accessible for testing on other VMs? No, the background service can only be accessed from within the same VM.
Will the identical set of background services be initiated within every VM?

Yes, if the same set of background services, such as npm run server, are establishing HTTP servers on the same port, it is likely that one of the commands will encounter a binding issue and fail.