I wrote my test case code in C# like the following:
[Test]
public void SignInTest() {
// By using "WelcomeScreen", implies WelcomeScreen exist and a screen match executed.
// If WelcomeScreen doesn't exist, it is null and cause a NullReferenceException.
WelcomeScreen.SignIn.Click();
// Type strings to fields
SignInScreen.Email.TypeString("[email protected]");
SignInScreen.Password.TypeString("password");
SignInScreen.Next.Click(10); // Wait 10 seconds to sign in process.
// If multiple accounts exist, select the account with text "Test Account"
if (SelectAccountScreen != null) {
// Use array access from element string or index
SelectAccountScreen.Account["Test Account"].Click(10);
}
// If HomeScreen is detected in 60 seconds, case pass.
Assert.IsTrue(WaitUntilShows<HomeScreenClass>(60));
}
It cost me some effort to make it like this, but the cases are running pretty well.
I understand people do use different languages and of course having different styles. In ideal, do you want test case code to be the same as “manual” test case or anything else?