How to implement SpecFlow "Scenario Outline" in MSpec - mspec

My team have settled on MSpec for our BDD testing framework, which from their usage so far looks really good - but I'm struggling with the documentation/google for finding any implementation similar to SpecFlow's 'Scenario Outline'. I've shown an example of this below, but basically it allows you to write one 'test' and run it multiple times from a table (example) of inputs/expected outputs. I'll be embarrassed if answer turns out to be a LMGTFY but I've not been able to find anything myself. I don't want to say to the team it's not possible if I've just not found how to do it in MSpec (or understood MSpec properly). I wonder if this is why in some of the pro's/con's for MSpec I see references to the number of classes you can end up with listed as a negative.
Example of SpecFlow Scenario Outline
Scenario Outline: Successfully Convert Seconds to Minutes Table
When I navigate to Seconds to Minutes Page
And type seconds for <seconds>
Then assert that <minutes> minutes are displayed as answer
Examples:
| seconds | minutes |
| 1 day, 1 hour, 1 second | 1500 |
| 5 days, 3 minutes | 7203 |
| 4 hours | 240 |
| 180 seconds | 3 |
From: https://gist.github.com/angelovstanton/615da65a8f821d7a43c92ef9e2fd0b01#file-energyandpowerconvertcalculator-feature

Short answer, this is current not supported by by mspec. We planned this several years back, but the contribution never made it back into master.
If you want scenario outlines either use a different framework or create parameterized static methods in a helper class and call these from your context classes. Which will leave you with 1 class per scenario.

Related

ArcGIS Pro - Arcade Attribute Rule Cumulative Calculation

I am stuck trying to create an attribute rule/field calculation using Arcade where upstream areas are added to a downstream area called "Cumulative Area"
NodeFrom
NodeTo
Area
CumulativeArea
1
2
10
10
2
3
5
15
4
3
6
6
4
3
6
6
3
5
8
20
Essentially I am thinking of the SQL equivalent of a SUM WHERE NodeTo = NodeFrom. Or an excel equivalent of [Area + SUMIF(CumulativeArea, NodeFrom, NodeTo)]
This is for QA'ing sewer calculations so please let me know if there are any tools out there that may already have this kind of functionality.
Thanks!
I think you're just tired and need to re-evalute the tools you're already using. Other tools won't be node specific. In faster settings the area is more difficult to process at the speed you require. Try disassembly of your current tool for full copyright. You're on the right track.

How to simulate a loop in Hive Sql?

I want to simulate a loop in Hive. The problem is that of link traversal.
Raw Data:
phone,name
1234,Sam
2345,John
3456,Max
7899,Sam
7899,Tim
8899,Tim
8898,Dan
8899,John
I am only interested in getting phone numbers.
If I take 1234,Sam and go to 7899,Sam that would be 1-hop because Sam used 7899 number too. Then if I go from 7899,Sam to 8899,Tim that would be 1-hop because 7899 was used by Tim and Tim also used 8899. Now where we started from, 1234, to where we are now, 8899, we are 2-hops away. I can do this with a shell script with loops but I am interested to find if this is possible to do purely in Hive. I want the loop to stop if any one criteria is met:
10 hops reached OR no new numbers detected
(If the conditions above are hard to implement, I can just have one condition - 10hops reached)
Visual representation:
1 hop:
1234 -> Sam
Sam linked to 7899
2 hops:
7899 -> Tim
Tim linked to 8899
so 1234 and 8899 are 2 hops away.
Any tips are welcome!

Feature level data table in cucumber

I have a situation where I need to have multiple scenarios within the same feature file and I need them to share the data table so that the user need not enter the same test data in all the relevant data tables in that feature.
Eg:
Feature: ABC
Scenario : 1
<<Steps of Scenario>>
Enter the data here:
|fieldNickName|fieldValue|
|ABC | <aaa> |
<<Steps of Scenario>>
Examples:
|AAA|
|111|
Scenario : 2
<<Steps of Scenario>>
Enter the data here:
|fieldNickName|fieldValue|
|ABC | <aaa> |
|DEF | <bbb> |
<<Steps of Scenario>>
|HIJ | <ccc> |
<<Steps of Scenario>>
Examples:
|AAA|BBB|CCC|
|111|232|AJ|
Here as you can see, "ABC" is a shared parameter & AAA its value between both scenarios. Is there a way I can have a "COMMON" Examples section for a Feature which can feed to all the scenarios in it?
The way to do this is to take the examples out of the feature and push them down into the step definitions. I could explain this in greater details if you provided the actual scenarios with their steps and explained the business context behind them.
Your cuking can be much simpler if avoid using examples and outlines. There really is no need to make things so complicated. Scenarios should be clear, simple and descriptive. They should talk about WHAT you are doing not HOW it is done.
I do not think there is a way for having the common Example parameters. I am not sure about your scenario but if you are using the same step with same data in all the scenarios, you can make them a part of Background

Jawbone Create Meal/MealType

I'm trying to log Meal Entry using Jawbone API. In API documentation described sub_type parameter which is responsible for Meal Type (breakfast/lunch/dinner). However it looks like this parameter doesn't control anything and everything is controlled by time_created/tz parameters. Could anyone help me to understand exact logic responsible for where Logged Meal goes - Breakfast/Lunch/Dinner/Snack.
update 20/09/2016
I'd like to be able to log Meal(as Breakfast/Dinner/Lunch or Snack) and see result in user feed as Breakfast/Dinner/Lunch or Snack (https://jawbone.com/up/food/meals). For now I'm interested only in these 4 Meal Types because of compatibility with our app.
I've found that it can be achieved by specifying time_created = (${begin_of_the_day} + mealTypeAdjustment), where mealTypeAdjustment=
-7h for Breakfast
-13h for Lunch
-19h for Dinner
these numbers are just my assumption which work so far. But there is no Jawbone documentation about this logic so my questions:
1) how can I controll using time_created, where logged Meal appears in user feed(Breakfast/Dinner/Lunch or Snack)?
2) I still didn't get how to log Snack. Few times I was able to do it by randomizing input parameters but unfortunately I can't reproduce it now.
The sub_type is just a piece of metadata about the meal in case you would like to classify a meal as breakfast/lunch/dinner.
Where a meal entry appears in a user's feed is dictated by time_created. In fact, there is no direct connection between time_created and sub_type.
Here are all the meal sub_type values:
sub_type | value
-------------|-------
Breakfast | 1
Lunch | 2
Dinner | 3
Pre-Workout | 4
Post-Workout | 5
Snack | 6

Related jobs in JSprit

Is it possible to handle relations between jobs (in this case services) in jsprit?
For instance one job has to start at the same time with one or more other jobs.
Or one job must not start before the end of another job (normal sequence).
If not, do you know other java libraries that can handle such kind of restrictions?
Thank you!
Yes you can handle such relations with jsprit.
It is a bit of coding, but - I think - easy to implement. To illustrate it, I prepared you five examples that are based on the Vehicle Routing Problems (VRP) developed by Christofides-Mingozzi-Toth's* (first benchmarking instance). Follow the links behind the individual headlines and you get to the code. Note that the first activity in a route is marked with a triangle. The labels denote jobIds.
noConstraints
capacityConstraints
job 13 and 21 in same route
job 13 and 21 in same route AND 21 before 13
job 13 and 21 in same route AND 13 right after 21
Visit http://jsprit.github.io/ and you get to a number of code examples and docs.
*N. Christofides, A. Mingozzi, and P. Toth. The vehicle routing problem. In N. Christofides, A. Mingozzi, P. Toth, and C. Sandi, editors, Combinatorial Optimization. John Wiley, Chichester, 1979.