LogoLogo
HomeSign UpGithub
  • Home
  • Release Notes
  • Getting Started
    • Create your first Test
    • Create Run Settings
    • Analyze the results
      • Job Summary
      • Logs
      • State
      • Payload
    • Look deeper with Metrics
  • Concepts
    • Workspaces
      • Role Based Access Control (RBAC)
      • Invitation Management
      • GitHub Integration
      • Deletion of Workspaces
      • System Status
    • Understanding Tests
      • Stages Management
        • Init Stage
        • Running Stage(s)
        • Finished State
      • Generating Messages
        • Scripting Environment
        • State Object
      • Response Handler
      • Preview Tests
      • Exporting/Importing Tests
        • Import OpenAPI JSON/YAML
      • Locking/Unlocking a test
    • Stateful Simulation
      • Mapping the IoT device lifecycle
    • Protocol Settings
      • MQTT
      • HTTP
      • Using other protocols
    • Run Settings
      • Network Simulation
      • Execution Strategies
      • Client Distribution
    • Scenarios
    • Glob Storage
    • Metrics
    • Mailbox
    • Licensing and Limits
    • Deployment Models
  • Additional Helpers
    • External Libraries
    • Inbuilt Libraries
    • IoTIFY Helper Functions
      • Job Functions
      • Messaging Functions
      • Glob Functions
      • Metrics Functions
      • Mailbox Functions
      • Data Generation Functions
  • platform integrations
    • AWS IoT Connector
  • Guides
    • Smart City
    • Smart Home
    • Load Testing Kafka
  • IoT Testing
    • Overview
      • Feed offline sensor data from Google Sheets to your IoT platform
    • Functional Testing
      • Basic functional test
      • Geofencing Validation
    • Performance Testing
      • MQTT end to end latency Measurement
    • Security Testing
    • Load Testing
    • Test Automation & CI/CD integration
  • API
    • Simulation API
    • Glob APIs
    • Metrics API
  • Glossary
  • Create Account
  • TEMP
    • Getting Started
      • Beginner
      • Developer
      • Tester
    • Walkthrough
    • Protocol Settings
      • CoAP
      • Raw (TCP/UDP/TLS/DTLS)
      • LWM2M
      • NONE
    • Under the hood
    • Google Sheets API
    • Azure IoT
    • Losant IoT
      • Losant Connector
      • Parking Space Management
      • Waste Management
      • Connected Truck
      • Delivery Van
    • Google Cloud IoT Core
    • IBM Cloud
      • Simple Messaging
      • IBM Bluemix: Monitoring Energy Consumption
    • Dweet.io
    • JMeter and why it fails at IoT
Powered by GitBook
On this page

Was this helpful?

  1. Concepts
  2. Understanding Tests
  3. Stages Management

Running Stage(s)

The majority of the device logic is written in the running state(s). These stages must return a payload to be sent to the server.

PreviousInit StageNextFinished State

Last updated 2 years ago

Was this helpful?

The core of your device logic can be divided into different parts through its lifecycle. We can use multiple running stages to partition the device simulation into logical segments.

For Example, if we are trying to simulate a smart lock, we could have a booting stage that simulates how the device behaves when being switched on, then we could have an online stage that defines how the device behaves under normal working conditions and finally we could have an offline stage which simulates how the device would behave without a network condition and so on.

Partitioning the device logic into multiple such stages makes it easier for others to understand the device logic and also help while troubleshooting any issues that may arise while running a functional test for the device. There is no limit to the number of such stages that can be created. Let's see how to work with these different stages.

To add a new stage to the Device Model, move your mouse over the line between the stages where you want to add the new stage, a plus button will appear. On clicking this plus button, a new stage will be created. A new stage can be created anywhere between the Init and the Finished stages, but not outside them.

To rename any of the stages, click on their names, a text field will appear and you can rename the stages.

To delete any stage, move your mouse to the icon above the stage you want to delete, a cross icon will appear. On clicking the cross icon, the stage will be deleted.

To transition to another stage from a given stage use the next() function. If the next() function takes the name of any stage as the parameter. If no parameter is supplied to the next() function it will transition to the next stage on the timeline.

{
    let serial = glob.get('serial_' + client());
    if (!serial)
    {
        serial = chance.guid();
        glob.set('serial_' + client(), serial);
    }
    state.serial = serial;  
  
    next() //Transitions to the next stage on the timeline
    //Or
    next("Other_Stage") //Transitions to the given stage
}