Hot answers tagged

8

The TDD cycle is more a development cycle for a developer, to quote James Shore, The Art of Agile, Test-Driven Development chapter: Programmers new to TDD are often surprised at how small each increment can be. Although you might think that only beginners need to work in small steps, my experience is the reverse: the more TDD experience you have, ...


7

The key difference is that the screenplay pattern organizes the Page Objects The Screen Play pattern tries to address the issues, challenges and solutions that you will eventually encounter and address when developing most UI acceptance test automation, including when you would introduce the Page Object pattern and then face challenges using it due to the ...


5

I agree that your tests will require ongoing maintenance (as does most test automation). There are tactics for organizing your Selenium tests so that maintenance is easier, but they depend upon how the user interface is written, whether the developers help maintain the tests, and the manner in which the user interface changes. In fact, the quicker the user ...


5

At the UK Selenium Conference, there was a presentation on the Screen Play pattern, see The Screenplay Pattern - a SOLID alternative to Page Objects | Antony Marcano We have a huge technology ecosystem (60+ apps) and base everything on the Page Object model. We tried the Screen Play pattern and learned many things about it and where it is more and less ...


5

Although the main purpose of BDD is to enhance conversation between people involved in a project is can be used to described any level of test. Besides UAT, one can describe an object behavior (unit test) using Given-When-Then: Given I create a Cache object created with the arguments "..." When "15" seconds passed Then the cache is empty The point of ...


5

@BeforeTest, @AfterTest annotations are not supported since Cucumber doesn't has the concept of test. It has features and you are executing the steps in Given, When & And, Then format. So in your case Cucumber only understands your steps not Tests. Use @BeforeFeature & @AfterFeature which was Cucumber understands the hooks. See the list of cucumber ...


4

Specflow and Fitnesse approach the process of testing in two different ways. The process of passing different inputs into your tests is very much a way of exploring the functionality of what the system can do. BDD however is all about defining scenarios that define exactly what the system should do. As a result, I would suggest the execution pattern for ...


4

From a pure technical design viewpoint, a single solution would most likely be better. This is a case where the real answer depends on what the impact is if you run your "Test" tests in production. For example, if you are testing Facebook and creating new test account from scratch and then modifying it, then you could probably run all your tests in every ...


4

Whenever possible I try to have the same solution for testing in my test environments as in my production environments. It isn't always possible, but when it is there are many benefits of this approach: You are sure the tests are the same, so all the time you have put into updating, maintaining and improving those tests for your test environment also gets ...


4

You certainly can. Both WebClient, or HttpRequest would work well as the 'glue' for this scenario. Note that I'd probably rephrase your Given/When/Then Statement as something like: Given the logon page at http://someurl/account/logon When I post with parameters username='test' and password='123' Then I am redirected to http://someurl/home


4

This looks fine. BDD feature files is meant to be at a level to give useful information to product folks. In each step you can call lower level steps if you want to give more specific information (or more reusable actions) For this one for example Given I am signed in It might just call within it // enter the username GivenIEnterInTheField(string ...


4

It depends on lots of factors and there will be tradeoffs: BDD does introduce few benefits, for specifics, please refer to this article on wikipeida. BDD on Wiki Based on my personal experiences, there are a few issues you need to address before converting to BDD. Those issues are: BDD framework uses a high level, English like syntax. You will need to ...


4

Disclaimer up front: I do not agree with some of what is quoted below. I believe that a decent POM-framework can lead to VERY readable and maintainable tests. Reading this page, the intent becomes clear. Per the source: Even though Page Objects reduce code duplication and encourage reuse across tests within a single project and a single test suite, the ...


4

Same reason why you would split large modules in your regular code base: maintainability & navigability. Over time as your step definitions grow you will have steps that are closely related to certain parts or functionalities of your system, but not related to other steps in the step definitions. Once the file becomes large enough it will become harder ...


4

I believe there is no support for multi-dimensional examples tables in Gherkin scenarios as you have described. Also keep in mind what BDD is largely for: being readable to the business. We developers have to be careful not to get too technical in the feature files ;) That being said, I can think of a couple ways to solve this problem. 1.Write either the ...


4

I think the pros of BDD are captured in a very good way by a user djojo in his answer - in this SO post - all credits to him I totally agree the communication is one of the biggest advantage however the benefits are for all the parties involved and the advantages for those are different. So briefly: For All: living documentation collaboration, early ...


4

This is not a complex scenario, instead, it is common in many applications. Every application in a given user journey, goes through different states and at any step application can get into an undesired state and test might be failed. So yes, it can be represented as an acceptance test/end to end test where on failing at any step, remaining steps will be ...


4

I personally divide the logic into three levels: feature file (Cucumber), step definition (Cucumber + Java), page objects (Selenium and Java). Cucumber separates business logic from the programming logic (1. and 2.) and the page object pattern separates test methods from the pages locators.


4

Katalon has an example project on github: https://github.com/katalon-studio-samples/katalon-bdd-cucumber-tests Although I find the directory structure hard to navigate the feature example does follow a pattern like: Feature file (feature code example) Steps that use test cases in pages (steps code example) Pages that implement actions (page action example) ...


3

If QA and DEV environments are equal (have the same dependencies installed, the same build, etc.), there is no much sense to run acceptance tests on both of them, since it will be just duplicated execution and additional overhead in terms of analysing test results on two environments instead of one. Acceptance tests are the tests which provide you ...


3

The insertion of Thread.Sleep() is typically indicative of a race condition in your test and your test is running out of sync with the thing is it testing. One suggestion may be to insert a polling loop to wait for the redirect, or an event to indicate the redirect has happened. See http://www.testingmentor.com/imtesty/?p=652 and read the comments for ...


3

Another thought to add to the well-written answers: In the question, the author mentions a developer's objection: adopting the Selenium tests to changes (like a changed button_id or something) would take too long. Since UI tests are brittle with respect to the underlying structure of the UI, UI automation success depends on successful collaboration ...


3

Cel, As always, it depends. If there's a requirement that the link contain a label then obviously the test needs to check that a label exists (whether automated or not). Here are some of the possible things I'd consider with this scenario: Is the code dynamically generated or static? For a static "once and done" page, the mark 1 human eyeball might be ...


3

I could be off my footing here (and if I am, please let me know!), but from a QA perspective, everything that TDD is for automated tests, BDD is for manual tests. Now some of these 'manual tests' may indeed be automated, but only insofar as they're pretending to be a user. They aren't like unit tests. Just because you have dedicated people doing the testing ...


3

In my experience, you can't sell new development processes. The only path I've found which works is to simply start doing it: Only develop with TDD from this point forward. You'll still deliver your code on time, but it'll be more maintainable and have far fewer bugs. You'll feel much less anxiety and be proud of your work. After a little time, management ...


3

I would recommend doing both approaches, for different purposes. Given / When / Then is good for testing communication. This format brings assurance that what you are testing is what the business owner / requirements writer intended. The bugs mainly caught by these tests, IME, are ones where the business owner intended X and the dev did Y. Often, these ...


3

I'd plan it this way: The specific tests that are written 'before the code' are unit tests that are written by developers just before they write the actual code. It should only take 5-20 minutes to write a simple test. The test is written, the code is written for it and then the test is changed or the next test is written and then more unit level code is ...


3

If developers also write unit tests, then what's the point of having special testers in our team and should we replace testers with developers? Unit testing is not the only kind of automated testing. Integration tests, performance tests, scalability tests, and fault tolerance tests are all examples of automated tests that are not unit tests and that a ...


3

The importance of any Behavior-driven development framework, methodology or tool is to communicate. Cucumber is primarily a tool to communicate requirements between the business people and the developer. Which can also function as automatable tests. Cucumbers Gherkin could also be used to create a DSL or predefined steps to let non technical testers also ...


3

BDD is suitable for all levels of testing, Gherkin not so much. Writing unit-tests with the overhead of Gherkin (e.g. English feature files, regular expressions and functions to execute the tests) is extra work, but work that does not have the value of conversation as only developers read them. Describing your tests from a behaviour stand-point is very good ...


Only top voted, non community-wiki answers of a minimum length are eligible