Thank-you Myron for your prompt reply and for your book! Yes I understand the cost and benefits of the different strategy, but you must understand that I primarily am doing this automation project for myself. I cannot really apply true unit test strategy for many reasons.
I will try later to post a simple glance of what I wrote to facilitate the exposure of my struggles and in hope that it benefits others too. Thanks!! JFF On Tuesday, February 20, 2018 at 7:29:34 PM UTC-5, Myron Marston wrote: > > Hi Jeff, > > So my only chance to test them both is either run them dependently from >> one another or to create data specific for each test (which I cannot always >> afford, which is why I do more of what I call integration where I make >> weird scenarios accumulating this sort of dependency tests). > > > Having each test be independent is really important. The fact that it's > too expensive to create data specific for each tests suggests that your > testing strategy is poorly suited to provide the benefits you're looking. > End-to-end tests like the ones you're working on are generally the most > expensive tests on every project and I favor having very few of them, > pushing most tests down to the unit test level. That generally requires > that the tests are written in conjunction with the production code in order > to influence its design, so that may not be feasible in your case. > > I don't think we're going to be able to give you satisfactory answers (as > we'd have to dig into your project in more detail to do that, and I don't > have the time for that). I think that some books that help you think about > the costs and benefits of different approaches to testing could help you, > though. If you're looking for an RSpec-specific book, I'd recommend > *Effective > Testing with RSpec 3 > <https://pragprog.com/book/rspec3/effective-testing-with-rspec-3>, *which > was published about 6 months ago. > > Good luck! > Myron > > > > On Tue, Feb 20, 2018 at 2:09 PM, Jeff Fagot <[email protected] > <javascript:>> wrote: > >> Hello, >> >> I am posting here because I am using RSpec, even if this question is >> probably broader than the framework I am using... >> >> *A little background*: >> Basically I am a manual tester of web applications who is trying to make >> his way toward automation using RSpec with WATIR gem. >> I feel like BDD is the natural path coming from manual testing. I must >> confess that I had initially started using Cucumber but after being advised >> to avoid that "overhead" and "simply" use RSpec (which is compatible with >> Cucumber), so I did but not without questioning myself... >> Also I am barely starting with Page-Object and still have nothing to >> manage my data... (I have only wrote a couple of simple scenarios so far) >> >> *Here is my problem*: >> I usually tend to create integration/End-to-End tests (Always dependent >> on data state). >> So when I go to write my _specs, they always starts by a specific state, >> then I try to DRY them up as follow: >> 1. Create sort of "Unit Test" Scenarios >> 2. Make my Unitary Scenarios functions of variable, so I can re-use the >> same for all(as much as possible) cases >> >> Now I am wondering what to do? or maybe how to structure myself? >> >> *QUESTIONS:* >> 1. Should I turn what I call Unitary Scenario/Test into actual >> Function/Module? To then be used into true integration test specifications? >> OR >> 2. Should I have Unit Tests and Integration Tests _specs either into >> different files or "tagged" >> 3. Maybe a mix of both? >> >> How to mediate to 'data state' related issues?? >> For example, if I am writing 2 tests : 1 for ADD, 1 For DELETE an >> element. Each test needs to be in the opposite state of the other. So my >> only chance to test them both is either run them dependently from one >> another or to create data specific for each test (which I cannot always >> afford, which is why I do more of what I call integration where I make >> weird scenarios accumulating this sort of dependency tests). >> >> I would appreciate any insights. Also if someone could share some project >> examples that would enlighten me, it would be much appreciated. >> >> Thanks for sharing your experience! >> Jeff >> >> -- >> You received this message because you are subscribed to the Google Groups >> "rspec" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] <javascript:> >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rspec/cc503083-5058-4287-916a-0d39659f05ae%40googlegroups.com >> >> <https://groups.google.com/d/msgid/rspec/cc503083-5058-4287-916a-0d39659f05ae%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/8fab36f2-6255-4afc-b02f-975885604473%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
