Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflows #46

Merged
merged 10 commits into from
Oct 31, 2015
Merged

Workflows #46

merged 10 commits into from
Oct 31, 2015

Conversation

FantasticFiasco
Copy link
Collaborator

Introduction

This PR introduces the concept of workflows to CUITe. A workflow should be thought of as an extra layer or maintainability on top of the already existing Page Objects.

Workflows Explained

Lets say you've got your page objects, but find yourself doing a lot of repetitive work in the arrange phase of numerous tests. The repetitive work could for instance be logging into the application, where the actual test doesn't start until the user is logged in. Or perhaps the repetitive work is registering a new user, i.e. navigating though a series of wizard pages.

Either way, those steps will be repeated in every test and are not very maintainable since a change in the login or wizard process causes all tests to fail, but that would be expected. The sad part in this situation is that the developer needs to change the arrange part of all those tests in order to get them to pass.

This is where the concept of workflows come into play. The workflow encapsulates the repetitive work in a class that all tests use in the arrange phase. A change in the login or wizard process doesn't force the developer to update all tests, only the workflow class, thus maintainability of the tests has increased.

Code Example

This is an example that demonstrates the workflow implementation of a navigation through a series of wizard pages.

public class WizardWorkflow : Workflow<NamePage, FinishedPage>
{
    public WizardWorkflow(NamePage start)
        : base(start)
    {
    }

    public override FinishedPage StepThrough()
    {
        // Enter name
        Start.FirstName = "Some first name";
        Start.Surname = "Some surname";

        // Click next
        AddressPage addressPage = Start.ClickNext();

        // Enter address
        addressPage.Address = "Some address";
        addressPage.City = "Some city";
        addressPage.PostalCode = "Some postal code";
        addressPage.State = "Some state";

        // Click next
        return addressPage.ClickNext();
    }
}

This code demonstrates how the workflow implementation is used in a test.

var workflow = new WizardWorkflow(namePage);
FinishedPage finishedPage = workflow.StepThrough();

@FantasticFiasco
Copy link
Collaborator Author

Can we trigger a new run? I don't think I've touched code executed by the test that fails, and I hate the term but it works on my computer.

@icnocop
Copy link
Owner

icnocop commented Oct 31, 2015

I triggered another build and it succeeded. 👍

Thank you.

If you want, I can create a GitHub team/organization and then I can grant you access to invoke the build on AppVeyor in case this happens again.

Thank you.

@FantasticFiasco
Copy link
Collaborator Author

Sure if you wan't, but don't create it for my sake, only create it if you feel it helps yourself by not having to trigger builds on my pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants