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
2
votes
4answers
309 views

Why do unit testing if it doesn't find many bugs?

I was wondering if unit testing is effective in finding bugs or if that is not one of its major goals at all. We wrote unit tests for many business rules over time and after a few months we did not ...
0
votes
1answer
269 views

Automation Testing the python code for Autonomous Driving Environment?

I am newbie to testing world. I am currently working on automation testing for a python code in the environment of Autonomous Car Company, is Robot Framework suitable for that? else which is the best ...
1
vote
1answer
36 views

How to test amazon boto email service used in django?

In my Django application, I am using the Amazon boto email service for sending messages to my clients. I am doing the testing of view function which will send the email. Now I am getting confused ...
2
votes
1answer
64 views

How to create unit tests for Web app with a database

I'm currently adding unit testing to my project and came across this question, How can I test my database insertion. For example, let's say I have a user table, I want to test if I can create a user, ...
1
vote
2answers
444 views

Advantage of python unit test in selenium

Hi I started building up automation suite using selenium with python. As most tutorial used python unit test framework. I have 5 scenarios of testing login page. Next 50 or more test are going to be ...
-1
votes
1answer
94 views

How to do unit test of 16 digit Generated Random number [closed]

Here i'm facing one problem that i have to do unit testing of 16 Digits of Generated Random( 9872 5432 8765 0987, 9852 7412 6587 2365.........n) number so these Random Number are generated from Sql ...
0
votes
1answer
40 views

Step based unit testing

I've just joined a startup and would like to add some automated testing for some basic processes. I'd like something that's step based, i.e. run a step, test the output in some arbitrary way, and then ...
2
votes
1answer
37 views

Split roles for devs doing feature implementation and integration testing?

I'm looking out for patterns how to more effectively bring QA topics into our agile product development team. One idea is to let one developer do the implementation with TDD (so alongside unit tests) ...
1
vote
2answers
3k views

How to setup a Headless-Browser Unit-Test for Angular application?`

I do have an angular Application where I also run a test ng test --sm=false. It works fine and I get the result in Chrome Browser. The issue is to be able to run a headless test because the App will ...
3
votes
3answers
713 views

Where do Fitnesse fits between unittests and API testing?

Our team writes unittests for our python projects. Besides that, we have a tool that allows us to run scripted API tests (we can make requests and evaluate the result, passing or failing the test). I ...
3
votes
3answers
495 views

Naming a positive “happy path” test case

We have a rather reach set of unit tests for our Python/Django backend. Most of the tests contain a one or more "happy" path tests and a lot of "negative" test cases checking the validation, error-...
0
votes
2answers
51 views

How to schedule to run all unit tests?

I need to manage executing all unit tests on build server. Is there any idea about when is proper to run all of the unit tests on the build server. There are too many of them, and it will take hours ...
28
votes
9answers
4k views

With good unit tests, do I also need acceptance tests?

Given I have written good unit tests for business rule units of a system. Is it still needed to write acceptance tests that target verifying those business rules implementation?
4
votes
3answers
84 views

Test Case for Each Unit Test?

It seems highly impractical to have a test case/ticket for every unit test; however, the only experiences I have to draw from are from college, and an internship -both of which stressed having each ...
3
votes
2answers
144 views

Should I use more than one assert in this scenario?

The method down below creates an user within my application and I check the outcome with two if's. public function register($request, $response) { // code if(isset($new_user->body->ok)...
5
votes
2answers
2k views

Pros and cons of python unit testing packages

I am starting on my first large scale python project and I want to put the right testing package in place not only to get the job done but also so when hiring people down the road it's easy to find ...
2
votes
1answer
2k views

Improving my Unit testing: How to test simple methods that call internal methods, resulting in complex (yet similar) output

I've got data access layer that has two types of method GetLatestX and GetX. GetLatestX looks something like this: public IElementType GetLatestElementType(Guid id) { IElementType ...
4
votes
3answers
2k views

Creating a dummy database for automated functionality testing

I have a continuous integration build server (using Team City). When people check code in, I'd like to run a set of tests which run through a set of functional cases such as: Using an administrator ...
3
votes
1answer
49 views

Testing a public method that performs action/mutation of private fields

I've got a class with a private collection _blockRegister, and a method that mutates this collection RegisterBlockType: public class FileBlocksParser { private readonly Dictionary<uint, ...
1
vote
1answer
67 views

What should i test while fetching data from the database?

I am using django python framework for building web application. I am new to testing and i have lot of doubts. Consider my statements below and please let me know whether am i right or not? Consider i ...
1
vote
1answer
122 views

Which conditions have to cover in White box testing?

During white box testing which conditions have to be tested? Consider a post request with integer data. In the function, I will convert that post data (string type) to an integer type. I am using ...
3
votes
2answers
91 views

How do you test your scripts?

I'm looking for ways to test my scripts and some patterns you use/recommend. For instance, how would you test a script such as this one: #!/usr/bin/env bash build="$1" # check that build number is ...
3
votes
2answers
795 views

Getting warning from unit test

I get a warning from this test but I don't know how to handle it. The warning is /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/...
5
votes
2answers
252 views

How do I reasonably unit test calendrical calculations?

I've written some code that performs some action, depending on the day of the year and the year. There are an infinite number of years, hence an infinite number of days? What's a good way to unit ...
0
votes
0answers
45 views

Are emulators good enough for testing websites on mobile browsers? [closed]

I have made a website. I visited the same website on different mobile browsers and getting some UI error and a button is not working correctly. How can I test my website to get over from this problem??...
0
votes
5answers
83 views

Real data sets testing

Say a database has a listing of states and abbr. An application is creating invoices. Who 'owns' testing the quality of the data in the database: QA, Application, BA? Would an application test all ...
3
votes
1answer
337 views

Test input and expected output with Unity

I'm trying to automate some tests with Unity. For example, I have a C program that works like a very basic calculator with operations such as division, etc. I would like to automate the test ...
2
votes
1answer
2k views

What can I unit test in a mobile app?

Some background first: we're developing custom mobile apps, most of them tailor made for B2E scenarios. At the moment, we're only testing manually. I know some people consider this a cardinal sin, but ...
1
vote
2answers
745 views

Selenium Testing in Android Devices without USB connection

How can I do my selenium testing by opening the browser in android device from my PC, without connecting through USB?
2
votes
1answer
292 views

Uncertain as how to test complex method

I have a class which handles when a CardView's drag gets started. I've been looking at tutorials for JUnit and I can't seem to find out how to start testing this method. public class ...
11
votes
6answers
430 views

How can testers motivate developers to write unit tests?

Unit-testing, oftentimes, is thought of as a burden and not exciting at all - more code to write, configure and maintain which requires time which results into delays in delivering features or fixes. ...
5
votes
1answer
57 views

How to unit test the plethora of js frameworks?

There's a bunch of popular javascript frameworks such as Angular React Vue Ember Meteor What tools exist for unit (white box) testing each of them? Does each framework support its own unit testing ...
1
vote
1answer
1k views

Unit Testing: Windows Forms using MS Visual Studio 2008

I've created unit tests of my WinForms using MS Visual Studio 2008. None of my tests have been approved. All of them (0/42 tests) resulted into some kind of failure described as follows:- System....
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 ...
7
votes
3answers
569 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
155 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 ...
2
votes
2answers
42 views

I'm a little confused on how unit tests run in Rails (or an MVC Framework)

So I'm starting to learn how to write unit tests, and I'm starting with Rails (I've fixed a few Rspec tests to start, but now I'm writing Javascript ones). I understand at least the basics of an MVC ...
1
vote
1answer
38 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
50 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'...
6
votes
2answers
143 views

Are there some well known nasty pitfalls to try to avoid at all costs when starting with unit testing on a “legacy” web application?

I am participating on the development of the web application which has several years of history behind it and there never was enough value and effort put on refactoring, so considerable part of the ...
2
votes
1answer
397 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
57 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
103 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
3k 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
511 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
538 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 ...
8
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. ...
15
votes
4answers
321 views

If I didn't use TDD but want to transition to agile, should I go back and create those unit tests?

In an transitioning agile environment, if there was no Test Driven Development (no unit tests created), should you create unit tests to catch up on technical debt? and to what extent? Should ...
5
votes
3answers
135 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 ...