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. IoT Testing

Test Automation & CI/CD integration

PreviousLoad TestingNextSimulation API

Last updated 2 years ago

Was this helpful?

Testing is a crucial part of any development process. However, it is often overlooked. Be it because the developer overlooked it or they simply forgot about it. This may save time at the moment, but it can lead to headaches down the line.

Thus it makes sense to automate the testing of new builds and have this automated testing as a part of your CI/CD pipeline. In this guide, we will show you how easy it is to automate the testing of new builds using the Simulation APIs on IoTIFY.

Before we can run a test, first we need to write the test which models the behaviour of the device or usage. For this, simply navigate to IoTIFY and create a new test. If you are not familiar with tests on IoTIFY, you can follow the guide linked below.

Now that we have our test ready, we can use the Simulation APIs to start and monitor the results of this test. However, before we can start using the APIs, we need to generate an API key which we will use to authorise these API calls.

Navigate to IoTIFY and click on the settings in the lower left corner. This will take you to your account settings.

Here, click on API Keys in the left menu. This will open the API keys page, here you can see your already provisioned API keys and also create new ones. To create a new API key, click on the Create New button in the top-right corner of the screen. A new API Key will be created and displayed on the page.

Now you are ready to use the APIs. You can go to the page linked below to get more details about the APIs. Here we will use simple curl commands to call these APIs.

Run the following curl command below to start a test via the API. Here replace $KEY with the API key, $JOBNAMEwith the any name for the job (this has to be unique) and $TESTID with the test you want to run. You can also change the runsettings parameters as required with the clients and iterations.

curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "key:$KEY" -H "domain:nsim.iotify.io" -d '{"jobName":"$JOBNAME","runSettings":{"interval":1000,"iteration":150,"clients":10,"totalClients":5,"clientIdOffset":0}}' nsim.iotify.io/api/test/$TESTID/run

The command will return a success along with a job ID which we will use to check the status of that job.

Run the following curl command to get the current status of a running job. Here replace $KEY with the API key, $WORKSPACE with the workspace ID and $JOB with the job ID.

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "key:$KEY" -H "domain:nsim.iotify.io" nsim.iotify.io/api/jobs/$WORKSPACE/$JOB

The command will return an object with the results and status of the job.

So now you can use the Simulation APIs from IoTIFY to automate your testing and make your CI/CD pipeline more robust.

Simulation API
Understanding Tests