Questions tagged [unit-tests]

Unit testing is a method by which individual units of source code are tested to determine if they are fit for use. A unit is the smallest testable part of an application.

Filter by
Sorted by
Tagged with
4
votes
2answers
1k views

Asking for help with this Therac 25 bugged code. I don't understand the explanation

Therac 25 is a radiation therapy machine that lead to 3 deaths and 3 injuries in 1980s. That's the worst accidents in history which are caused by software bugs. In 1993, Leveson and Turner did a ...
8
votes
3answers
702 views

Exercises on software testing

I've been learning how to program in Python. I've passed the MIT course "Introduction to computer science, using Python" on edx.org. I can write small programs in Python. I want to become a tester. I'...
0
votes
2answers
266 views

Stop animations javascript and other front end work on page load with selenium

I have a flaky selenium spec because a notice disappears after page load because of a separate event that happens from polling the client or some other change. One solution would be immediately on ...
1
vote
1answer
40 views

Single unit testing for a single test case? [closed]

Do you first create a test case and then you create a unit test? Is single unit testing for a single test case and not many unit testing for a single test case?
1
vote
3answers
57 views

How does one unit test something that excludes everything except a finite set?

For argument's sake, pretend a URL can only contain letters, numbers, and underscores. How does one unit test a method that would check that a URL only contained those characters? Surely people aren'...
2
votes
1answer
496 views

New browser window every new iteration

I need to open every new iteration, new browser windows. For example: class GoogleTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.browser = browser_incognito....
1
vote
2answers
63 views

What is the correct, conventional name for a test written via BDD

If I have a class/object/component, and I test its API directly, in complete isolation, mocking/stubbing any complex parameters on which it depends, it's called a Unit Test. If I have a whole ...
-1
votes
1answer
117 views

Designing requirement-bases unit test cases for business components

Is it OK to verify business rule components in form of unit tests, or should unit tests only verify the design and low-level structures? Given we have a class that implements a specific business rule,...
15
votes
4answers
4k views

Documenting Unit Tests

We follow a BDD approach to development, we have our testers creating scenarios from a specification, and these are then given to our developers before any work is started. However, we find that some ...
3
votes
1answer
661 views

Using Scala to build unit tests for Java?

The idea of using Scala to build unit tests for Java code has been thrown around. People are making the claim that Unit tests would be less effort to write because there's less boilerplate. In ...
1
vote
1answer
531 views

Pretty / GUI formatting for the nosetests.xml xUnit report?

Is there a simple tool that will generate pie charts or otherwise "pretty", graphical output based on the .xml file that nose outputs with the --with-xunit switch? I tried googling around for one but ...
0
votes
1answer
568 views

CSS/XPATH selector management using python's dictionary

I have a lot of functional tests in Python. As expected , they use a wide variety of css/xpath selectors . I think I read somewhere that a practice is to have a dictionary where each selector would ...
10
votes
2answers
1k views

Implementing the Test Pyramid as QA

Recently I have begun building out Unit Testing for my dev team during down time in an attempt to implement the Test Pyramid. My Dev Managers seem rather excited about it and on-board with the idea. ...
5
votes
3answers
149 views

Is this a good simplification of fake object types?

With every unit testing text I get my hands on comes a little different terminology and more or less different definitions of various fake object types. I find that a lot of this differentiation is ...
1
vote
2answers
171 views

How can we avoid duplicates now that we stub out the database?

We have a great unit test suite in that it is very fast (many tests per second, not many seconds per test!). We also have automated UI (browser, selenium based) tests. However this now seems to have ...
4
votes
1answer
101 views

Automated Unit Testing

Imagine we have framework (any tool or language, BDD, Non-BDD) that both QA and Dev teams are using. Dev team would be writing and executing Unit Test cases and QA Team will be writing functional, ...
-1
votes
2answers
54 views

Name for testing routes, controller and views

I am currently writing tests for my Laravel 5.1 application and testing the workflow: input data from view to route to controller and back to view, typically checking for a DB record and a success/...
1
vote
3answers
5k views

How to automate multiple selenium test cases where one test case is dependent with another test case?

SCENARIO OF TEST CASE 1: Opens the browser Enters the username password Goes to home page Closes the browser SCENARIO OF TEST CASE 2: Home page should be testes so the baseurl for this case is ...
3
votes
8answers
5k views

How do testers perform unit testing?

I myself have no idea of how to code, so am I able to perform unit testing? Want answer in detail because I want to know how testers do unit testing.
-2
votes
1answer
94 views

What is a Unit Test? [closed]

When addressing an answer that had a flawed understanding of what a Unit Test is, I wanted to link to this question. But I found it didn't exist yet. What is a Unit Test? And for completeness: what ...
1
vote
1answer
163 views

How can I maintain test data in response[expected] against request[input] using java? How will it be if I use JBehave?

I have many scenarios to create request file that are sent to another application. This application processes the requests and sends back the responses. These responses should be validated against the ...
4
votes
2answers
109 views

Unit testing - what is a good way to do these quickly?

Unit testing currently takes up more than half my development time, and I'd like to streamline the process, are there any general tips or tricks that will help me write unit tests faster? I'm ...
0
votes
2answers
41 views

Should automated checks be agnostic of software configuration files?

Let's say we have a piece of Software, with a bunch of constants in a configuration file that sets certain arbitrary values, like a timeout of 300 seconds. Now we have a script for automated checks ...
1
vote
1answer
113 views

how to unit-test a MultiFiles iterator?

I have this class: public class MultiFilesIterator implements IMultiFilesMerger { private RandomAccessFile randomAccessFile; private int currentFileIndex = 0; int filesCount; @...
0
votes
3answers
163 views

GUI testing Tool or Unit Testing Tool

I have created some testcases. Where the test cases, test the functionalities are working fine and also test as the retrieved data are expected data that was displayed after you have clicked on the ...
0
votes
3answers
776 views

Are Unit Testing, System Testing and Component Testing subsets of User Acceptance (UA)?

I've read about UAT in Continuous Delivery by Humble. It is mentioned that UAT is a subset of user acceptance(UA). And in another article that we need to do unit testing, component testing, system ...
11
votes
4answers
5k views

Writing test cases before implementation?

So currently at my company it is common practice to write test case high level steps before implementation. Myself and others find this to be a somewhat wasted effort. I often end up blowing away much ...
0
votes
1answer
1k views

Unit testing with external files

I started writing unit tests recently and need to test reading fields in a spreadsheet (.xlsx and .xls), my biggest question is: Should I create a spreadsheet by code using Apache POI or use external ...
4
votes
3answers
843 views

Best Practice of Unit Test Entry Point

My company just started to practice Unit Testing (MS Test) on an ever-enhancing legacy system. The system is build with a core functions and developers are developing new features (by adding new ...
0
votes
1answer
69 views

Is this a good idea to test if text messages are exactly what they are?

I have been told that testing java exceptions' messages is a good thing, but it looks so much like redundancy that I cannot believe it. Consider following fictional code: public class ...
1
vote
1answer
2k views

TypeScript Unit testing tools? [closed]

What are unit testing tools used when we code typescript. What is the best and most efficient?
2
votes
1answer
72 views

Should assertions/expectations be solely in spec or test file?

I'm in the process of creating a unit test and I'm trying to optimize it by creating a helper file to replace some repeated code. In doing so some of my expects will end up in this helper file, as it ...
2
votes
4answers
685 views

Is unit and component testing sufficient?

If you can test every line of [your product's] code via unit tests, wouldn't unit testing alone (theoretically) be sufficient? Are there other "necessary" benchmarks of proper test coverage other ...
1
vote
1answer
299 views

Decoupling Unit Tests

I'm trying to learn how to write unit tests the 'proper' way and only test a specific component. (Using http://blog.stevensanderson.com/2009/08/24/writing-great-unit-tests-best-and-worst-practises/ ...
2
votes
2answers
229 views

How high level should be my unit-test?

I have a program with many classes. I manage the DI with Guice, btw. I wanted to write in-progress tests to my code (unit tests and higher level). I have few questions\difficulties: How high should ...
1
vote
2answers
92 views

Tool(s) for running C# tests with flow control

I have a collection of REST API tests, WebDriver based tests, Appium based tests and additional tests that run via shell. All written in C#. All tests are written as VS unit tests, and in the case ...
4
votes
1answer
457 views

Running unit tests on production build?

In one of the projects I am involved with, the team is running a continuous integration/continuous deployment and in development they have a bunch of unit tests as part of the nightly builds. When ...
0
votes
4answers
19k views

How can I do data parameterization in Selenium Web Driver?

I want my test case to run once and test n number of inputs at various positions. Suppose If I want to check a login screen for different members like manager,user,admin,e.t.c then instead of running ...
1
vote
1answer
54 views

How to avoid hidden bugs caused by test doubles?

I just got the Mockito framework for Java to try out mocking with JUnit. Trying it brought me to a basic question that I am sure is obvious but I have had trouble finding any answer for, probably ...
-1
votes
1answer
1k views

How to perform unit testing of embedded C code in CCS for MSP430G2553?

How to perform unit testing of embedded C code in Code Compose Studio (CCS) for MSP430G2553 target board?
5
votes
4answers
350 views

System integration testing

I had some questions around system/integration test. We have a development team and a full QA team, which does customer focused testing for our product. We want to introduce a middle test team which ...
2
votes
3answers
90 views

Framework which allows to execute unit test cases when function under test changed accordingly

Project (written on pure C language) under test has a lot of files with source code and a lot of unit test cases (more than million files and tests). And we don't want to execute all unit test cases ...
0
votes
1answer
447 views

Is there any tool to automate test for installers (WiX or InstallShield)

I was wondering if there is a way to define tests (something like unit test) for installers, specifically installers made in WiX and InstallShield.
2
votes
2answers
152 views

What should I be testing, aside from unit testing, in an agile environment?

The focus always seems to be on short stories and then the code that goes with them tends to have units tests. What other areas or levels should I be testing in? The context is for SaS (Software as ...
1
vote
1answer
1k views

I'm getting the exception “Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException” even though control is available

As the title says i'm getting this exception when running my coded U.I Test. Currently i've researched and i cant pin point on whether this is an issue with IE9 or with my program or even VS itself. ...
2
votes
1answer
173 views

What are typical unit tests for a key-value collection?

I've implemented a key-value collection, that's accessible as a dictionary (so values can be retrieved by keys) and a list of entries (key-value pairs). I'm not a tester myself and I have a hard time ...
0
votes
1answer
161 views

Android / Java Unit-Testing Clarification

While looking up for unit testing for Android applications, I came across a lot of voices over how it is difficult to test-unit an Android app. For example: Dependency issue - why is this a problem ...
7
votes
1answer
1k views

What are the tiers of testing that should be done on a large scale distributed system?

Let's say you have a large distributed system in the cloud that's got dozens of developers working on it and actively adding code to. Your job is to make sure all of the quality gates are used and the ...
5
votes
3answers
2k views

How do you test your unit-tests for false negatives?

How do you test your unit-tests for false negatives (tests that pass but should have failed). For example, I am writing a mission-critical class in JavaScript. To make sure every little nook and ...
2
votes
2answers
515 views

What does “all triples” test suite means?

Suppose there are 4 classifications namely: cancel,find_next,match_case,direction and 1 composition find_what with 2 classifications Attributes and cursor position. What will be the "all triples" ...