Docs · API reference · Motus.Testing.MSTest

MotusTestMethodAttribute Class#

A test method that is run again when the browser goes away underneath it.

public class MotusTestMethodAttribute : Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute

Inheritance System.Object → System.Attribute → Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute → MotusTestMethodAttribute

Remarks#

A browser that dies mid-test takes the verdict with it. Nothing was established about the page, and what the run reports is a connection closing rather than anything the test set out to check. Browsers do occasionally die, more often on shared build hardware than on a desk, and a red build that a second run turns green is how a team learns to stop reading red builds.

Only a lost browser is run again. A failed assertion is a result, and repeating it until it agrees would hide the very thing the suite exists to find.

The attempt that follows gets a browser of its own: the fixture starts replacing the dead one the moment it sees the disconnect, and MotusTestBase waits for that to finish while building the next context.

Constructors#

MotusTestMethodAttribute() Constructor#

Applies to a test method directly, in place of [TestMethod].

public MotusTestMethodAttribute();

MotusTestMethodAttribute(TestMethodAttribute) Constructor#

Wraps another kind of test method, so what that one does is kept and only the retry is added.

public MotusTestMethodAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute? inner);

Parameters#

inner Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute

Properties#

Retries Property#

How many further attempts a lost browser is worth. Zero runs the test once, whatever happens.

public int Retries { get; set; }

Property Value#

System.Int32