Skip to main content

Posts

Showing posts from 2020

How to deal with external data formats?

This blog post is in response to Challenge 7 of the #GivenWhenThenWithStyle blog post series with Gojko Adzic  You can see what the challenge is here: https://specflow.org/blog/how-to-deal-with-external-data-formats-givenwhenthenwithstyle/ Having the message format in the test would  (as mentioned in the challenge) look terrible and would be difficult to understand.  If I was to rewrite this scenario I would do something like the following: 1) Write a test that tests the validity of the payment message. So something like Scenario : payment message validity Given an account EE382200221020145685 has a balance When the system receives a payment message Then the payment message is valid.  I would store the actual payment message in another file as not to clutter the scenario file and this message would be passed into the test in the When line. The Then part of the test could cover various areas, such as: - All the correct tags are present  - The xml is valid 2) I wo...

How to deal with pauses and timeouts in specflow

So this blogpost is in response to the weekly Specflow blog posts and challenges that have been written by Gojko Adzic. This weeks challenge was how would you rewrite or rephrase the below scenario: Given a user registers successfully When the account page reloads And the user waits 2 seconds Then the account page displays "Account approved" My initial though was something like this: Given a user registers successfully  When the account page reloads   Then the account page is displayed within a satisfactory time period     And the account page displays "Account Approved" Now the problem with this scenario is what defines a satisfactory time? You could add it as a comment or in a scenario outline but over time the time a user waits could change and if this is updated in the code behind but the scenario outline or comments are not, then what the test does and what is described do not match - this would potentially cause issues in the future. My next ide...