SpecFlow: To run feature file with multiple scenarios several times with different parameters - specflow

I'm wondering why we can run Scenario several times with different parameters but cannot run whole feature file with different parameters.
Our feature files consists of many scenarios and feature file corresponds to Test Case, but when we need to run the same feature file, but with different parameter(s) then whole feature file has to be duplicated... Is there any possibility to parametrize whole feature file?

I don't know whether you are aware of the Scenario Outline.
The Scenario Outline keyword can be used to run the same Scenario
multiple times, with different combinations of values
Copying and pasting scenarios to use different values quickly becomes tedious and repetitive as shown in the below example:
Scenario: Successful Login with Valid Credentials
Given User is at the Home Page
And Navigate to LogIn Page
When User enter "testuser_1" and "Test#123"
And Click on the LogIn button
Then Successful LogIN message should display
Scenario: Successful Login with Valid Credentials
Given User is at the Home Page
And Navigate to LogIn Page
When User enter "testuser_2" and "Test#153"
And Click on the LogIn button
Then Successful LogIN message should display
We can collapse these two similar scenarios into a Scenario Outline.
Scenario outlines allow us to more concisely express these scenarios through the use of a template with < > - delimited parameters:
Scenario Outline: Successful Login with Valid Credentials
Given User is at the Home Page
And Navigate to LogIn Page
When User enter <username> and <password>
And Click on the LogIn button
Then Successful LogIN message should display
Examples:
| username | password |
| testuser_1 | Test#123 |
| testuser_2 | Test#153 |
A Scenario Outline must contain an Examples (or Scenarios) section. Its steps are interpreted as a template which is never directly run. Instead, the Scenario Outline is run once for each row in the Examples section beneath it (not counting the first header row).
The steps can use <> delimited parameters that reference headers in the examples table. Cucumber will replace these parameters with values from the table before it tries to match the step against a step definition.

Related

Power Automate | How to scrape and extract an email from a webpage

I am trying to scrape several email addresses from a directory. What I did first was scrape and save all the links of each individual business directory page. So each link looks as follows:
https://www.directory.com/business-name/industry/
With the busines name being the name of the business and industry being the industry of that specific business.
No I created an automation on power automate which behaves as follows:
The issue I am facing is with the "Extract data from web page" step. For some reason when I am manually selecting the email address from the web, so the system knows which element it needs to extract, it is selecting the email address specific to that page, so in the selection it looks as follows:
Now what I want to do is to extract either the Href or the Text of that attribute.
However when I make my selection and go run the automation the system is getting stuck and producing the following output since when it tries to find the Text or Href element on the site it is specifically searching for "test123#gmail.com" and not copying the text/Href of that element. It is constantly getting stuck on that step and prompting the following error:
Failed to extract data (web page error while extracting data).

Login/Signup page

I have to create login signup form in flutter with following modes:
Login fields: Email/Password
Signup fields: Name/Email/Password
Forgot password: Email
Is it good to have all this in single file and logically rendering hiding fields with different modes. Let's say I am on login I have name/email I click on create account than mode changes to Register instead of redirecting to new page, and additional field >> Name field is visible.
So is it good to maintain all these login register and forgot password in single page and logically maintaining it?
This actually depends on your approach and your requirements. But most of the blogs authored by Flutter developers online, they prefer to have a separate login and register pages. Personally, I also prefer separate files for maintainability when your code gets bigger and more complex. You can try to check some samples online just like this one.

How to distinguish Jenkins credentials

Using Jenkins to create a freestyle project, when setting the repositories it asks to specify from Credentials, just like the following image shows.
But how do people distinguish these credentials from all stars?
Its normally distinct using combination of Username & Description provided during creation of credential
In the dropdown it will appear as follows
If access through items menu, click the small hidden triangle beside job name (you need to hover near the name to show the hidden triangle) will show Credentials action
Or access the left menu Credential option after clicking the job name
Will lead to the same page. These credentials page is different from System Config -> Credentials is the credentials only for that job. Normally the ID will help you to distinguish the credentials, however, sometimes people (like me) didn't know it works this way. Then Jenkins would generate a random meaningless string to identify them, which can't help normal human to separate them with certainty.
After clicking the link in Domain column, the description will be shown there, and you can also update it from that page.

Intercepting springsecurity behavior in grails

I have gone a good distance in spring-security-core-2.0-RC5 (SSC) with Grails 2.5, but still a lot to cover. I am wondering how to achieve two tasks. So far and after integrating SSC in my project, I built a dispatcher that takes care of routing users to different landing pages according to their roles. This link shows how I do it. What I am wondering how others are doing is these two tasks:
How to customize the landing page. For example, instead of the typical "Please Login", I need to say "Please login using your provided username and password" plus an image or something. This means I have to override (or overwrite) the existing login page. What is the best way to do this?
The more important. When a user is logged in, I route them to different pages based on their roles, or even log them out if their account is !enabled. However, what I can't do is be in control when the user has no credentials at all. What I would like to do is instead of displaying the typical "Sorry, we were not able to find a user with that username and password.", I would like to intercept the behaviour and perform some actions before redirecting users to the logout/login page (actions like a web service request for example). How can I achieve this please - to be able to make certain tasks on behalf of non-authorized users?
For Task1 (custom login page) you Just have to place a auth.gsp page in 'app/views/login/auth.gsp'

test a multi-step registration system using SpecFlow

I'm using SpecFlow whilst writing an asp.net mvc 3 website. The registration system in the site consists of two views.
the first view asks for basic information e.g eMail, password and location, whilst the second view asks the user for the type of account (developer or standard user) and then name, address etc.
In SpecFlow terms then I have one feature Registration and two succeeding senarios, registering as a developer and as a standard user.
if this was one view I could test this using something like:
given I am on the registration page
when I enter Data1
and I enter data2
and I click the next button
then the registration should be successfull
as I have two views is it best practice to chain several given, when, and, then statements or is there a better way of doing something like this?
Any help apreciated.
Sean
I would avoid mentioning the different pages within the feature file, and handle that at the step definition level instead, e.g.
Given I am registering
When I fill in my basic information
And I choose to register as a developer
Then I should be registered as a developer
Given I am registering
When I fill in my basic information
And I choose to register as a standard user
Then I should be registered as a standard user

Resources