Questions tagged [testcase]

A test case in software engineering is a set of conditions or variables under which a tester will determine whether an application or software system is working correctly or not.

A test case is also defined as a sequence of steps to test the correct behavior of a functionality/feature of an application. A test case is a set of conditions or variables under which a tester will determine if a requirement upon an application is partially or fully satisfied. It may take many test cases to determine that a requirement is fully satisfied. In order to fully test that all the requirements of an application are met, there must be at least one test case for each requirement unless a requirement has sub requirements. In that situation, each sub requirement must have at least one test case. Generally Senior tester writes test cases and after verification and approval the junior testers carry out execution of test cases.

998 questions
149
votes
6 answers

Does MSTest have an equivalent to NUnit's TestCase?

I find the TestCase feature in NUnit quite useful as a quick way to specify test parameters without needing a separate method for each test. Is there anything similar in MSTest? [TestFixture] public class StringFormatUtilsTest { …
tjjjohnson
  • 3,270
  • 4
  • 31
  • 33
116
votes
6 answers

How do I specify a single test in a file with nosetests?

I have a file called test_web.py containing a class TestWeb and many methods named like test_something(). I can run every test in the class like so: $ nosetests test_web.py…
opstastic
  • 1,262
  • 2
  • 8
  • 6
85
votes
6 answers

Test cases in inner classes with JUnit

I read about Structuring Unit Tests with having a test class per class and an inner class per method. Figured that seemed like a handy way to organize the tests, so I tried it in our Java project. However, the tests in the inner classes doesn't seem…
Svish
  • 152,914
  • 173
  • 462
  • 620
72
votes
9 answers

NUnit TestCase with Generics

Is there any way to pass generic types using a TestCase to a test in NUnit? This is what I would like to do but the syntax is not correct... [Test] [TestCase] public void…
Russell Giddings
  • 8,731
  • 5
  • 34
  • 35
66
votes
13 answers

abstract test case using python unittest

Is it possible to create an abstract TestCase, that will have some test_* methods, but this TestCase won't be called and those methods will only be used in subclasses? I think I am going to have one abstract TestCase in my test suite and it will be…
gruszczy
  • 40,948
  • 31
  • 128
  • 181
55
votes
3 answers

Persist variable changes between tests in unittest?

How do I persist changes made within the same object inheriting from TestCase in unitttest? from unittest import TestCase, main as unittest_main class TestSimpleFoo(TestCase): foo = 'bar' def setUp(self): pass def…
A T
  • 13,008
  • 21
  • 97
  • 158
54
votes
8 answers

How do I put new List {1} in an NUNIT TestCase?

I have the method: public static int Add(List numbers) { if (numbers == null || numbers.Count == 0) return 0; if (numbers.Count == 1) return numbers[0]; throw new…
xaisoft
  • 3,343
  • 8
  • 44
  • 72
48
votes
4 answers

java.lang.NoClassDefFoundError:android and junit test

I saw that I'm not the only one having this problem but I don't find a correct answer. I have an android project that I want to test. I create a junit test class for each class of my project. My problem is when I run my test, I have the following…
helene
  • 1,201
  • 2
  • 18
  • 30
45
votes
2 answers

Testing for exceptions with [TestCase] attribute in NUnit 3?

How do I test for exceptions in a TestCase with NUnit3? Let's say I have a method Divide(a,b) defined as follows: public double Divide(double a, double b) { if(Math.Abs(b) < double.Epsilon) throw new ArgumentException("Divider cannot be 0"); …
Corpus Gigantus
  • 585
  • 1
  • 4
  • 7
44
votes
8 answers

@After ,@before not working in testcase

I have started testing and now i want to use @After, @Before and @Test but my application only runs the @Before method and gives output on console before However, if I remove @After and @Before it runs the @Test. My code is here: public class…
abhishek ameta
  • 2,326
  • 7
  • 28
  • 35
41
votes
1 answer

How to escape double quotes in as a parameter to an NUnit TestCase?

I tried writing the following TestCase for an NUnit test written in VB.net: ")> Public Sub GetNode_GivenSomeNodeId_ReturnCorrectNode(ByVal nodeId as String, …
Kjartan
  • 18,591
  • 15
  • 71
  • 96
37
votes
4 answers

Django UrlResolver, adding urls at runtime for testing

I'm looking to do some tests and I'm not really familiar with the URLResolver quite yet but I'd like to solve this issue quickly. In a TestCase, I'd like to add a URL to the resolver so that I can then use Client.get('/url/') and keep it separate…
jbcurtin
  • 1,793
  • 2
  • 14
  • 23
35
votes
5 answers

NUnit cannot recognise a TestCase when it contains an array

This is quite simple but annoying behaviour I am running into with NUnit: I have some tests like this: [Test] [TestCase( 1, 2, "hello" )] [TestCase( 3, 5, "goodbye" )] public void MyClass_MyMethod( int a, int b, string c ) { Assert.IsTrue( a < b…
glenatron
  • 11,018
  • 13
  • 64
  • 112
31
votes
8 answers

comparing querysets in django TestCase

I have a very simple view as follows def simple_view(request): documents = request.user.document_set.all() return render(request, 'simple.html', {'documents': documents}) To test the above view in my test case i have the following method…
Amyth
  • 32,527
  • 26
  • 93
  • 135
29
votes
6 answers

Writing a re-usable (parametrized) unittest.TestCase method

Possible Duplicate: How to generate dynamic (parametrized) unit tests in python? I'm writing tests using the unittest package, and I want to avoid repeated code. I am going to carry out a number of tests which all require a very similar method,…
astrofrog
  • 32,883
  • 32
  • 90
  • 131
1
2 3
66 67