c# - Referencing a folder in my project with a SpecFlow test -


I am trying to write a SpecFlow test where I test when a fixed structure of my application folder and files I want to include these folders and files in my project so that the tests do not go on my computer. For example, I have two folders in my specs project: a 'simple testmodel' and one called 'complex testodel'. How can I reference these folders in these spaceflow tests?

You want.

From:

In a software test, a test stability software used as a baseline for running a test test is a fixed position of the software; Also known as the reference of the test

Examples of fixtures:

  • Loading a database with a specific, known set
  • One to destroy the hard disk and install a set of known clean operating systems
  • copying specific known files
  • the preparation of input data and set-up / fake or manufacture counterfeit goods

Under Software Test, a piece of software Eligible trials to reproduce the area is known to be used to organize as a test harness;

For your specific problem:

  1. Create a fixture directory in your SPECLO test project. To set up the directory and file structure within it, make any sub-directories based on your tests.

  2. One & lt; App settings & gt; Define the root folder for all of your test fixtures in the App.config entry

      & lt; Configuration & gt; ... & lt; App settings & gt; & Lt ;! - Path relative to build output directory - & gt; & Lt; Add name = "fixturesutdirectory" value = ".. \ .. \ fixture" /> & Lt; / AppSettings & gt; ... & lt; / Configuration & gt; [BeforeScenario]  In the hook, set the full path to the fixtures directory at the current scenario reference (reference :) 

     Using the  system. Configuration; Using System.IO; Using TechTalk.SpecFlow; Namespace Fu {[compulsive] Public square common hook [[FirstSenario] Public before zero; Scenario () {InitFixturesPath (); } Private void InitFixturesPath () (if (ScenarioContext.Current.ContainsKey ( "FixturesPath")) return; string codeBase = Pthkget Dayrectorinam (Vidhansbaksmjukr assembly (). Codebase) + path. Dayrektrisiparetrkar + Configuration Manager. App settings [ "Ficcharsrut directory"]; UriBuilder = new UriBuilder (codeBase); string path = Uri.UnescapeDataString (uri.Path); case contact. on Kset & lt; string & gt; ( "Ficcharspath" path. gate Dayrectorijanam (path ));}}}  
  3. You are now redirecting to root directory To get ScenarioContext.Current.Get & lt; string & gt; ( "Fikscrs path") can use . For all your fixtures you can also write your Fikscrrs auxiliary class Public static string path {get; set;} // makes it easy to use other methods and assets to join}


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -