question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to parameterize scenarios

See original GitHub issue

In NUint there is TestCAse attribute, where you can setup parameters for test and it will be launch sereval times with different parameters. I’m Able to add it in LightBDD scenario, but these parameters don’t appear in console output.

e.g.

	[TestCase("v5")]
	[TestCase("v4")]
	[Scenario]
        [Label("Ticket-1")]
        public void It_should_be_possible_to_get_movies_by_lat_and_lng_on_api_version(string version)
        {
			string lat = Config.getConfig().testCities.msk.lat;
			string lng = Config.getConfig().testCities.msk.lng;

			Runner.RunScenario(
				_ => Given_api_version(version),
				_ => Given_lat_and_lng(lat, lng),
				_ => When_trying_get_movies_by_lat_and_lng(),
				_ => Then_we_get_statusCode_OK(response),
				_ => Then_content_is_not_null(response));
        }

here is an output:

SCENARIO: [Ticket-1] It should be possible to get movies by lat and lng on api version
  STEP 1/5: GIVEN api version "v5"...
  STEP 1/5: GIVEN api version "v5" (Passed after 3ms)
  STEP 2/5: AND lat "55.7495307478992" and lng "37.6213073730469"...
  STEP 2/5: AND lat "55.7495307478992" and lng "37.6213073730469" (Passed after <1ms)
  STEP 3/5: WHEN trying get movies by lat and lng...
  STEP 3/5: WHEN trying get movies by lat and lng (Passed after 432ms)
  STEP 4/5: THEN we get statusCode OK [response: "RestSharp.RestResponse"]...
  STEP 4/5: THEN we get statusCode OK [response: "RestSharp.RestResponse"] (Passed after 7ms)
  STEP 5/5: AND content is not null [response: "RestSharp.RestResponse"]...
  STEP 5/5: AND content is not null [response: "RestSharp.RestResponse"] (Passed after 3ms)
  SCENARIO RESULT: Passed after 474ms

SCENARIO: [Ticket-1] It should be possible to get movies by lat and lng on api version
  STEP 1/5: GIVEN api version "v4"...
  STEP 1/5: GIVEN api version "v4" (Passed after <1ms)
  STEP 2/5: AND lat "55.7495307478992" and lng "37.6213073730469"...
  STEP 2/5: AND lat "55.7495307478992" and lng "37.6213073730469" (Passed after <1ms)
  STEP 3/5: WHEN trying get movies by lat and lng...
  STEP 3/5: WHEN trying get movies by lat and lng (Passed after 123ms)
  STEP 4/5: THEN we get statusCode OK [response: "RestSharp.RestResponse"]...
  STEP 4/5: THEN we get statusCode OK [response: "RestSharp.RestResponse"] (Passed after <1ms)
  STEP 5/5: AND content is not null [response: "RestSharp.RestResponse"]...
  STEP 5/5: AND content is not null [response: "RestSharp.RestResponse"] (Passed after <1ms)
  SCENARIO RESULT: Passed after 126ms

It would be great if scenario parameters will appear in output

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
APshenkincommented, Jul 6, 2017

@Suremaker Thanks for the answer. I found, that my project gets packages from folder with outdated versions. The problem was resolved

0reactions
Suremakercommented, Jul 5, 2017

Hello,

The scenario described above should render properly like:

SCENARIO: [Ticket-1] It should be possible to get all cities on api version "v2"

Please check that all referenced LightBDD packages are of version 2.2.0, including:

  • LightBDD.NUnit3,
  • LightBDD.Framework,
  • LightBDD.Core. Also, NUnit should be of version 3.7.1 or above (however it should be enforced by LightBDD.NUnit3 2.2.0 anyway).

I have created a sample project with your scenario and both Resharper and Visual Studio Test runner shows properly rendered scenario: example.zip

Please let me know if that helped.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a Scenario Parameter?
Scenario parameters are placeholders like variables, only to represent a value that changes from scenario to scenario. For example, if you want to...
Read more >
Parameterize BDD Tests | TestComplete Documentation
In BDD tests, you parameterize test steps, not scenarios or features. That is, you set parameters for the Given , When , and...
Read more >
Parameterization and concept of Test Cases
When you write a Scenario, you can parameterize the test data and expected values in a step, which you use for data entry...
Read more >
106 SpecFlow Scenario Outlines: Parameterizing Your Tests
SpecFlow is a popular tool used for Behavior Driven Development (BDD) in .NET projects. One of its key features is the ability to...
Read more >
Scenario Analysis Techniques Using Multiple 'What If' ...
Learn how to do a scenario analysis in Power BI by isolating certain variables and incorporating the 'what-if' parameter.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found