Skip to content

Xenon is a test framework which lets you to write stable acceptance tests in a fluent api manner.

License

Notifications You must be signed in to change notification settings

LiquidThinking/Xenon

Repository files navigation

Xenon

![Gitter](https://badges.gitter.im/Join Chat.svg)

Packages

###Visit the wiki for more details.

Documentation

Xenon is a test framework which lets you to write stable acceptance tests in a fluent api manner.

// if you are using nunit then 
// this tells xenon what method to call when you do XenonTest.Assert, only needs to be set once
XenonTestOptions.Options = new XenonTestOptions
{
	AssertMethod = Assert.IsTrue
};
		
//In your test
new XenonTest(new SeleniumXenonBrowser())
        .GoToUrl("http://www.google.co.uk")
        .EnterText("input[name='q']", "xenon test framework")
        .Click("button[name='btnK']")
        .Assert( a => a.PageContains("results") );

How To Use

There are two ways to use Xenon in your acceptance test. You can either directly create a instance of XenonTest as in the previous example or you can create a class inheriting from XenonScreen. So if we redo the previous example using XenonScreen then this is how we do it

public class GoogleHomeScreen : XenonScreen<GoogleHomePage>
{
	public GoogleHomeScreen(IXenonBrowser browser) : base(browser)
	{
		GotoUrl("http://www.google.com");
	}

	public GoogleSearchResultsScreen Search(string text)
	{
		return EnterText("input[name='q']", text)
		       .Click("button[name='btnK']")
		       .Switch<GoogleSearchResultsScreen>();
	}
}

public class GoogleSearchResultsScreen : XenonScreen<GoogleSearchResultsScreen>
{
	public GoogleSearchResultsScreen(IXenonBrowser browser) : base(browser) { }
}

[Test]
public void CanVisitGoogle()
{
	new GoogleHomeScreen(new SeleniumXenonBrowser(driver))
	.Search("xenon test framework")
	.Assert( a => a.PageContains("results") );
}

About

Xenon is a test framework which lets you to write stable acceptance tests in a fluent api manner.

Resources

License

Stars

Watchers

Forks

Packages

No packages published