.NET tutorials: AutoIt with Step
This tutorial demonstrates how to utilize the AutoIt C# binding to automate interactions with Windows applications.
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
- 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
- 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
- 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.
- 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.
This article demonstrates how to connect Grafana to data generated by Step.
This article demonstrates how to set up distributed system monitoring using Keyword executions, and analyze the results as measurements.
This tutorial demonstrates how to automate interaction with Microsoft Office applications using the Office Interop Assembly.
This article provides documentation for how to integrate JUnit tests into Step.
This tutorial demonstrates how Step can be used to monitor services, availability and performance metrics.
This article demonstrates the automation of mobile applications on Android using the Appium framework.
This article defines three Keywords which will be used in browser-based automation scenarios, using Step and Selenium, as general drivers.
This tutorial shows you how to efficiently set up a browser-based load test using existing Cypress tests in the Step automation platform.
In this short tutorial, we show how to quickly implement a simple browser-based load test based on Cypress scripts in Step.
This tutorial shows you how to set up a browser-based load test using existing Playwright tests in the Step UI.
This article explains Keywords in Step and demonstrates how to create simple ones.
This tutorial demonstrates the design, execution, and analysis of functional tests using the web interface of Step.
This tutorial will demonstrate how to use Step and Selenium to automate various browser tasks.
This tutorial demonstrates how to use Step and Cypress to automate various browser tasks.
This tutorial demonstrates how Selenium automation tests can be turned into full synthetic monitoring using Step.
In this tutorial, you'll learn how to reuse existing Cypress tests to quickly set up and run a browser-based load test using the automation as code approach.
In this tutorial, you'll learn how to reuse existing tests written with Serenity BDD and Cucumber for load testing.
This tutorial demonstrates how Cypress automation tests can be turned into full synthetic monitoring using the automation as code approach.
In this tutorial, you'll learn how to reuse existing Cypress tests to quickly set up and run a browser-based load test using the Step UI.
This tutorial demonstrates how to leverage existing Selenium tests to set up and execute browser-based load tests, following a full code-based approach.
This tutorial demonstrates how to set up a browser-based load test in the Step UI using existing Selenium tests.
This tutorial demonstrates how Playwright automation tests can be turned into full synthetic monitoring using Step.
This tutorial demonstrates how Cypress automation tests can be turned into full synthetic monitoring using the Step UI.
This tutorial will demonstrate how to use Step and Playwright to automate various browser tasks.
In this tutorial, you'll learn how to reuse existing Playwright tests written in Java to quickly set up and run a browser-based load test using the automation as code approach.
Quickly integrate K6 based load-tests in your DevOps workflow
This tutorial demonstrates how Playwright tests can be reused for synthetic monitoring of a productive environment in a DevOps workflow
This tutorial demonstrates how Playwright tests can be reused for synthetic monitoring of a productive environment in a DevOps workflow
In this tutorial you'll learn how to quickly set up a protocol-based load test with okhttp
Learn how to set up continuous end-to-end testing across several applications based on Playwright tests in your DevOps pipeline using Step
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!