https://github.com/riezebosch/consoleum
Selenium for Console Apps
https://github.com/riezebosch/consoleum
bdd console-application csharp dotnet selenium specflow uitest
Last synced: 11 months ago
JSON representation
Selenium for Console Apps
- Host: GitHub
- URL: https://github.com/riezebosch/consoleum
- Owner: riezebosch
- Created: 2017-08-30T11:36:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-13T05:06:35.000Z (over 3 years ago)
- Last Synced: 2025-07-22T08:52:17.408Z (11 months ago)
- Topics: bdd, console-application, csharp, dotnet, selenium, specflow, uitest
- Language: C#
- Homepage:
- Size: 1.33 MB
- Stars: 7
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/riezebosch/consoleum?branch=master)
[](https://www.nuget.org/packages/Consoleum/)
[](https://www.nuget.org/packages/Consoleum.PageObjects/)
## Consoleum
A [Selenium](http://www.seleniumhq.org/)-like solution for automating console applications.

## Origin
This project is a spin-off from a [SpecFlow](http://specflow.org/) exercise. Don't get bogged down with [automation-id's](https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/use-the-automationid-property) or [css selectors](https://www.w3schools.com/cssref/css_selectors.asp) but write UI tests against a good-ol' console application while still using practices like [Page Object Design Pattern](http://www.seleniumhq.org/docs/06_test_design_considerations.jsp#page-object-design-pattern).
## How
Use the `IConsoleDriver` and `ConsoleDriver` to start the process and the provided `ICaptureOutput` and [`IKeyboardSimulator`](https://github.com/michaelnoonan/inputsimulator) to interact with the console.
## Page Objects
You can use this package without or use plain POCO's, but you might want to use the `Page` base class from the [Consoleum.PageObjects](https://www.nuget.org/packages/Consoleum.PageObjects/) package instead.
```cs
public void SomeTestMethod()
{
using (var driver = new ConsoleDriver("some-app.exe"))
{
driver.Start();
Page
.StartWith(driver)
.SomeActionOnCurrentPage()
.SomeNavigationAction()
.ShouldBeLoggedInByNow();
}
}
```
```cs
class Main : Page
{
public override bool IsOpen => ExistsInOutput("pattern-matching-output-on-this-page");
public Main SomeActionOnCurrentPage()
{
Driver
.Keyboard
.KeyPress(...)
.Sleep(200);
return this;
}
public Another SomeNavigationAction()
{
Driver
.Keyboard
.KeyPress(...)
.Sleep(200);
return NavigateTo();
}
}
```
Look at the [tests](Consoleum.PageObjects.Tests) for more inspiration on reusing the driver over multiple tests and assertions using [Shouldly](https://www.nuget.org/packages/Shouldly/).
## Why not xplat?
This package relies heavily on Windows Desktop functions for starting the process, capturing the output on the clipboard using keystrokes and native Win32 invocations to grab that data from the clipboard.
You do the math why it can't be xplat.