Yes, you can use NUnit for functional testing. But still it is a unit-testing framework. No, you are not creating unit-tests by using a unit-testing framework to write functional tests. A unit-test is testing just a single methods input and output, by writing end-2-end tests it by definition cannot be a unit-test. :)
Unit testing frameworks are often ...
Although I have never used them, it seems Unity released their own set of testing tools.
See their introduction blogpost here.
See their examples here.
Get it from the Asset Store here.
Contains both Unit and Integration tests, for the UI tests, I think you need to use an image-based-testing tool like Sikuli.
Personally I would spit out an output log as well as the general test value. Then you can see the failure and go check the log. You can clear the log each time you run the test. Remember it's a unit test framework, not a test automation framework. Unit tests usually are very specific and not running tons of assertions all at once. The goal would be 1 ...
Test automation is not high-end coding. You will not become wealthy doing either test automation or unit testing.
Typically, unit-testing is not a separate job title. Experience with unit testing is more likely to lead to a career as a developer than Selenium automation. You are likely to make more money as a developer than as a tester.
I recently did my master's thesis on automated system testing of programs made with Unity. In my thesis, I evaluated some of the currently used methods and what tools can be used. I also proposed my own testing approach. You can read about it in my thesis here.
To quickly summarize I found that capture and replay tools can be used, but they offer very low ...
The Test annotation goes outside of the test method. You've placed it inside.
... your test code here ...
Also, the Test annotation may not work on a static method, or on a method with parameters. (I don't remember the details. It's been a while since I used C#.)
I'll bet there's another syntax error on the ...
Can any one explain Assert.AreEqual(true, true)
Verifies that two specified objects are equal. The assertion fails if the objects are not equal. Displays a message if the assertion fails.
example and explanation?
Very simple NUnit test:
public Class SampleTest
You can use Assertions to verify something is in a certain state.
Normally you compare the actual against the excepted state.
Do some steps in your application
Gather the value of a field
Assert that the value is indeed the value you expect
This could give an assertion failure if Actual and Expected ...
Are you using Visual Studio Express?
If so, perhaps the workaround described in this SO thread will work for you:
The selected answer, which reveals the limitation of Visual Studio Express + Nunit
As I've found out Visual Studio Express ...
I would always vote for hand-coding automated test over the use of Record and Playback. With programming test-cases its much easier to keep the tests DRY and if you think about maintainability of the tests up-front this will safe you a lot of time in the end. Some record and playback tools do support cutting up recordings in pieces and or replacing ...
You can run a single test from the command line using the nunit-console.
Open command-prompt and change directory to the NUnit bin installation folder.
To run a single test use:
nunit-console /run:TestsToRun <path_to_dll>
If your test has the following structure
public class TestsClass
//your tests ...
Is NUnit only a Unit testing framework?
NUint is a .Net port (commonly used with Visual Studio) of JUnit (which is commonly used with Eclipse). So it's different than the standard 'unit tests' in a VS project. Generally those unit test are testing each function of the application. xUnit tests do test through the UI level. I think your hangup is on the term '...
Check out the answer to this question over at StackOverflow.
(From the accepted answer) NUnit has few advantages over MS-Test
Suite attribute - can aggregate tests and execute them separately (useful for large projects with fast and slow tests for example)
Readable Assert method, e.g. Assert.AreEqual(expected, actual) vs Assert.That(actual, Is.EqualTo(...
It appears as though you are using a static instance for the close operation. I am not certain of the inner workings of your driver class but it is possible that this is causing the issue.
I would recommend using a non-static object for managing your driver in order to ensure that you are always accessing the same Session.
To do further debugging to ...
NUnit does not provide this feature. There is no feature to re-run only the failed test cases.
Would can do is start only a couple of tests from the command-line by their name:
--test=NAMES Comma-separated list of NAMES of tests to run or explore. This option may be repeated. Note that this option is retained for
backward compatibility. The --where ...
Retry only works on Assertion failures. You will have to write a custom Retry attribute that retries on Errors as well. Here is one way of doing it: https://stackoverflow.com/questions/46319701/nunit-retry-on-exception-by-default
You can try using the ThreadLocal Class, so each running thread would be assigned it's own webdriver instance.
See pseudocode to get the idea:
private static readonly ThreadLocal<IWebDriver> WebDrivers = new ThreadLocal<IWebDriver>();
public static IWebDriver Instance
if (WebDrivers.Value == null)
That was what I had previously believed also (because I've done dev) until my current position whereas the director is my source for this who actually sees the numbers. Although, maybe its more specialialist thing. You generally don't become wealthy as anyone's employee.
You could use NUnit3's TestContext that creates a TextWriter and save the output where ever you want.
I use Console.WriteLine() and read the Output in Visual Studio's Test Explorer (requires you have the NUnit3TestAdapter). This also works when I run tests via Bamboo. Anything written to the Console is saved in the Bamboo log.
You need to install the NUnit with the installer this installs the executables in your PATH. Just using the NuGet packages won't work.
How to run from the command line is documentation in the NUnit documentation:
A quick search gave what is probably the answer:
For NUnit, you need to use Category instead of TestCategory. You may also need to remove spaces - the examples online suggest that your TestCaseFilter should be:
Yes, your app is designed in a way it is really hard to test by a E2E script. Let's hope you started by having plenty of unit tests.
Use page object to provide services to your test. Then, start with creating few "happy path" tests exercising most commonly used functionality.
When done, start adding functionality which interrogates page object in which ...
Preparation and planning is the key.
"If I had eight hours to chop down a tree, I'd spend the first six of them sharpening my axe."
Try to create a quick map/sketch of the workflow
Define small methods/actions/steps that are reusable (in this case at least 12 steps)
In your defined methods use switch to decide when to change actions/data used
For every ...
I imagine your application to be somewhat analogous to an auto-insurance website.
Page 1: Fill personal info
Page 2: Fill vehicle info
Page 3: Fill previous insurance history
Page 4: Choose insurance type
Page 5: See Quote
There are validations to be performed in each page but you cannot move onto 'Page 2' without filling 'Page 1'. The approach you ...
It is better to use ids than XPath because XPath changes as elements are moved around the page, making your tests more fragile.
Can you see what the server is actually doing? Are you on the page you think you are or is it redirecting you?
I have had failures when clicking elements that had other elements overlapping them, I had to scroll the page ...