Unit test and Web test on the .NET Framework? - unit-testing

I would like to know what a Unit test and Web Test is in the .NET Framework and What are the difference between these tests? and How does it affect with the implementation of the CSLA.NET? Please help, thanks!

I guess you're referring to using MSTest under Visual Studio where they have two modes - testing of code or testing of web site via http calls.
When developing in .NET a developer can choose from several Unit Testing Frameworks such as MSTest - NUnit, MBUnit, XUnit etc. for more information have a look at this question.
The term Unit Testing refer to a broader field - you can read about it here.
Unit testing refers to the programmer writing simple small tests to verify his code actually work and as such does not effect the implementation of CLSA.NET.

I would like to know what a Unit test
and Web Test is in the .NET
Do you mean, what unit tesing frameworks are there for .NET ? I recommend you NUnit

Related

Unit and integration testing in web development is different?

I am pretty confuse with unit and integration testing of traditional software development and web development. I have seen many different answer and explanation of it.
The Web Engineering textbook says about unit and integration testing for web application:
Unit testing: Testing on single web page as opposed to testing single function
Integration testing: Testing on flow of data from one web page to another (and linkage)
while the software engineering textbook defines unit testing and integration testing as followed.
unit testing: Testing on smallest unit
integration testing: Testing on interaction between unit or module
Hope someone can clarify to me which is the correct one.
The "web engineering" textbook is... likely wrong. That's not what those words mean to most folks.
Unit testing: testing the smallest possible bits of functionality, independently. For Java, something like the JUnit framework is used to do this. You often try to test just one class, and you may fake it's dependencies using something like Mockito, so you're really testing just one thing.
Integration Testing: testing several parts of the system together. This may be a small integration test (testing multiple classes without mocking), or something large, like making sure that your webserver is connecting to a database correctly.
End-to-End Testing: the biggest Integration test; this is basically standing up every part of your system and running scripts that look like fake users. Selenium is a tool used for this.

Unit Testing for Marklogic

We are looking for a framework to test our MarkLogic XQuery code.
We can see MarkLogic/XQunit is a good framework, but it does not have code coverage feature.
What is the best framework to write unit test cases for MarkLogic XQuery?
Two unit test frameworks I've seen used in practice are XRay and Roxy Unit Test (note that Roxy Unit Test is part of a larger project, consisting of the Roxy Deployer, MVC structure, and Unit Test; the Unit Test feature will be easiest to use if you're also using the Deployer). Roxy can test XQuery and Server-side JavaScript code.
I'm not aware of any tool that provides code coverage at this time.
Edit: Rob Rudin has made the Roxy Unit Test framework more accessible to gradle projects: https://github.com/marklogic-community/ml-unit-test.
Edit 2: ml-unit-test now offers an experimental code-coverage feature

How can I test EJB 3.0?

I am using EJB 3.0 , Oracle WebLogic.
Need help in the following question :
How to test EJB (3.0) ? I mean unit tests and/or integration tests ? Can I use some kind of embedded EJB container or create a mock for it to write unit tests ? Maybe there is some special test frameworks or aproaches? EJB aren't new for me, but I have never written tests for them.
Any information will be useful for me .
Thanks.
One option is using embedded container. Starts up on every test execution, you have to get your beans through jndi lookup, manage container's configuration yourself and all kind of boring, unproductive stuff.
On the other hand, there are frameworks like Arquillian, that do the thing for you. It supports annotations like #EJB in tests and does DI, manages container.... Read the guide on their website, its worth it.
From my experience, mocks are a no good solution for complex ejb testing, even though it may work on testing some non-container dependant functionality.
My advice is going on it with arquillian.
I would try to use plain junit and mockito as much as possible to test small units of code and use embedded containers only for integration tests as these kind of tests are running much longer as simple unit tests. And for developers running the unit tests should never get annoying.
An embedded EJB Container used in junit tests is a good idea to integration test your servies & ejbs.
Using open-ejb (or any other embedded container like glassfish etc.) helps you to simple write small tests using junit as framework. Even JPA is integrated very well, using a memory database.
If it comes to mocking, let's say for remote services, you may still use mockito inside.
Find some documented & runnable examples here: https://tomee.apache.org/examples-trunk/

Unit Testing for the web?

I have been doing a lot a reading about unit testing.
Unit testing seems all well and good.
But it seems to miss a lot of the fundamentals of how the web works. User Interaction.
I have not seen any way a unit test could test for unexpected input, or test to make sure that an ajax call works etc.
Am I missing something here or is unit testing not really designed well for web development?
You are not missing anything.
Ideally unit testing is about testing a small piece of code, e.g. a class in isolation. For this you may want to use a unit testing tools such as JUnit or NUnit. Some people refer to this type of tests as developer tests.
In contrast to that you may want to test web applications as a whole. Some call this acceptance testing. For the latter you could use a tool such as Selenium. Tools like Selenium can test Ajax and other JavaScript as well.
You have even more options if you take a look at a tool like WebDriver as you will find that you can implement Selenium-based tests using a unit testing tool.
Take a look at Selenium.

Silverlight unit testing (using NUnit)

I'm using NUnit for testing back-end. Unit tests are being executed while building (I'm using TeamCity for continuous building).
Now I hove to test front-end (Silverlight 4.0). Because the tests are being executed while building, I have to simulate browser (TypeMock - is not free, isn't it?) could I use NUnit.Mocks somehow?. How to use NUnit for Silverlight testing? I've found WHITE framework could it help?
Any other advises about software/frameworks to use for Silverlight unit testing?
Check out StatLight...
"StatLight is a tool developed for automating the setup, running, and gathering results of Silverlight unit tests. StatLight helps to speed up the feedback cycles while practicing TDD/BDD/(insert your test style here) during Silverlight development."
http://statlight.net/
As an alternative, here is an nUnit port for Silverlight:
http://greenicicleblog.com/2010/04/27/nunit-for-silverlight-updated/