How does this compare to Boa.Constrictor? #357
Replies: 1 comment 2 replies
-
|
Well, firstly, welcome on your journey to writing better tests! Right now, CSF.Screenplay is undergoing a rewrite and is probably not ready for prime time/prod usage. v1 supports .NET Framework only and v2 is not quite ready to go to prod yet. There's also the usual "I can do better than that, now", which is typical for all devs, I guess. It's also not a full-time project for me; I don't get to work on it at my day job. BC is definitely a more mature implementation and if you want something for production today then I would hand-on-heart recommend that over CSF.Screenplay. Certainly, Boa Constrictor and CSF.Screenplay are both implementations of the Screenplay pattern. You're going to see a lot of architectural similarities, not because we've been reading one another's code (I was barely aware of BC and I doubt any of those devs have heard of me) but because we're building to the same conceptual standard. I've had a skim of BC and - at a glance - things I notice which differ are... Use of Dependency Injection frameworksBoa Constrictor does not make use of any dependency injection frameworks. Depending upon your tastes as a developer, this could be considered either good or bad. It's good because "what you see is what you get" and it's blindingly obvious where every object/value/parameter comes from just from reading code. On the downside, I've found it tends to lead to more boilerplate code, written manually. I also found that it increases the resistance to adding cross-cutting concerns like reporting or saving assets. I was somewhat 'inspired' when I saw Reqnroll (formerly SpecFlow) which does have a DI container built in. At that point I stopped believing that "DI containers in test code is forbidden" and added it to my Screenplay impl. I'm even less worried about DI in tests, since Microsoft created the baseline Microsoft.Extensions.DependencyInjection.Abstractions package. That's really changed the ecosystem in that so many libraries, by default, assume that you're going to integrate them via an ReportingFrom the quick skim I have seen on BC, it doesn't do reporting in the way that CSF.Screenplay does. At the end of any Screenplay, CSF Screenplay will (unless you disable it) write a JSON-formatted report of every performance in that Screenplay. CSF.Screenplay also includes a commandline app which can convert that JSON report into a human-readable HTML document. I'm in the process of improving that functionality right now. That said, I do see the infrastructure at https://github.com/q2ebanking/boa-constrictor/tree/main/Boa.Constrictor.Screenplay/Logging/Loggers and that's pretty good, especially given there's no DI framework. CSF.Screenplay's reporting is far more structured, probably because it has the benefit of a DI container at its core. BC writes "begin doing" and "finishes doing" messages into its logs, so it's clear where the scope of a performable (I think Direct test framework integrationI see some minimal XUnit integration in BC. I've written a Reqnroll integration, which also works for legacy SpecFlow, for now. It's in Reqnroll's native plugin format. I've done the same for NUnit. In theory, from what I know of XUnit, it shouldn't be too difficult to write one for XUnit either, although I'm not an XUnit expert, so it's not high on my own priority list. BC is very neutral to test frameworks. Thus the consuming dev is responsible for the scaffold which sets up a test. Compare https://q2ebanking.github.io/boa-constrictor/tutorial/part-2-web-ui-testing/#10-refactoring-the-project (a relatively minimal sample NUnit test) with https://csf-dev.github.io/CSF.Screenplay/docs/gettingStarted/nunit3/index.html#writing-test-methods, which is a conceptually similar example. CSF.Screenplay can totally be used standalone without any integration library (say you were integrating it into your own app, for something besides tests) and in that sense BC can be too. Cast & Stage supportI don't see BC implementing the Cast or the Stage anywhere. I don't think they're strictly part of the Screenplay pattern, so that's not wrong of it. The Cast & Stage (and Personas, for that matter) are great tools for managing performances which include multiple actors, or dealing with well-known actors with pre-configured sets of abilities. I think that BC would support a test (or scenario, or performance, depending on your terminology) which uses multiple actors because they're independent and (with no DI framework) they would consume no shared resources. Each would need to be constructed and scaffolded by hand. CSF.Screenplay uses the cast (or stage) for this, and (if you're using personas too) you write a single line like I found when using Reqnroll, which is based on bindings and step definitions, the Stage was far more useful than the Cast. That's because with the stage you can have a Reqnroll step definition bound to a Gherkin regex like ExtensibilityI've had a look through BC's core code and I'm impressed with their architecture: it's not based on lots of abstract base classes (one of my mistakes in v1). Everything is very clean and based on single responsibility interfaces, which is the same as CSF.Screenplay v2. So, if you wanted to write new tasks (compositions of other tasks) then it would be really easy to do so. Playwright supportBC already has it, I plan on adding it to CSF.Screenplay at some point, but it's not started yet. RestSharp supportBC supports RestSharp directly. CSF. Screenplay has https://csf-dev.github.io/CSF.Screenplay/docs/extensions/webApis/index.html which is a micro-framework for framing API requests in a manner that follows the Screenplay patterns. They're conceptually the same thing but obviously their syntax will differ, and I'd bet my lunch money that RestSharp will be far more full-featured. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm just starting to learn about Screenplay, BDD, Reqnroll, etc., and would greatly appreciate some guidance. What questions should I be asking?
https://github.com/q2ebanking/boa-constrictor/
Beta Was this translation helpful? Give feedback.
All reactions