{"id":195,"date":"2023-11-10T09:45:00","date_gmt":"2023-11-10T01:45:00","guid":{"rendered":"https:\/\/aabirtech.com\/shiblenomanblog\/?p=195"},"modified":"2024-08-10T11:00:07","modified_gmt":"2024-08-10T03:00:07","slug":"setting-environment-variables-in-developer-powershell-in-visual-studio","status":"publish","type":"post","link":"https:\/\/aabirtech.com\/shiblenomanblog\/2023\/11\/10\/setting-environment-variables-in-developer-powershell-in-visual-studio\/","title":{"rendered":"Setting Environment Variables in Developer PowerShell in Visual Studio"},"content":{"rendered":"\n<p>While writing UI automated test scenarios using Gherkin SpecFlow framework and C# Steps, I needed to set an environment variable to run a single test case from the command line. In the Windows Command Prompt, I would set the environment variable like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set ENV=envName<\/code><\/pre>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set ENV=autotests-rc<\/code><\/pre>\n\n\n\n<p>Then, I would run the test scenario using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet test --filter FullyQualifiedName=project_api_testing.Features.Admin.Structure.VerifyAdminPayItemsFunctionalityFeature.VerifyUserCanGetPayItemOptions<\/code><\/pre>\n\n\n\n<p>However, setting the environment variable like this doesn&#8217;t work in the Developer PowerShell in Visual Studio. Instead, you need to use the following syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$env:ENV = \"autotest-rc\"<\/code><\/pre>\n\n\n\n<p>To run all the test cases from the Developer PowerShell in Visual Studio, I use the following command:<\/p>\n\n\n\n<p>To run the all the test case from the developer power shell in visual studio.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet test ; py .\\SanitizeJsonReport.py ; livingdoc test-assembly .\/bin\/Debug\/net6.0\/project_api_testing.dll -t .\/TestExecution.json<\/code><\/pre>\n\n\n\n<p>Happy Coding \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While writing UI automated test scenarios using Gherkin SpecFlow framework and C# Steps, I needed to set an environment variable to run a single test case from the command line. In the Windows Command Prompt, I would set the environment variable like this: For example: Then, I would run the test scenario using: However, setting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[23],"tags":[],"class_list":["post-195","post","type-post","status-publish","format-standard","hentry","category-powershell"],"acf":[],"_links":{"self":[{"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/posts\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":2,"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/posts\/195\/revisions"}],"predecessor-version":[{"id":206,"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/posts\/195\/revisions\/206"}],"wp:attachment":[{"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/media?parent=195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/categories?post=195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aabirtech.com\/shiblenomanblog\/wp-json\/wp\/v2\/tags?post=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}