Expect for .NET version 2.0.1 released

I’ve recently released version 2.0.1 of Expect for .NET library. In this post you will find list of changes, what unexpected behavior was fixed and next release announcement.

Changelog

Expect for .NET version 2.0.1 repairs some bugs. It's illustrated by 'Repair Bug by Mark Rain (CC BY 2.0)' picture
Repair Bug by Mark Rain (CC BY 2.0)

The only change is fix of matching mechanism used to find expected string in output. Previous versions used regular expressions matching. Because there was not a word about it in documentation, blog posts or tutorials the matching mechanism produced unexpected results when there were used special characters like ‘*’, ‘?’, ‘$’, ‘.’, etc. I decided that this is bug and fixed it in this version.

Fixed unexpected behavior

Previous versions used regular expressions matching so some characters had special meanings. Below is table presenting differences:

Expected string Received output version 2.0.0
result
version 2.0.1
result
Comment
“user@host:~$” “user@host:~$ “. not match match $ in regular expressions means end of string
@”user@host:~\$” “user@host:~$ “. match not match \$ in regular expressions means $
“.*” “some text” match not match .* in regular expressions means any string

So as presented in table some expected strings gave really unexpected results.

What about regular expressions?

Some of you may ask this question now. If you used this hidden and unplanned feature till now, please don’t upgrade to version 2.0.1 and… wait for version 2.1.0.

Yes. In version 2.1.0 will be added dedicated functionality to support regular expressions. Code is already written, tests are passing. I have to review code and release it. So you can expect it soon. If you can’t wait, you can look at ‘regex’ branch here: https://github.com/wiwanek/Expect.NET/tree/regex

How to get version 2.0.1?

It’s avaialable via NuGet: https://www.nuget.org/packages/Expect.NET/

and on GitHub: https://github.com/wiwanek/Expect.NET/releases/tag/v2.0.1

 

What features would you like to see after regular expression support? Share your thought in comments.

2 responses to “Expect for .NET version 2.0.1 released”

  1. Bogus Exception Avatar
    Bogus Exception

    I am so happy you have done this. I have a question, though, about SSH.
    I see there are 3 constructors for Session, and all 3 take a file’s name on the fs. For the sake of security, I’d rather not call a 3rd party app, but use an internal SSH client (Renci SSH.NET, on CodePlex)…
    Can I now, or have you plans for, a simple API that will allow an ssh library that can log into a host/server with your project’s ability to send/expect commands?
    My goal would be to use the SSH.NET app to login (or Expect.NET do all that, too?), handing over it’s own send/expect communication facility over to Expect.NET.
    Your thoughts?

    Thanks again!

    pat
    🙂

    Like

    1. Thanks for comment.

      SSH support is on my short list. I have already created working prototype. You can find it here: https://github.com/wiwanek/Expect.NET/tree/devel/EsxpectSshNet

      You can build it yourself or just use SshSpawnable class in your project. This version uses SSH.NET library as you suggested. I hope it will fit your needs.

      In near future I’m going to release it as separate nuget package. I think that it will be next delivery after 2.1.0.

      Let me know, how it works for you.

      Regards,
      Wojtek

      Like

Leave a comment

Design a site like this with WordPress.com
Get started