user7636208
user7636208

Reputation:

Using Calabash with something else than Ruby

Is it possible to use the Xamarin Calabash with a programming language something other than Ruby, for example C#?

I want to automate tests for mobile devices.

Upvotes: 1

Views: 144

Answers (2)

Sven-Michael Stübe
Sven-Michael Stübe

Reputation: 14750

If you want Ghekin as a language to describe your tests, you can use Specflow on top of Xamarin.UITest.

http://specflow.org/getting-started/

You can see an example here: https://github.com/smstuebe/xamarin-testing-demo/tree/master/Todo.Tests.UI.Specflow

A test would then look like this.

Feature: Todo
    In order to remember what I have to do
    As a user
    I want to maintain tasks in a list

Scenario: Add a task
    When I enter "Added Task" 
    And I press add
    Then the task "Added Task" should be added to the list

The step definitions then use Xamarin.UITest

[Binding]
public sealed class TodoPageSteps
{
    private TodoPage _page;
    private IApp _app;

    public TodoPageSteps()
    {
        _page = new TodoPage();
        _app = FeatureContext.Current.Get<IApp>("App");
    }

    [When(@"I enter ""(.*)""")]
    public void WhenIEnter(string task)
    {
        _app.Tap(_page.AddEntry);
        _app.EnterText(_page.AddEntry, task);
    }

    [When(@"I press add")]
    public void WhenIPressAdd()
    {
        _app.Tap(_page.AddButton);
    }

    [Then(@"the task ""(.*)"" should be added to the list")]
    public void ThenTheTaskShouldBeAddedToTheList(string task)
    {
        _app.WaitForElement(_page.LabelOfTask(task));
    }
}

Upvotes: 3

SushiHangover
SushiHangover

Reputation: 74094

Xamarin.UITest is C#-based Calabash

Xamarin.UITest, an Automated UI Acceptance Testing framework based on Calabash that allows programmers to write and execute tests in C# and NUnit that validate the functionality of iOS and Android Apps.

Ref: https://developer.xamarin.com/guides/testcloud/uitest/

Upvotes: 3

Related Questions