On May 6, 10:00 am, Andrew Premdas <
aprem...@gmail.com> wrote:
>But he need to look at the application to see this, reviewing the feature
>after the functionality is implemented is not sufficient.
In this case, he is not reviewing the feature, the feature is being
run against the application as a full stack test using Lettuce +
Sellenium Webdriver. Sellenium is doing the 'looking at' the
application. You can watch it visit the stats website for different
channel group owners and see it do some sanity checks on what is
appearing in the browser.
One of the great things about Cucumber (and its ports to other
languages) is that you can use it at different levels of abstraction
and at different tiers of the stack.
> wrote. I don't do any of those any more. One of the beauties of Cucumber is
> that there are always different ways to express yourself
Indeed there are, so making a sweeping statement like 'any use of a
table in a feature is a 'smell' misses this point.
> The idea that concrete examples in the feature show more conclusivly that
> the system works is a fallacy. The nature of any Cucumber feature whatever
> its language is that it can be green and the business value it says its
> delivering may not be satisfactory or even implemented at all.
Again, this feature is testing the full stack from the top down,
testing the application as it appears in the browser. It is being
tested against inputs to the system based on the same set of test
data. We are exercising the full stack. This gives us some
confidence that the feature has been implemented.
> You cannot
> review the functionality of an application by reading the language of a
> passing cucumber feature. The language of the feature has no relationship
> to how the system is tested or what data is used to test it.
Why not? If you're using it to drive Selenium to test the application
in the browser then it has everything to do with how the system is
tested and what data is used to test it.
> you can use
> representative data without putting it in the feature;
So where would you put it if not in the feature?
> But he need to look at the application to see this, reviewing the feature
> after the functionality is implemented is not sufficient.
I'm not suggesting he do that. Yes he has to look at the application
but this is going to be at best ad hoc and being manual will be labour
intensive and error prone. With an automated test, expressed in
Gherkin, implemented by Lettuce driving Selenium we can ensure we are
frequently and automatically testing the functionality before
presenting it to the product owner.
> You can test edge cases by using unit tests, or using a scenario for each
> particular edge case. A table obfuscates what edge cases you are testing by
>
> 1. Testing more than one case in one expression
> 2. Not having a description for each edge case
So if you see my reply to Matt's suggestion above you'll see I've come
to the conclusion that what I do need is indeed separate scenarios,
one for each edge case. However, each scenario will still contain a
table of expected data as it is that data that best describes the
characteristics of the scenario / edge case.
Unit Tests are essential but they are at a smaller level of
granularity as they are testing individual functions and methods. You
need them in addition to the tests at the feature level not instead
of.
> What are you saying? That you have to parse the feature to get data for the
> database or that you have generate the feature from data in your database?
> Either approach is very unusual for using Cucumber features.
The former. To test the full stack, top to bottom, we need a set of
known inputs and a set of expected outputs. The later will be a
function of the former.
> > I'm sorry you feel that way, my reply was aimed to be helpful and show
> alternative ways of expressing your problem.
I'd love to see this alternative way of expressing the problem. In
your original post you said "All the detail of dates, viewing figures
etc. is irrelevant to this particular scenario, and should be covered
in other scenario/features." Where/what are these? Just saying:
> Given there are channel stats for BBC
> When I view channel stats for BBC
> Then I should see the channel stats for BBC channels
Is so abstract as to tell me nothing.
Where are all the specifics of the behaviour we expect to see so we
can test whether it is there or not?
> 1. You should try and deal with one simple problem in each scenario, and
> use the cumulative effect of running many scenarios (and unit tests) to
> test complex behaviour e.g. the details of dates, viewing figures etc.
So again, I'm happy with having multiple scenarios but I still don't
see why their containing tables is a 'smell'
> 2. Part of the reason you are struggling is that you are dealing with too
> many problems at once, moving some of these elsewhere is a good thing.
Thanks but I'm not struggling! I totally get that you solve big
problems by breaking them down into smaller problems and that is being
done and the individual functions and methods that make up the code
base are covered by unit tests.
What those tests don't cover is what the cumulative purpose of those
units of functionality is, what they should net out at, what the
overall behaviour of the system should be.
That is what these tests are intended to cover.
Chris