Giter VIP home page Giter VIP logo

consoleum's Introduction

AppVeyor NuGet Consoleum NuGet Consoleum.PageObjects

Consoleum

A Selenium-like solution for automating console applications.

action

Origin

This project is a spin-off from a SpecFlow exercise. Don't get bogged down with automation-id's or css selectors but write UI tests against a good-ol' console application while still using practices like Page Object Design Pattern.

How

Use the IConsoleDriver and ConsoleDriver to start the process and the provided ICaptureOutput and IKeyboardSimulator 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 package instead.

public void SomeTestMethod()
{
    using (var driver = new ConsoleDriver("some-app.exe"))
    {
        driver.Start();

        Page
            .StartWith<Main>(driver)
            .SomeActionOnCurrentPage()
            .SomeNavigationAction()
            .ShouldBeLoggedInByNow();
    }
}
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<Another>();
    }
}

Look at the tests for more inspiration on reusing the driver over multiple tests and assertions using 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.

consoleum's People

Contributors

304notmodified avatar dependabot-preview[bot] avatar riezebosch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

consoleum's Issues

Dependabot couldn't find the branch updates

Dependabot was set up to create pull requests against the branch updates, but couldn't find it.

If the branch has been permanently deleted you can update Dependabot's target branch from your dashboard.

You can mention @dependabot in the comments below to contact the Dependabot team.

Output.Capture() throws exception and opens console settings

Hi,

I'm using Consoleum 0.0.62 with a .NET 4.8 console application. OS ist Win10.

This outputs some text and then does a ReadLine():
image

In my test I call the process, then Start, Sleep and try to capture the console output:
image

When capturing, an exception raises:
image

Additionally the console property window is open and the char "s" is insterted into the font size dropdown. A error window is open as the OK button was pressed with that invalid fontsize value.
image

What I am doing wrong? Entering keys works perfect, but I need to know the current console output.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.