.NET tutorials: AutoIt with Step

This tutorial demonstrates how to utilize the AutoIt C# binding to automate interactions with Windows applications.

Illustration for .NET tutorials: AutoIt with Step

This tutorial demonstrates how to utilize the AutoIt C# binding to automate interactions with Windows applications.

This example can be found in our samples repository, available on github.

Visual Studio Settings

  1. Configure a new C# project as described in the .NET plugin page.
  • Choose the proper .NET version, .NET Framework 5.0
  • Install the StepApiFunction, StepApiKeyword, and StepApiReporting nuget packages
  1. Install the AutoItX.DotNET and the NUint packages.

Your dependencies should look like the image below:

Code

You will now create your first AutoIt keyword using the following code:

  public class Keywords : AbstractKeyword
{
    [Keyword(name = "Open Notepad, edit and close")]
    public void EditInNotepad()
    {
        int pid = 0;
        if ((pid = AutoItX.Run("notepad.exe", ".")) == 0)
        {
            output.setError("Error stating Notepad");
            return;
        }
        if (AutoItX.WinWaitActive("Untitled", timeout: 10) != 1)
        {
            output.setError("Error waiting for the Notepad window");
            return;
        }
        AutoItX.Send("I'm in notepad");
        if (AutoItX.WinKill("*Untitled") != 1)
        {
            output.setError("Error closing the Notepad window");
            return;
        }
        if (AutoItX.WinWaitClose("*Untitled", timeout: 10) != 1)
        {
            output.setError("Error waiting for the Notepad window to close");
            return;
        }
        if (AutoItX.ProcessWaitClose(pid.ToString(), timeout: 10) != 1)
        {
            output.setError("Error waiting for the Notepad process to close");
            return;
        }
    }
}
  
  • The function EditInNotepad contains the AutoIt specific code.
  • This example starts and interacts with a notepad.
  • The keyword class extends StepAPI.AbstractKeyword.
  • This class provides the objects interacting with your Plans (input, output, session, properties, and the onError function).

Unit Test

If you have added the ScriptDev package to your project, you can copy this example to test your keyword in local:

  public class AutoItKeywordsTests
{
    ScriptRunner runner;
    [SetUp]
    public void Init()
    {
        runner = new ScriptRunner(typeof(Keywords));
    }
    [TearDown]
    public void tearDown()
    {
        runner.close();
    }
    [TestCase()]
    public void AutoItTest()
    {
        var output = runner.run("Open Notepad, edit and close", @"{}");
        Assert.Null(output.error);
    }
}
  

Keyword Configuration

  1. You will need to prepare a ZIP file containing the dependencies below before running your example on a .NET agent.

This ZIP file contains the nunit.frameworkdll (due to the unit test added) and the .pdb of the keyword. This provides the line number of your code in case of error.

  1. Next, upload the dll and the dependencies to the controller:

Summary: This tutorial demonstrates how to utilize the AutoIt C# binding to automate interactions with Windows applications.

Illustration for Using Step with Grafana
Using Step with Grafana

This article demonstrates how to connect Grafana to data generated by Step.

Illustration for Setting up system monitoring with a Step agent
Setting up system monitoring with a Step agent

This article demonstrates how to set up distributed system monitoring using Keyword executions, and analyze the results as measurements.

Illustration for NET tutorials: Microsoft Office automation with Step
NET tutorials: Microsoft Office automation with Step

This tutorial demonstrates how to automate interaction with Microsoft Office applications using the Office Interop Assembly.

Illustration for JUnit Plan Runner
JUnit Plan Runner

This article provides documentation for how to integrate JUnit tests into Step.

Illustration for How to monitor services availability and performance
How to monitor services availability and performance

This tutorial demonstrates how Step can be used to monitor services, availability and performance metrics.

Illustration for Android Testing using Step and Appium
Android Testing using Step and Appium

This article demonstrates the automation of mobile applications on Android using the Appium framework.

Illustration for Browser-based automation with Step and Selenium
Browser-based automation with Step and Selenium

This article defines three Keywords which will be used in browser-based automation scenarios, using Step and Selenium, as general drivers.

Illustration for Load Testing with Cypress
Load Testing with Cypress - advanced

This tutorial shows you how to efficiently set up a browser-based load test using existing Cypress tests in the Step automation platform.

Illustration for Adding and Configuring New Agents
Adding and Configuring New Agents

In this short tutorial, we show how to quickly implement a simple browser-based load test based on Cypress scripts in Step.

Illustration for Load Testing with Playwright
Load Testing with Playwright - advanced

This tutorial shows you how to efficiently set up a browser-based load test using existing Playwright tests in the Step automation platform.

Illustration for Basic Keyword Development
Basic Keyword Development

This article explains Keywords in Step and demonstrates how to create simple ones.

Illustration for Designing functional tests
Designing functional tests

This tutorial demonstrates the design, execution, and analysis of functional tests using the web interface of Step.

Illustration for Robotic Process Automation (RPA) with Selenium
Robotic Process Automation (RPA) with Selenium

This tutorial will demonstrate how to use Step and Selenium to automate various browser tasks.

Illustration for Robotic Process Automation (RPA) with Cypress
Robotic Process Automation (RPA) with Cypress

This tutorial demonstrates how to use Step and Cypress to automate various browser tasks.

Illustration for Synthetic Monitoring with Selenium
Synthetic Monitoring with Selenium

This tutorial demonstrates how Selenium automation tests can be turned into full synthetic monitoring using Step.

Illustration for Load Testing with Cypress
Load Testing with Cypress

In this tutorial, we'll show you how to easily set up and run a browser-based load test with Step's wizard, using your existing Cypress tests, on the Step automation platform.

Illustration for Load Testing with Selenium
Load Testing with Selenium

This tutorial shows you how to efficiently set up a browser-based load test using existing Selenium tests in the Step automation platform.

Illustration for Synthetic Monitoring with Playwright
Synthetic Monitoring with Playwright

This tutorial demonstrates how Playwright automation tests can be turned into full synthetic monitoring using Step.

Illustration for Synthetic Monitoring with Cypress
Synthetic Monitoring with Cypress

This tutorial demonstrates how Cypress automation tests can be turned into full synthetic monitoring using Step.

Illustration for Robotic Process Automation (RPA) with Playwright
Robotic Process Automation (RPA) with Playwright

This tutorial will demonstrate how to use Step and Playwright to automate various browser tasks.

Illustration for Load Testing with Playwright
Load Testing with Playwright

In this tutorial, we'll show you how to easily set up and run a browser-based load test with Step's wizard, using your existing Playwright tests, on the Step automation platform.

Illustration grafana devops tutorial
Continuous load testing with K6

Quickly integrate K6 based load-tests in your DevOps workflow

Illustration for playwright synthetic monitoring in a devops workflow
DevOps Synthetic Monitoring with Playwright - Advanced

This tutorial demonstrates how Playwright tests can be reused for synthetic monitoring of a productive environment in a DevOps workflow

Illustration for playwright synthetic monitoring in a devops workflow
DevOps Synthetic Monitoring with Playwright

This tutorial demonstrates how Playwright tests can be reused for synthetic monitoring of a productive environment in a DevOps workflow

Illustration for okhttp devops
Protocol-based load testing with okhttp

In this tutorial you'll learn how to quickly set up a protocol-based load test with okhttp

Illustration for playwright devops
Continuous end-to-end testing

Learn how to set up continuous end-to-end testing across several applications based on Playwright tests in your DevOps pipeline using Step

Illustration for playwright devops
Continuous load testing with Playwright

Learn how to quickly set up continuous browser-based load testing using Playwright tests in your DevOps pipeline

Want to hear our latest updates about automation?

Don't miss out on our regular blog posts - Subscribe now!

Image of a laptop device to incentivize users to subscribe