简体   繁体   中英

Testing an ASP.NET application (integration, unit) using BDD

I'm wanting to do some integration tests on our ASP.NET website. I'd like to run these tests:

  • Integration tests on a headless browser or selenium without having to rewrite code. Would like it to integrate with the Visual Studio 2012 Test Explorer.
  • Unit tests for C# code.
  • Unit tests for Javascript.

I liked the look of Jasmine and SpecFlow, but I'd like to limit the testing frameworks I have to learn. I also found Coypu , which looks like it may be useful, as it is a .NET alternative to Capybara .

What frameworks could cover these requirements?

Try testing Specifications rather than integration testing if possible - read 'Specification by Example' ( http://specificationbyexample.com/ ). SpecFlow is good for this in combination with Selenium (Coypu looks like a nice abstraction to put above Selenium).

Coypu looks cool thanks - didn't know about it!

With regards to your first bullet point, Coypu is an excellent web driver abstraction which makes it easy to switch between different web drivers. I've been using it to great effect in a corporate environment.

It's also fairly trivial to configure it to use the PhantomJS headless webkit browser. See this link for how to do so.

Also a C# library I have found invaluable for unit testing is Fluent Assertions . Its fluent style nicely complements technology agnostic BDD tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM