I am new to XUnit. I have bit knowledge to test a WebApplication using XUnit(Created Test class and open XUnit.gui->Open Assembly->TestApplication DLL and RUN). My question is how to test a website using XUnit? My project is created as WebSite and it doesn't have DLL.
1 Answers
There is a similar question relating to NUnit, and the answers there apply here too. The assemblies generated from code in the AppCode folder can't be referenced if they're only generated at run time. This answer shows how they can be generated at build time of your test project. However, as many people point out, you would be better off moving the logic you want to test into a business logic assembly or else converting the project to a Web Application.
Another possibility is to use Selenium to drive the web application through a browser and use the Selenium API in your XUnit tests. This allows for automation of end user tests, which are potentially more useful than just testing the business logic.
If you don't need to be using XUnit and are open to any testing framework, you could also check out Coded UI Tests, which enable a similar type of browser driving testing as Selenium when you use it on websites.

- 1
- 1

- 5,211
- 2
- 33
- 60