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
5
votes
4answers
120 views

How to write unit test for methods with a large number of parameters?

I am asking in case I run into this scenario in the future. Someone in my company wrote multiple methods with 25 parameters. I don't know how/why it got thru code review. I'm just wondering how ...
3
votes
2answers
378 views

Postman vs writing tests programmatically using curl or related vs unit tests

I am new to Rest API testing and this questions might be asked already. We are building a Rest API for our react applications using Laravel Framework (PHP). We want to test it but we are confused ...
3
votes
2answers
48 views

Should unit tests tests the same variety of sad cases as UAT tests?`

With UAT IT tests I frequently have some or all of the following types of tests: smoke (the page get at the endpoint loads), happy, sad, optional and audit. How many of these test types does it make ...
6
votes
6answers
111 views

mathematical/statistical relationship between tests and bugs?

As project manager, I would like to convince higher management to invest more time for development of unit tests for existing methods. My understanding is that unit testing is foundation/pre-req for ...
2
votes
4answers
375 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
320 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
37 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
67 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, ...
2
votes
2answers
477 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
96 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
38 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
774 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
563 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
53 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
145 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
68 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
124 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
92 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
982 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
86 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
362 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
774 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
349 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
442 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
59 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
593 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
169 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
44 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
39 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
55 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
144 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
436 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
104 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
519 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 ...