Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

What is the correct way to use the POP with Xamarin.UITest?

$
0
0

Hi, I'm developing a Xamarin.Forms application and I want to use Xamarin.UITest with the POP (Page Object Pattern) to test the UI. I read the documentation and had the chance to see a keynote about this tool and this pattern, but I still don't understand which is the correct way to conditionally test the UI. For example, in my test project, I have a Pages folder and a Tests folder. In the first one, I put the pages' representations, while in the second one I put the tests I made about these representations. I want to test the entry input when the user tries to log in. So far, I wrote this method inside the TestProject/Pages/LoginPage.cs file:

public LoginPage EnterCredentialsAndLogin(string email, string password) {
    if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) {
        ...
    }
    else {
        ...
    }
}

and I test it using this code in the TestProject/Tests/LoginPageTests.cs file:

[Test]
public void TestLoginWithDifferentCredentials() {
    new LoginPage().EnterCredentialsAndLogin(null, null);
    new LoginPage().EnterCredentialsAndLogin("", null);
    new LoginPage().EnterCredentialsAndLogin("email", null);
    new LoginPage().EnterCredentialsAndLogin("email", "");
    new LoginPage().EnterCredentialsAndLogin(null, "");
    new LoginPage().EnterCredentialsAndLogin(null, "password");
    new LoginPage().EnterCredentialsAndLogin("", "password");
}

Is this an appropriate way to use the POP? Should I use other approaches?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>