Profiling your test-suites in your pom.xml allows total control on what test-suite to run.
Automated Acceptance Testing
In my last blog Using .csv files with Serenity we started by setting up a Maven project with Serenity as our testing framework.
- We configured our pom.xml, created our packages and classes.
- We then ran our tests and generated our first report.
- I hope since then you added multiple new tests and now have a new “problem”.
Running the tests takes time and you actually just want to generate a report on the last feature ex: Customer Search.
Follow this tutorial as we show you how to add this new feature to your testing repertoire.
How do I do this?
Let’s first have a quick look at the benefits of Profiling in your POMs
- If your profiles are specified inside the POM, you have more options.
- Profiles are specified inline, and therefore have a better chance of preserving portability
- You can add more information to them without the risk of that information being unavailable to other users.
The trade-off, of course, is that you can only modify that project and it’s sub-modules.
So where do we start?
Open your pom file and find this section:
Then replace it with
pom.xml
(that is, during the integration-test phase of the Maven build) rather than as unit tests.
It allows the build not to immediately fail when a test fails, but to continue until it has generated the Serenity aggregate reports.–>
Now we are ready to add elements to our properties section in the pom.xml
pom.xml
All good so far, but remember that plugin we removed and replaced?
What do we do with it? – It is time to create our profiles and put it back.
Start by creating the profile section
Now assign an Id to the profile
And we are now ready to put back that plugin that we removed.
<-- your diffident test-suite profiles will be created each under its own profile -->
Almost there.
Look at the
We need to now specify what test-suite we want to run with this profile.
So replace **/requirements/**/*.java with ${completeTestSuite}.
Before we go into how we will run this test let’s do the same with our searchCustomerSuite and create its own
Ready to run your test-suite?
Right click on the project and choose run configurations
Give it a logical name for the test-suite that you what to run.
In the Goals: clean install
And in the Profiles: “add the Id of that profile that you what to run”.
Why should we write automated acceptance tests?
A product owner walks in to a bar and says to the barman:
“Given I am thirsty and I am standing at a bar and there is a beer mat in front of me, When I ask the bar man for a pint of his best bitter Then the barman will pour a pint of his best bitter and place it on the beer mat in front of me”.
Why use Serenity BDD?
- Serenity BDD helps you write cleaner maintainable automated acceptance and regression tests quicker.
- It produces illustrated, narrative reports that document and describe what your application does and how it will work
- Serenity will tell you if your tests have been passed and if your requirements have been tested
- One key advantage is that you do not have to invest time to build and maintain an automation framework.
- Behaviour Driven Development is an approach where the team explores and builds a shared understanding of the applications requirements.