Hot answers tagged

5

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 ...


4

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.


3

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 ...


3

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.


3

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 ...


3

The Test annotation goes outside of the test method. You've placed it inside. Try this: [Test] void myTestMethod() { ... 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 ...


2

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: using System; using NUnit.Framework; namespace SampleUnitTest { [TestFixture] public Class SampleTest { [...


2

You can use Assertions to verify something is in a certain state. Normally you compare the actual against the excepted state. Example usage: Do some steps in your application Gather the value of a field Assert that the value is indeed the value you expect Assert.AreEqual(Actual, Expected) This could give an assertion failure if Actual and Expected ...


2

Are you using Visual Studio Express? If so, perhaps the workaround described in this SO thread will work for you: https://stackoverflow.com/questions/13348613/nunit-runners-via-nuget-on-visual-studio-2012-express-doesnt-work Edit: The selected answer, which reveals the limitation of Visual Studio Express + Nunit As I've found out Visual Studio Express ...


2

After running my tests in NUnit GUI I can manually go into (Tools->Save Result as XML) then a file explorer is popped allowing me to select where the XML file is saved.


2

There is another tool to record page object model. below is the link: http://seleniumrecorder.blogspot.com/


2

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 ...


2

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> E.g. If your test has the following structure namespace TestsNamespace { public class TestsClass { //your tests ...


2

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 '...


2

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(...


2

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 ...


2

use Assert.That(User.HasProducts, Is.True, "I am failed because User.HasProducts not true") You will see the message I am failed because User.HasProducts not true if the test failed on this assert.


2

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 ...


2

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


2

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 { get { if (WebDrivers.Value == null) { ...


1

So, I ended up using FluentAssertion for assertions. FluentAssertion has this feature built-in.


1

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.


1

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.


1

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: 2.x: https://www.nunit.org/index.php?p=consoleCommandLine&r=2.2.7 3.x: https://github.com/nunit/docs/wiki/Console-Command-Line Looks ...


1

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: Category=SmokeTest&Category!=Remote.chrome Reference: https://stackoverflow.com/questions/40249366/specify-nunit-categories-with-tfs-vnext-...


1

Simplest solution is a try-finally block . At a higher level, you could write a decorator/annotation for this. Here's an SO answer in Java, and here's a blog post for C# showing how that might work.


1

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 ...


1

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 ...


1

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 ...


1

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 ...


Only top voted, non community-wiki answers of a minimum length are eligible