Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
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 ...
3
votes
3answers
565 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-...
3
votes
2answers
116 views

Testing internal dependencies - inject a mock of itself, or refactor into new class?

I've been given the task of refactoring some legacy code, the main reason is to add unit tests (but I'm a firm believer that testable code is better code, so we're trying to reduce technical debt too)....
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 ...
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)...
3
votes
1answer
233 views

What kind of Software testing(Black-box or White-box) is done by django testcase classes?

In my django application, i haven't use model for database. I have traditional way of doing it, that is by mysql server and client. I have used MySQLdb for database access. Also in my django views, ...
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
1answer
50 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 ...
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
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
1k 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/...
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
89 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 ...
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 ...
2
votes
1answer
354 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
447 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. ...
4
votes
1answer
245 views

What to use for user acceptance testing for a single page application?

The app uses a javascript framework to update the single page. Ajax is used for data updates How I can automate user acceptance testing for it? Usually I use selenium through through the capybara ...
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 ...
5
votes
1answer
8k views

Try Assert Exceptions not failing test in python unittest or better way to loop through failures

Okay I am running Chromedriver test that gathers console logs and then tests an assertion against pythons unittest. class ConsoleLogsTest(unittest.TestCase): @classmethod def setUpClass(cls)...
7
votes
3answers
594 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'...
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
1answer
136 views

What is best practise for Data Contract management?

We are implementing a testing framework, covering areas like mentioned in this SE article. But in addition, as part of unit testing (probably), we want to perform data contract testing. The database ...
4
votes
1answer
77 views

Correct aproach to test this method

Overview: The problem I'm trying to solve is - I have some canceled orders in my database that I need to call a government WebService to disable the fiscal numbers associated with these orders. The ...
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 ...
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 ...
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'...
4
votes
2answers
2k views

python unittest trying to run setUpclass

I am on a website where you login, then search for course, click on course and then it lands on the Credit card page, since its just one course and is common and I am just trying to run DDT on CC ...
2
votes
1answer
438 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....
3
votes
3answers
779 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 ...
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,...
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?
3
votes
1answer
364 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 ...
0
votes
2answers
170 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
2answers
146 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 ...
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. ...
4
votes
1answer
98 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
vote
3answers
4k 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 ...
-2
votes
1answer
86 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 ...
3
votes
8answers
4k 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.
1
vote
1answer
156 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 ...
2
votes
7answers
215 views

Should developers design unit based test cases prior to writing the tests

Background We are currently moving API testing from the Technical testing team to the development team. The technical testing team has a formal process where they write the test objectives and test ...
4
votes
2answers
108 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 ...
-1
votes
2answers
53 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
6answers
288 views

Will writing unit tests block developers from coding?

We are about to implement TDD in our software company and we met some serious questions. As you know, this is the TDD life cycle: Add a test Run all tests and see if the new test fails Write the ...
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
98 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; @...