Cucumber - Using same datatable in multiple steps in a scenario - datatable

I am new to cucumber and trying to use the datatable in a scenario.
Scenario: 1. Sets the configuration and validates it
When the user sets the POST config
| key | value |
| enabled | false |
| timezone | "Asia/Kolkata" |
Then the user gets the config and the result is successfull
| key | value |
| enabled | false |
| timezone | "Asia/Kolkata" |
Here i am using the same datatable to construct REST post request and then validate it.
Is there a possibility to specify the same datatable for multiple steps ?
If i specify the datatable at the end of the scenario,for the first step i get the error Arity mismatch.
TIA

You could also provide different parameters to you test by using scenario outline.
Scenario Outline: Sets the configuration and validates it
When the user sets the POST config with key “<*key>” and enabled status equals to “<*enabled>” for timezone “<*timezone>”
Then the user gets the config and the correct data is recorded for key “<*key>” and enabled status equals to “<*enabled>” for timezone “<*timezone>”
Examples:
| key | enabled | timezone |
| value | false | Asia/Kolkata |
| value2 | true | timezone2 |
The first time your test will be run with key = value, enabled = false, timezone = Asia/Kolkata
The second time the test will be executed with key = value2, enabled = true, timezone = timezone2
Etc
P.S.: You need to delete the * symbols
I hope it helps.

Related

Advisable to remove the Session/Keepalive log data coming from Applications to Azure App Insights

We have a web-application hosted on Azure and it sends Telemetry to App Insights and the Dev team is asking if it is ok to Turn off sending the SESSION/KEEPALIVE data thats being posted from web-application. Will this affect any functionality like User Flows etc in Application Insights?
Any guidance on this?
Following is sample data:-
timestamp | id | source | name | url | success | resultCode | duration | performanceBucket
-- | -- | -- | -- | -- | -- | -- | -- | --
2019-09-25T16:00:31.8191577Z | \|Ac34D.9fIx+.4c3e0b35_ | POST session/keepalive | http://XXXXXXXXXXXXXX.com/session/keepalive | TRUE | 200 | 15.8274 | <250ms
2019-09-25T16:00:42.7423811Z | \|Ac34D.FqSNy.83ee6e0d_ | POST session/keepalive | http://XXXXXXXXXXXXXX.com/session/keepalive | TRUE | 200 | 38.3679 | <250ms
2019-09-25T16:00:48.716939Z | \|Ac34D.h8kwN.34c0b012_ | POST session/keepalive | http://XXXXXXXXXXXXXX.com/session/keepalive | TRUE | 200 | 16.0359 | <250ms
2019-09-25T16:00:54.1607213Z | \|Ac34D.v2qfF.4c3e0b36_ | POST session/keepalive | http://XXXXXXXXXXXXXX.com/session/keepalive | TRUE | 200 | 15.2518 | <250ms
Views in Applications Insights typically target a specific set of telemetry item types.
For instance, user flows UI leverages PageView and CustomEvent telemetry types. Therefore, if keep alive is reported as one of those types it will be displayed in that UI.
However, if the example above is Dependency telemetry, then that view won't be affected.
In general, if you'd like to drop some of the telemetry before it reaches AI and is processed for storage, you'd use TelemetryProcessor (in case of Java Script SDK, TelemetryInitializer) to filter it out:
var telemetryInitializer = (envelope) => {
if (envelope.data.someField == 'keepalive') return false;
};
appInsights.addTelemetryInitializer(telemetryInitializer);

Showing Complete Set of Data with Filter and parameter - Tableau 10

I have a set of data below.
| AdviserName | PolicyNumber | Product | Status | Duration |
|-------------|--------------|---------|--------|----------|
| Andy | LIF123 | ANZ | New | 2 |
| Andy | X224 | AXA | Lapsed | 3 |
| George | KL1122 | TAL | New | 0 |
| George | OLK43 | AXA | Lapsed | 5 |
| Ben | LIF98 | ANZ | New | 0 |
| Ben | KL343 | TAL | Lapsed | 1 |
I want to get the set of data where the status = 'Lapsed' duration between 1 to 3. However I still want to show correspond status = 'New' for each adviser. Below is the expected result that I want to see.
| AdviserName | PolicyNumber | Product | Status | Duration |
|-------------|--------------|---------|--------|----------|
| Andy | LIF123 | ANZ | New | 2 |
| Andy | X224 | AXA | Lapsed | 3 |
| Ben | LIF98 | ANZ | New | 0 |
| Ben | KL343 | TAL | Lapsed | 1 |
I created 2 parameters :
MinYear with the value set to 1
MaxYear with the value set to 3
I created 2 calculated fields :
MinInvYear which is iif([Duration]>=[Min Year] and [Status] = 'Lapsed', 1, 0)
MaxInvYear which is iif([Duration]<=[Max Year] and [Status] = 'Lapsed', 1, 0)
Last step, I put both calculated fields into the filters and tick the filter = 1 only. Unfortunately what I got is the table below. I need to show the status 'New' as well for Andy and Ben.
| AdviserName | PolicyNumber | Product | Status | Duration |
|-------------|--------------|---------|--------|----------|
| Andy | X224 | AXA | Lapsed | 3 |
| Ben | KL343 | TAL | Lapsed | 1 |
I tried to modify the calculated field using Level of Detail :
MinInvYear which is {include [Status] = 'New Business' : iif([Duration]>=[Min Year] and [Status] = 'Lapsed', 1, 0)} and I got error message 'Result of a level of detail expression must be aggregate.'
What am I missing?
FYI, I'm using Tableau 10.
Thanks all for your help.
Instead of the 2 calculated fields MinInvYear and MaxInvYear, try adding a calculated field (let's say Filter for Status and Duration) which returns a boolean value based on your condition
IF ([Status] == 'Lapsed' OR ([MinYear] < [Duration] AND [Duration] < [MaxYear])) THEN
TRUE
ELSE
FALSE
END
Now, add a filter for this calculated field to show only records which result in True.
try this, Bit lengthy but works for sure:
You are manipulating on only one aspect (Lapsed) of the field status, hence you are applying the parameter values on only that value. So here you need to independently work on that column to get the required output. Follow the below process:
Create 2 sets for each value in status column:
Set 1: Lapsed
Here create a set and just select checkbox `Lapsed`.
Set 2: New
Here create a set and just select checkbox `New`.
Create two calculated fields to extract the required data separately for Lapsed and New
Calculated Field 1: Lapsed_Status
IF [Duration] >= [Min] and [Duration] <= [Max]
THEN [Lapsed] //Set
END
Calculated Field 2: New Status
IF [New]=[New]
THEN [New] //Set
END
Create two more sets out of 2 calculated fields (created in step 2) to just select only those values that are needed for display on sheet:
Set 3: Display_Lapsed //From Calculated Field 1: New Status
Select checkbox True
Set 4: Display_New //From Calculated Field 2: Lapsed_Status
Select checkbox True
Now we have our required data in 2 sets, Create one more calculated field and use in filter
Calculated Field 'Display_sheet'
Display_Lapsed <> Display_New //Both are sets
Use the calculated field Display_sheet in filter and select true
Use the required fields on the sheet to display data.
Let me know how it goes
Below trick will get you moving
Duplicate the data source (right click on the data source in 'Data' panel -> 'Duplicate') having above data
Drag AdviserName from the original data source in 'Rows' view
Click on the duplicated data source in 'Data' panel. There you'll find 'link symbol' next to every dimension (in grey color). Click on the 'link symbol' next to AdviserName and it'll turn 'red' (if it turns grey don't worry. Click again and it'll turn red). Be sure that only one 'link symbol' is red (which is next to AdviserName).
Create a calculated field filter_cond in this duplicated data source as
IF [Status]='Lapsed' and [Duration]<=3 and [Duration]>=1
then 'Y'
ELSE 'N'
END
Drag filter_cond in 'Filters' view and select 'Y'
Now drag PolicyNumber, Product & Status from the original datasource in 'Rows' view. You are done!
Voila!

Cucumber - run same feature a number of times depending on records in a database

I have a cucumber feature that checks a website has processed payment files correctly (BACS,SEPA, FPS etc). The first stage of the process is to create the payment files which in-turn create expected result data in a database. This data is then used to validate against the payment processing website.
If I process one file, my feature works perfectly validating the expected results. Where I'm stuck is how I get the feature to run (n) number of times depending on the number of records/files that were originally processed.
I've tried an 'Around' hook using a record count iteration with no joy, can't see how I can fit it into an outline scenario and now think that perhaps a rake task to call the feature might work.
Any ideas would be greatly appreciated.
Here's a sample of the feature:
Feature: Processing SEPA Credit Transfer Files. Same Day Value Payments.
Background:
Given we want to test the "SEPA_Regression" scenario suite
And that we have processed a "SEPA" file from the "LDN" branch
And we plan to use the "ITA1" environment
Then we log in to "OPF" as a "SEPA Department" user
#feature #find_and_check_sepa_interchange #all_rows
Scenario: Receive SEPA Credit Transfer Files for branch
Given that we are on the "Payment Management > Interchanges" page
When I search for our Interchange with the following search parameters:
| Field Name |
| Transport Date From |
| Bank |
| Interchange Reference |
Then I can check the following fields for the given file in the "Interchanges" table:
| Field Name|
| Interchange Reference |
| Transport Date |
| File Name |
| File Format |
| Clearing Participant |
| Status |
| Direction |
| Bank |
When I select the associated "Interchange Id" link
Then the "Interchange Details" page is displayed
Update I've implemented nested steps for the feature so that I can call the database records first and feed each set of records (or at least the row id) into the main feature like so:
Feature
#trial_feature
Scenario: Validate multiple Files
Given we have one or more records in the database to process for the "SEPA_Regression" scenario
Then we can validate each file against the system
Feature steps:
Then(/^we can validate each file against the system$/) do
x = 0
while x <= $interchangeHash.count - 1
$db_row = x
# Get the other sets of data using the file name in the query
id = $interchangeHash[x]['id']
file_name = $interchangeHash[x]['CMS_Unique_Reference_Id']
Background.get_data_for_scenario(scenario, file_name)
steps %{
Given that we are on the "Payment Management > Interchanges" page
When I search for our Interchange with the following search parameters:
| Field Name |
| Transport Date From |
| Bank |
| Interchange Reference |
Then I can check the following fields for the given file in the "Interchanges" table:
| Field Name|
| Interchange Reference |
| Transport Date |
| File Name |
| File Format |
| Clearing Participant |
| Status |
| Direction |
| Bank |
When I select the associated "Interchange Id" link
Then the "Interchange Details" page is displayed
Seems a bit of a 'hack' but it works.
If you have batch processing software, then you should have several Given (setup) steps, 1 When (trigger) step, several Then (criteria) steps.
Given I have these SEPA bills
| sepa bill 1 |
| sepa bill 2 |
And I have these BAC bills
| bac bill 1 |
| bac bill 2 |
When the payments are processed
Then these sepa bills are completed
| sepa bill 1 |
| sepa bill 2 |
And I these bac bills are completed
| bac bill 1 |
| bac bill 2 |
It's simpler, easier to read what is supposed to be done, and can be expanded to more. The works should be done in the step definitions of setting up and verifying.

PageObject/Cucumber String being input incorrectly

In my scenario outline I have the below
Examples:
| user | password | from | to | amount | date | message |
| joel10 | lolpw12 | bankA | bankB | $100 | 1/30/2015 | Transfer Success. |
in my step definitions I have the below
And(/^the user inputs fields (.*), (.*), (.*)$/) do |from, to, amount|
on(TransferPage).from = /#{from}/
on(TransferPage).to = /#{to}/
on(TransferPage).amount = /#{amount}/
on(TransferPage).date = /#{date}/
end
The FROM, TO, and AMOUNT all comes out correct from the table but when it inputs the date, it comes out (?-mix:1/30/2015)
why is this happening and how do i fix?
When you do /#{date}/ you are taking the value returned from the parsing of the step definition and then turning it into a regular expression:
/#{date}/.class
#=> Regexp
You presumably want to leave the value in its original String format:
on(TransferPage).date = date

How to repeat query in Oracle Forms upon dynamically changing ORDER_BY clause?

I have an Oracle Forms 6i form with a data block that consists of several columns.
------------------------------------------------------------------------------
| FIRST_NAME | LAST_NAME | DEPARTMENT | BIRTH_DATE | JOIN_DATE | RETIRE_DATE |
------------------------------------------------------------------------------
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
------------------------------------------------------------------------------
The user can press F7 (to Enter in Query Mode, for example, he/she types JOH% in the first_name and H% in the DEPARTMENT field) , then F8 to execute the query and see the results. In this example, a list of all employees with their last name starting with JOH and working in any department starting with H will be listed. Here is a sample output of that query
------------------------------------------------------------------------------
| FIRST_NAME | LAST_NAME | DEPARTMENT | BIRTH_DATE | JOIN_DATE | RETIRE_DATE |
------------------------------------------------------------------------------
| MIKE | JOHN | HUMAN RES. | 05-MAY-82 | 02-FEB-95 | |
| BEN | JOHNATHAN | HOUSING | 23-APR-76 | 16-AUG-98 | |
| SMITH | JOHN | HOUSING | 11-DEC-78 | 30-JUL-91 | |
| | | | | | |
------------------------------------------------------------------------------
I then added a small button on top of each column to allow the user to sort the data by the desired column, by executing WHEN-BUTTON-PRESSED trigger:
set_block_property('dept', order_by, 'first_name desc');
The good news is that the ORDER_BY does change. The bad news is that the user never notice the change because he/she will need to do another query and execute to see the output ordered by the column they selected. In other words, user will only notice the change in the next query he/she will execute.
I tried to automatically execute the query upon changing the ORDER_BY clause like this:
set_block_property('dept', order_by, 'first_name desc');
go_block('EMPLOYEE');
do_key('EXECUTE_QUERY');
/* EXECUTE_QUERY -- same thing */
but what happens is that all data from the table is selected, ignoring the criteria that the user has initially set during the query mode entry.
I also searched for a solution to this problem and most of them deal with SYSTEM.LAST_QUERY and default_where. The problem is, last_query can refer to a different block from a different form, that is not valid on the currently displayed data bloc.
How can do the following in just one button press:
1- Change the ORDER_BY clause of the currently active datablock
and: 2- Execute the last query that the user has executed, using the same criteria that was set?
Any help will be highly appreciated.
You can get the last query of the block with get_block_property built-in function:
GET_BLOCK_PROPERTY('EMPLOYEE', LAST_QUERY);
Another option is to provide separate search field(s) on the form, instead of using the QBE functionality.

Resources