0

Thanks in advance for the help.

My question pertains to best practices inside a SpecFlow feature file?

Question:

Is using a wait command inside of the feature file considered bad practice.

Example:

And i click on the username
And wait 5 seconds
And i input new value into last name

The wait command forces a 5 second wait. I am doing this to make sure the page is loaded to prevent "element not found" errors or other errors. Basically to make sure I have a clean page to manipulate.

Would a better practice be to use a wait inside of the Step file itself?

//using Fluent Automation
I.WaitUntil(() => ());
//or
I.Wait(); //timespan

My reasoning for not using the Fluent Automation wait is:

By utilizing the Fluent Automation method you are dependent on the default timeout in the Settings object. The default timeout in some cases may not be long enough or may be to long. Seems very verbose to me to continually change/reset the Settings object with the only benefit being to remove wait commands from the feature file.

So what is really the best practice?

Thanks,

-n

Zach Davis
  • 65
  • 5
  • Next version of FluentAutomation adds a per method override of the Settings WaitUntil timeout value. – stirno Aug 22 '13 at 20:06

1 Answers1

3

I think the best practice is to keep the feature file for your scenarios, and free of the implementation details.

Since we are following a BDD process (http://dannorth.net/introducing-bdd) then the feature file is the output of that conversation between you and the process expert, and the scenario represents the steps that you are going to take to prove that your functionality works for that example. You could hope that those steps define the business process and could be performed by any system, not just the one we might be developing now. Ideally this logic captures our intent and can be reused on any future systems that might replace the current one.

So I just don't see you saying that you need to wait

....

Although you might want to say

When the page has loaded

and that maps quite nicely onto the fluent automation.

AlSki
  • 6,868
  • 1
  • 26
  • 39