This question is locked. New answers and comments are not allowed.
We have a test that creates a web site using our proprietary tool. The test works great and includes a step to check to see if the website exists first and if not, to create it. If the web site already exists we mark the test as failed (and the rest of the test stops on Failure).
Now however, we'd like to do the same thing but not mark it as a failure if the website already exists. But we still want it to stop execution of the test.
So basically: Does site exist? If No, then create it. If Yes, then stop (but don't call it 'failed' just stop).
Here is the code we were using when we were calling it a failure, (this code works).
What do we replace the Assert.Fail with that will successfully stop the test while still marking it "passed"?
Thanks for the help.
Now however, we'd like to do the same thing but not mark it as a failure if the website already exists. But we still want it to stop execution of the test.
So basically: Does site exist? If No, then create it. If Yes, then stop (but don't call it 'failed' just stop).
Here is the code we were using when we were calling it a failure, (this code works).
[CodedStep(@"Be sure site does not already exist")]
public void CreateNewTemplateSite_CodedStep()
{
ActiveBrowser.RefreshDomTree();
List<
HtmlSpan
> elements = new List<
HtmlSpan
>(ActiveBrowser.Find.AllByCustom<
HtmlSpan
>
(x => x.InnerText == Data["NewSiteName"].ToString()));
if (elements.Count != 0)
Assert.Fail(string.Concat("Template site already exists: ", Data["NewSiteName"].ToString()));
}
What do we replace the Assert.Fail with that will successfully stop the test while still marking it "passed"?
Thanks for the help.