{"id":25110176,"url":"https://github.com/infotechbridge/userstory","last_synced_at":"2025-04-02T09:26:15.947Z","repository":{"id":218488602,"uuid":"745855511","full_name":"InfoTechBridge/UserStory","owner":"InfoTechBridge","description":"A simple .Net framework for Behavioral-Driven Development (BDD) approach that used for writing Given-When-Then user stories","archived":false,"fork":false,"pushed_at":"2024-01-24T14:20:21.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T15:18:42.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InfoTechBridge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-20T10:57:26.000Z","updated_at":"2024-10-15T06:32:02.000Z","dependencies_parsed_at":"2024-01-24T15:43:53.588Z","dependency_job_id":null,"html_url":"https://github.com/InfoTechBridge/UserStory","commit_stats":null,"previous_names":["infotechbridge/userstory"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfoTechBridge%2FUserStory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfoTechBridge%2FUserStory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfoTechBridge%2FUserStory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfoTechBridge%2FUserStory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InfoTechBridge","download_url":"https://codeload.github.com/InfoTechBridge/UserStory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246786823,"owners_count":20833761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-08T00:36:04.121Z","updated_at":"2025-04-02T09:26:15.928Z","avatar_url":"https://github.com/InfoTechBridge.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UserStory\n\nUserStory is a simple .Net framework for Behavioral-Driven Development (BDD) approach that used for writing Given-When-Then user stories.\n\nIt allows to define and run User Stories or standalone scenarios inside any type of .Net projects specially unit test and UI automation test projects.\n\n\n### Table of contents\n - [Features](#features)\n - [Install](#install)\n - [Usage](#usage)\n    - [Example 1: Standalone Given-When-Then Scenario](#example1)\n    - [Example 2: Inside Unit/Integration Test Projects](#example2)\n    - [Example 3: With Custom Description for each step](#example3)\n    - [Example 4: Full User Story Defination](#example4)\n - [Main contributors](#main-contributors)\n - [License](#license)\n \n## \u003ca id=\"features\"\u003eFeatures\u003c/a\u003e\n\nUserStory is very simple framework to use! \n - It can be used in any type of .Net projects including unit test, UI automation test, Console App, Web App and so on. Actually you don't have to use a testing framework at all.\n - It does not need to have a separate (test) runner. It can be run by itself or by your runner of choice and you will get the same result regardless of the runner.\n - It supports stories and also can run standalone scenarios and it is not necessarily have to have or make up a story to use it.\n - It automaticaly takes stories/scenarios/steps title/description from method names and you don't need to explain them in string but you have full control over what gets printed into console and reports if you want.\n - It supports underscored/pascal/camel cased method names for your steps title generation.\n - It is very simple and extensible.\n\n## \u003ca id=\"install\"\u003eInstall\u003c/a\u003e\n\nYou can install UserStory nuget package from [this location](https://www.nuget.org/packages/UserStory) or by following command:\n\n```\nInstall-Package UserStory\n```\n\nThis commands adds UserStory assembly and its dependencies to your target project. \n\n## \u003ca id=\"usage\"\u003eUsage\u003c/a\u003e\nAfter adding UserStory package to project we can start using it like following examples:\n\n### \u003ca id=\"example1\"\u003eExample 1: Standalone Given-When-Then Scenario\u003c/a\u003e\n\nWe can use the standalone Given-When-Then scenario whenever we like in any type of .Net projects:\n\n```C#\nusing UserStory.Extensions;\n...\nthis.Scenario(\"As an existing user, I want to log in successfully\")\n    .Given(\"user navigate to the Website\")\n    .When(x =\u003e x.LoginWithValidUser())\n    .Then(x =\u003e x.VerifyPageHeader())\n    .And(x =\u003e x.VerifyPageFooter())\n    .Run();\n...\n```\n\nThis example generates the following console report:\n\n```\nScenario #1: As an existing user, I want to log in successfully\n\t    Given user navigate to the Website\n\t    When login with valid user\n\t    Then verify page header\n\t    And verify page footer\n\t    Result: SUCCESS\n```\n\nNote: Remember to define the following methods and implemane them accordingly based on your logic. These methods will be executed during scenario execution.\n\n```C#\nprivate void LoginWithValidUser()\n{\n    ...\n}\n\nprivate void VerifyPageHeader()\n{\n    ...\n}\n\nprivate void VerifyPageFooter()\n{\n    ...\n}\n```\n\n### \u003ca id=\"example2\"\u003eExample 2: Inside Unit/Integration Test Projects\u003c/a\u003e\n\nWe can use same Fluent API syntax inside the any unit test projects specialy inside UI automation test methods.\n\n```C#\nusing UserStory.Extensions;\n...\n[TestMethod]\npublic void VerifyHomePage()\n{\n    var result = this.Given(\"user navigate to the Website\")\n        .When(x =\u003e x.LoginWithValidUser())\n        .Then(x =\u003e x.VerifyPageHeader())\n        .And(x =\u003e x.VerifyPageFooter())\n        .Run();\n\n    Assert.AreEqual(Result.Success, result);\n}\n```\n\nThis gives you a console report like:\n\n```\nScenario #1: Verify home page\n\tGiven user navigate to the Website\n\tWhen login with valid user\n\tThen verify page header\n\tAnd verify page footer\n\tResult: SUCCESS\n```\n\nNote: It is not mandatory to start the Fluent API by this.Scenario(...). We can start it from this.Given(...) like above example. In this case it takes the title of scenario from the method that scenario defined inside it. For example here it uses VerifyHomePageByTitles() name for title of scenario.\n\n### \u003ca id=\"example3\"\u003eExample 3: With Custom Description for each step\u003c/a\u003e\n\nHere is another example that shows how we can control the description of each step inside report: \n\n```C#\nusing UserStory.Extensions;\n...\n[TestMethod]\npublic void VerifyHomePageWitCustomDescription()\n{\n    var result = this.Scenario(\"As an existing user, I want to log in successfully\")\n        .Given(\"user navigates to the Login page\", x =\u003e x.NavigateToLoginPage())\n        .When(\"user enters the valid username and password\", x =\u003e x.EnterUserNameAndPassword(\"user1\", \"pass1\"))\n        .And(\"user clicks on sign-in button\", x =\u003e x.ClickOnSignInButton())\n        .Then(\"user successfully navigates to the dashboard page\", x =\u003e x.VerifyDashboardPage())\n        .Run();\n\n    Assert.AreEqual(Result.Success, result);\n}\n```\n\nThis gives you a console report like:\n\n```\nScenario #5: As an existing user, I want to log in successfully\n\tGiven user navigates to the Login page\n\tWhen user enters the valid username and password\n\tAnd user clicks on sign-in button\n\tThen user successfully navigates to the dashboard page\n\tResult: SUCCESS\n```\n\n### \u003ca id=\"example4\"\u003eExample 4: Full User Story Defination\u003c/a\u003e\n\n```C#\nusing UserStory.Extensions;\n...\n[TestMethod]\npublic void VerifyDashboardPageFullUserStory()\n{\n    var story = this.Story(\n        title: \"Login to the site\",\n        id: \"#JIRA123\",\n        description: \"The user shall be able to login to site after entering the correct username and password.\",\n        asA: \"new user\", \n        iWantTo: \"log in to the website\", \n        soThatICan: \"access the dashboard page\");\n\n    story.AddScenario(this\n        .Scenario(\"Login as a valid user with valid data\")\n        .Given(\"user navigates to the Login page\", x =\u003e x.NavigateToLoginPage())\n        .When(\"user enters the valid username and password\", x =\u003e x.EnterUserNameAndPassword(\"user1\", \"pass1\"))\n        .And(\"user clicks on sign-in button\", x =\u003e x.ClickOnSignInButton())\n        .Then(\"user successfully navigates to the dashboard page\", x =\u003e x.VerifyDashboardPage())\n        .And(x =\u003e x.VerifyPageHeader())\n        .And(x =\u003e x.VerifyPageFooter())\n    );\n\n    story.AddScenario(this\n        .Scenario(\"Login as a valid user user by entering an invalid password\")\n        .Given(\"user navigates to the Login page\", x =\u003e x.NavigateToLoginPage())\n        .When(\"user enters the invalid username and password\", x =\u003e x.EnterUserNameAndPassword(\"user1\", \"invalidpass1\"))\n        .And(\"user clicks on sign-in button\", x =\u003e x.ClickOnSignInButton())\n        .Then(\"invalid password message should be displayed\", x =\u003e x.VerifyInvalidPasswordMessage())\n    );\n\n    story.Run();\n\n    Assert.AreEqual(Result.Success, story.Result);\n}\n```\n\nAnd this gives you a report like:\n\n```\nStory #JIRA123: Login to the site\nDescription: The user shall be able to login to site after entering the correct username and password.\n\tAs a new user\n\tI want to log in to the website\n\tSo that I can access the dashboard page\n\nScenario #1: Login as a valid user with valid data\n\tGiven user navigates to the Login page\n\tWhen user enters the valid username and password\n\tAnd user clicks on sign-in button\n\tThen user successfully navigates to the dashboard page\n\tAnd verify page header\n\tAnd verify page footer\n\tResult: SUCCESS\n\nScenario #2: Login as a valid user user by entering an invalid password\n\tGiven user navigates to the Login page\n\tWhen user enters the invalid username and password\n\tAnd user clicks on sign-in button\n\tThen invalid password message should be displayed\n\tResult: SUCCESS\n\nResult: SUCCESS\n```\t\n\n\n## \u003ca id=\"how-to-contribute\"\u003eHow to contribute?\u003c/a\u003e\n\nPlease see \u003ca href=\"https://github.com/InfoTechBridge/UserStory/blob/master/CONTRIBUTING.md\"\u003eCONTRIBUTING.md\u003c/a\u003e.\n\n## \u003ca id=\"main-contributors\"\u003eMain contributors\u003c/a\u003e\n - Amir Arayeshi ([AArayeshi](https://github.com/AArayeshi))\n\n## \u003ca id=\"license\"\u003eLicense\u003c/a\u003e\nUserStory is released under the [MIT](https://opensource.org/licenses/MIT) License. See the [LICENSE](https://github.com/InfoTechBridge/UserStory/blob/master/LICENSE.txt) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfotechbridge%2Fuserstory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfotechbridge%2Fuserstory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfotechbridge%2Fuserstory/lists"}