Hot answers tagged

8

As a general rule of thumb, everytime a test fails or has an indeterminate outcome it requires investigation. If you ignore a failing/indeterminate test then you increase the risk of missing or overlooking a bug. The value of automation is to execute tests that we deem important enough that we want to run them repeatitively, or tests that are executed more ...


6

A heavier weight solution that may net you more flexibility/control in the end is to run all your tests in a VM on your local machine. With a VM, it's fairly easy to setup snapshots so you can be sure that you're resetting your testing environment to a specific, known point every single test run. That's freakin' nice. You can minimize the VM window and ...


5

I've found that the deleteAllCookies function works differently in different browsers. DeleteAllCookies will delete all session data in Chrome, but only cookies in firefox. I'm still looking for a good way to delete session data in FF


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

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

I have a somewhat similar setup, however we decouple our non unit tests (Anything requiring an install to a server) from the typical unit tests which can run directly on the team city build server. In my solution we created a windows service polling team city for new builds via the rest API and when we find a new build we add it to the queue to execute our ...


3

The EventListener is the way to go. However there is a knack: the UnhandledException will not be fired when an Assertion in your test fails. Rather use the TestFinished event to handle failed tests: public void TestFinished(TestResult result) { if (result.Executed && result.IsFailure) { Console.WriteLine(string.Format("Failure in ...


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

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

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

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

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

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

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

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

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

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

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