Can "Excel Add-In for Coded UI Testing" help when reading test scenario data from Excel worksheet - excel

This requires a detailed explanation.
Imagine that I have an Excel spreadsheet with test cases in one worksheet
and I may have expected (validation) messages in another (in addition to expected messages in the first worksheet).
There is also some linking between the values of fields in one to the second worksheets.
See: Welcome, <First Name> <Last Name> as an example.
You can see in the "Expected Results" field in "Test cases" worksheet the value of the field is:
"The user is taken to My Account page and following welcome message is displayed:
"&Messages!$B$1244&", where First name is Dave and Last Name is Brown."
so "&Messages!$B$1244&", denotes field B1244 in worksheet "Messages"
Now the question.
If I am given all test cases like the example below for an ecommerce web site, how can I use Coded UI Testing based on this input? Can I automate Excel, use the steps in test case worksheet and combine that with Coded UI recording of data input and verification.
I believe I would need to do manual coding, partially using recorded input steps and verifications from Coded UI recorder and possibly using manual programming for verification.
I would like to hear if others have done something similar.
I would like to incorporate this into Specflow BDD, by writing feature/user story and these test cases will be scenarios.
Any success, thoughts on using Excel test automation as data driven testing.
Thanks
Rad
Test cases worksheet named "Test cases":
=====================
Test Case Name Test Case Objective
frontstore.01-3 Register a shopper from order
confirmation page with valid inputs
# Step Data Expected Results
------------------------------------------------------------------------------------------------
1 Launch the test storefront http://testserver.com/index Welcome page is loaded.
2 Click Sign In link Sign In page is loaded.
3 Click Register under New Customer Register page is loaded.
4 Enter valid inputs and click Submit "Logon ID = TestUser
Firstname = John
Lastname = Clark
... (other fields) Registration Successful.
The user is taken to My Account page
and following welcome message is displayed:
Welcome, <First Name> <Last Name>, where First name is
David and Last Name is Brown."
Validation Messages worksheet named "Messages":
=====================
#Text used in MyAccountPages
---------------------------------------------------------------------------
MA_WELCOME Welcome, <First Name> <Last Name>
After reading a bit about Coded UI testing:
It can certainly be done, but data/sentences like:
“Launch the test storefront”
“Click Sign In link”
“Registration Successful.
The user is taken to My Account page
and following welcome message is displayed:
Welcome, , where First name is
David and Last Name is Brown."
contain both actions and data so I need to drill down into parts of the sentence to
translate it to actions and binding to parameters.
If I understand well data binding can only be used to bind column values to some parameters.
So I need some way to automatically recognize the meaning of these sentences and use some binding
from parts of it.
So if I have a sentence:
“Launch the test storefront” that would be translated to:
CurrentBrowser.Navigate(Helper.TranslateTargetUrlFrom(“test storefront”))
where “test storefront” might resolve to http://testserver.com/index storefront home
page and I can ignore Data column for URL
or I can capture Launch keyword to mean CurrentBrowser.Navigate(ColumnValue(Data)) and ignore “test storefront” part of the sentence.
“Click Sign In link” could be translated to CurrentBrowser.FindLink(“Sign In”).Click(),
so it this case I will need to know that Sign In is
the text of the link, again I need to extract “Sign In” to mean the text of a link.
I see this as pretty manual style of CodedUI where I could do small recording for some actions and rely on manual extractions of terms from
given sentences.
I would like to know how can I semantically write better test cases to allow automation. I would probably need some kind of free form
test case parser that would recognize the semantic meaning of some words like: click, navigate, launch, enter, click under etc and translate this into
code by re-using existing helper methods and recorded actions and do some manual binding, but not with the whole data value in the column, but
an extracted value.
Any idea of this kind of automation?

I think yould could do this by data binding the input parameters and just reading Excel as a datasource, you are going to need to use CodedUI for that not MTM + Fast Forward

Related

Microsoft Flow/Power Automate - Selecting current item from a Sharepoint list

I'm conducting a lucky draw to encourage colleagues to post on Yammer, and I want to do the following:
Colleague posts message on Yammer
Pull a Lucky Draw Participation code from SharePoint List
Send colleague an automated message with this Lucky Draw Participation code.
There are only 100 codes, and for obvious reasons, are single-use and cannot be easily reverse-engineered. So I have crafted them in advance by hand.
My question now is... what are the functions I can use can to set up a Flow, that plucks a code from a Sharepoint list (never re-uses it as well), and that this flow would cease after 100 times (i.e. all codes used up)
Thanks!
(Following is the screenshot where I was stuck at...)
Currently stuck here in MS Flow
One example:
First, add a flag to your SharePoint list that indicates the code (row) has been used, e.g., Yes/No field named "Used."
Use Get Items action that uses the ODATA filter query "Used ne 1" without quotes. That will only pull codes that have not been marked as used.
Set Top Count to 1. Only the next unused item will be retrieved.
Use Update Item action to mark that code as Used.
Use the output of the Get Items action however you see fit.
Note: You can also add a condition to send you a message that all codes have been used if the length of the output for the Get Items action is 0.

How to implement 'if' in Gherkin

I am trying to convert Selenium test to Gherkin. Is there way to implement if statements in Gherkin?
Example : assume the code is written in the below format. I am just writing description as below. Please understand the part after double slash is the actual Selenium code:
// launch the application
// login to application
// navigate to page
String str;
if(str== "XYZ")
{
// verify title
}
//verify text field 1
//verify test field 2
//verify select box
For this I am trying to write code in Gherkin as follows
Given user launches the application
When user login with valid credentials
and navigate to required page
When String str is "XYZ"
Then verify title
And verify text field 1
And verify test field 2
And verify select box
but this code is incorrect because if the str is not equal to "XYZ" we want that title should not be verified but other verification like text field1,2 and select box should be verified.
You don't implement if in Gherkin.
Gherkin is about communication and those you want to communicate with, non coders, don't know what an if statement is. They don't care either.
The solution? Two scenarios to cover both cases.
Ideally, this level of detail would not be in your Gherkin scenario. The best approach is describe business use cases, not low level details. This is what Gherkin is designed for: communicating with non-technical stakeholders so that you can work out if you are building the right thing in the first place. Here is what I would write:
Given the user is logged in
And the user is on the required page
When they enter data that requires the optional fields to be validated
And they enter invalid data in the optional fields
Then the form shows an error on the optional fields
The low level details don't matter (that the string is specifically "XYZ" or that it is the title field is not important), so these should be hidden in the step definition and/or unit tests.
In order to continue to check the other fields, you can just add another step after this:
When they enter invalid data in all of the other fields
Then each other field has an error message attached to it.
Again, there is no need to specify the actual fields, or separate them into their own steps. The idea is to express the high level business value of the scenario, i.e. that the form is validated when it should be.
The advantage to keeping things high level is that when the form changes (as it eventually probably will), then this scenario can remain untouched. Which is correct as the business case is the same: it should validate when it's supposed to. All the changes will be in the step definitions. This means that there is no reason to have another discussion with your stakeholders about whether your scenarios are still testing the right thing.
You can write the scenario, somewhat like this:
Given the user launches the application
When user login with valid credentials
And navigates to required page
Then he should see the page datails
Inside the Then step you manage all the logic.
Then(/^he should see the page details$/) do
if condition
...
else
...
end
end
Gherkin is not a programming language to use if or else conditions. It is a part of BDD framework, that is implemented, to make the stakeholders and other non technical resources understand what the test process is about. Hence, it is always recommended, you keep the gherkin as simple and as generic as possible.
Strictly speaking you should create an alternative statement along the lines of:
Given user launches the application
When user login with valid credentials
and navigate to required page
When String str is NOT "XYZ"

what is parameterisation concept in HP ALM ?

i need help on HP ALM Parameterization concept. what is use of Parameterization concept in HP ALM. how can we implement this concept ? give me any examples
In terms of manual test cases, parametrization comes very handy when you have scenarios that have pretty much same steps or at least same structure.
When you create a new test case, you will have a button to parameters on the header menu, you can list all the parameters you think you would need. For a simple login test on multiple pages ( home page, account page ) with similar layout, you will have username, password and url as parameters. It also allows you to give default value. You can add more parameter as you write steps in the step description window.
once you have the complete test case created, go to test configuration tab of the test case and add test configuration by clicking plus button. There will be one by default. You can create as many test configuration as you want. For above example you can add three; one for home page, one for account page and one for search page. The test configuration will help you have the test instances ready while pulling the test cases into test lab without having to drag the same test cases multiple times.
The test configuration allows you to define the actual/default value for each of configuration added reducing the time it takes to fill this info during execution.
Test execution - after you pull the test cases into lab, during the manual run a pop up comes to show the values for each of parameter being used for that test case. Te values can be added or updated.
Please find a video I found on YouTube.
https://youtu.be/vCrJcHrosio
I don't have ALM to show with diagrams. Hope this helps.
Create a test testcase to test this feature.
Thanks
Happy exploring !!
Parameters help the user to assign a value to a variable so as to execute the same test with different sets of data.
For example, the user name and password can be two parameters, for a login related test, which would be assigned with a value.
How to use parameters:
Create test case with steps in Test Plan module under selected Cycle and proper folder.
Select the test step against which you would like to add the parameter. The 'Parameter' Icon will be enabled. Click on the same. The 'Parameter' dialog box will open. Now, click on 'New Parameter' button. Add the parameter (here: username or password). Add the default and/or actual values, description for the same and save.
You can also add different test configurations to use these parameters for different use case scenarios.
More details can be found here: http://alm-help.saas.hpe.com/en/12.53/online_help/Content/UG/ui_menu_test_parameters.htm

Cucumber scenario with same buttons?

This is my first time doing cucumber, so maybe what im asking isn't wrong but it just seems like there is a better way:
So right now im going through a survey-like website as my first automation task with cucumber. It works just fine, but like most surveys theirs a lot of "Fill then out, then click Next"
so in my Feature file I have a lot of:
Then I will click 'Next'
Which matches with the step (Since the button all have the same text):
Then(/^I will click 'Next'$/) do
click_button('Next')
end
So this one step definition defines like 8-9 lines in my feature file...which I guess is ok, but my feature file just looks...ugly? Im not used to the Gherkin language AT ALL as this is my first time, but it's basically turned into a lot of:
THEN SELECT THAT THING FROM DROPDOWN
THEN CLICK THIS RADIO BUTTON
THEN SELECT THIS BUTTON
THEN CLICK NEXT
Like over and over....I mean it's human readable, but it just looks messy? is this right?
Also im not really sure when I should use "explicits" in my feature file? Like should I explicity say Im going to select 'X' (or "X", not sure if it matters) from a dropdown? or Click the 'Next' button or select the 'yes' radio button for example?
You are writing what are called imperative steps and it is indeed the wrong way to go about cucumber/gherkin.
Your steps should be saying "WHAT" you are doing and not "HOW" you are doing.
Not knowing the details of your form, let's make up a flow.
Page 1. Name
Page 2. Demographics
Page 3. Favorite football team
Page 4. Favorite basketball team
Page 5. Results page showing how popular their teams with other survey takers
Given I enter the "Are you a Bandwagon Fan Survey"
When I enter my name
And I enter my demographics
And I choose a favorite football team
And I choose a favorite basketball team
Then I should be directed to the result page
And I should see my teams ranked on a graph
The details for entering your name and clicking next should be hidden inside that stepdef. A person trying to test your app doesn't care what the name is, or what the field ID is or anything like that. They just want to know the work flow.
If you are doing scenarios to get the name page to error you simply modify your gherkin to say something like.
When I enter a name too long
Then I see a name too long error message
When I do not enter a name
Then I see a name missing error message
Again, you leave the details of too long or what the error message is to the step def (or below) unless it is critically important to the test scenario. I usually set up factory girls to handle my data and just use the text of the scenario to pull the current data. so I'll have an error message factory and within that a "name_missing" and a "name_too_long" sub-factory that provide the correct values. If I need to change or look something up, everything is in the same place...but above all it's not cluttering my gherkin.
Yes I think you want to send parameters to step definition
Then I will click 'Next'
Step definition will be
Then(/^I will click "([^"]*))*"$/) do |text|
click_button(text)
end
also above will work for
Then I will click 'OK'

Same Step Definitions in Cucumber Gherkins

I have the following Gherkins:
Given i go to the URL
And i enter the <NRIC or FIN> as NRIC / FIN
And i select the option to proceed Next
And i select the first available available Handset Color
And i select the option to proceed Next
And i enter <Full Name> as Name
When i select the option to proceed Next
The "I select the option to proceed Next" appears three times. How should this be written as in the Step Definitions Java class file?
As well as the Declarative/Imperative question have a think about what requirement you're describing. I find it's helpful to include the Scenario: in the examples for this reason. It's very unusual to have that much detail in a Given step
Are you testing the creation of an order (bit of a guess)? If so then your enter/select steps should be the Whens in the scenario, so something like:
Scenario: Create a new order
Given I have gone to the URL
When I enter the NRIC/FIN: <NRIC/FIN>
And I choose the first available Handset Colour
And I enter <Full Name> as Name
Then my new order should be confirmed (or whatever)
However, if you're creating the order simply to set up the scenario to test something else then you can cheat and just state that the order should exist:
Scenario: Check the status of an order
Given that I have created an order:
| NRIC/FIN | Colour | Full Name |
| xxxxx | Red | John Doe |
When I check the status of my order
Then I should see a new order...
It's up to the automation whether it clicks through the screens to create that order or just inserts it into the database, all that matters is that by the time you get to the Whens the order should exist.
In an ideal BDD world the Gherkin would be written before the implementation, but it often doesn't work that way. I still find it useful to try and pretend I'm writing the Features in that ideal world. Asking "How would I have written this before we started development?" can help to separate the actual requirements (I can enter an order) from implementation details (I click Next after entering each item of data).
When writing cucumber scenarios you can adopt either a imperative or declarative style. I would prefer to write the same thing as below.
Given i go to the URL
And i enter NRIC / FIN
And i select the first available Handset Color
And i enter <Full Name> as Name
Then I should see that
So it depends on who is going to read your scenarios. A link worth reading is imperative - declarative

Resources