Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF & Specflow & Coded UI Tests: Exception when using Examples without an application restart
    text
    copied!<p>I am using Specflow and Coded UI Tests to check if input validation in a WPF application works as expected. I have a feature like the following:</p> <pre><code>@InputValidation Feature: Foo Scenario Outline: Bar Given I am in the input screen When &lt;input&gt; is entered into text box Then the text box has the status &lt;status&gt; Examples: | input | status | | "" | invalid | | "0" | invalid | | "42" | valid | </code></pre> <p>That works fine as long as I restart the application after each scenario block (AfterScenarioBlock("InputValidation")). Unfortunately this takes a lot of time during the nightly build because I have to start the whole application, do the input, check the status and close the application for each data set in the table. </p> <p>My problem is that I get an exception ("The Coded UI Test is running in Single Thread Apartment (STA) mode of COM. In this mode, all the playback calls should happen from the TestMethod thread only and UITestControl should not be shared across TestMethods.") when ever I try to use Examples without a restart.</p> <p>The reason for this seems to be, that Specflow generates a new TestMethod for each row in the example table. These methods have all different threads and thus can not access the same UI Element.</p> <p>I am not sure with this and thus wanted to ask if there is any other reason for this exception and if it is possible to use Examples without a restart or share UI elements between different test methods.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload