forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestErrorChecking.cs
25 lines (24 loc) · 1.14 KB
/
TestErrorChecking.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Threading;
namespace Selenium.Tests
{
[TestFixture]
public class TestErrorChecking : SeleniumTestCaseBase
{
[Test]
public void ShouldAllowErrorChecking()
{
selenium.Open("../tests/html/test_click_page1.html");
// These tests should all fail, as they are checking the error checking commands.
try { Assert.AreEqual(selenium.GetText("link"), "Click here for next page"); Assert.Fail("expected failure"); } catch (Exception) {}
try { Console.WriteLine("foo"); Assert.Fail("expected failure"); } catch (Exception) {}
try { Assert.AreEqual(selenium.GetText("link"), "foo"); Assert.Fail("expected failure"); } catch (Exception) {}
try { Assert.AreEqual(selenium.GetText("link"), "Click here for next page"); Assert.Fail("expected failure"); } catch (Exception) {}
try { Assert.AreEqual(selenium.GetText("link"), "foo"); Assert.Fail("expected failure"); } catch (Exception) {}
try { Assert.AreEqual(selenium.GetText("notAlink"), "foo"); Assert.Fail("expected failure"); } catch (Exception) {}
}
}
}