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
11
votes
1 answer

How to write unit test case for BadRequest?

I want to write Unit test cases for following code HomeController.cs [HttpPost] [ActionName("CreateDemo")] public async Task CreateDemo([FromBody] MyRequest request) { if (request == null) …
Neo
  • 15,491
  • 59
  • 215
  • 405
11
votes
4 answers

In TFS, how do I find all Test Cases in a Test Suite with a query (C#)?

With Team Foundation Server, given a WorkItem of type "Test Suite," how can I write a query to select all Test Cases associated to that Test Suite?
whoknows
  • 395
  • 2
  • 4
  • 17
11
votes
3 answers

how to add dozen of test cases to a test suite automatically in python

i have dozen of test cases in different folders. In the root directory there is a test runner. unittest\ package1\ test1.py test2.py package2\ test3.py test4.py testrunner.py Currently I added the four test cases manually…
stanleyxu2005
  • 8,081
  • 14
  • 59
  • 94
10
votes
2 answers

@Before and @After not working with JUnit 5 on Eclipse 2018-12 JAVA

I just created a test class from File->New->JUnit Test Cases and this is my whole code: import static org.junit.jupiter.api.Assertions.*; import org.junit.After; import org.junit.Before; import org.junit.jupiter.api.Test; class TestingJUnit…
Aashir Haque
  • 153
  • 1
  • 2
  • 12
10
votes
4 answers

Junit test case for database insert method with DAO and web service

I am implementing a webservice based university management system. This system adds certain courses to database. here below is the code that I am using. Course.java public class Course { private String courseName; private String location; …
energycycle
  • 194
  • 1
  • 3
  • 9
10
votes
3 answers

How do I create Android test suite which only runs specified tests in one or more classes?

Can someone shed some light on how to organize tests in test suites, using JUnit in Android? I find almost all examples to be non-working, and I'm wondering what it is that I'm not getting. I've made a small example with an AndroidTestCase class…
user1341676
10
votes
1 answer

Django: Get cookie inside test case

I have a view that sets a cookie using response.set_cookie method. I would like to test if the cookie is being set in a TestCase. According to docs, the cookie should be accessible in the client object, but client.cookies.items returns an empty…
Marco Lima
  • 103
  • 1
  • 6
9
votes
5 answers

Giving parameters into TestCase from Suite in python

From python documentation(http://docs.python.org/library/unittest.html): import unittest class WidgetTestCase(unittest.TestCase): def setUp(self): self.widget = Widget('The widget') def tearDown(self): …
user278618
  • 19,306
  • 42
  • 126
  • 196
9
votes
4 answers

Laravel TestCase not sending Authorization headers (JWT Token)

Summary We are writing unit tests to test the creation and invalidation of JWT tokens and receiving a "The token could not be parsed from the request" error back from a JWTException every time we try to JWTAuth::invalidate the…
gvhuyssteen
  • 292
  • 7
  • 18
9
votes
1 answer

Django TransactionTestCase with rollback emulation

I'm using Django 1.7.7 with python 2.7.6 and Postgres as database and I had a problem with a TransactionTestCase. In my migrations I had two datamigrations and I wanted them to be available during the tests, so I added serialized_rollback = True to…
se7entyse7en
  • 4,310
  • 7
  • 33
  • 50
9
votes
2 answers

Is it OK to assert in unittest tearDown method?

I have a TestCase with multiple tests and need to assert a few conditions (the same for every test) at the end of each test. Is it OK to add these assertions to the tearDown() method, or is it a bad habit since they're not "cleaning" anything? What…
knaperek
  • 2,113
  • 24
  • 39
9
votes
5 answers

JUnit TestCase object instantiation

Is a new (or different) instance of TestCase object is used to run each test method in a JUnit test case? Or one instance is reused for all the tests? public class MyTest extends TestCase { public void testSomething() { ... } public void…
Manki
  • 3,779
  • 4
  • 25
  • 18
9
votes
4 answers

How to write Test Cases?

I want to learn how to write test cases before writing the code. I read an article about test-driven development. I wonder how developers write test cases? For Example this method: public int divideNumbers(int num1, int num2) { return…
cihadakt
  • 3,054
  • 11
  • 37
  • 59
8
votes
2 answers

How to use TestCase in NUnit 2.5?

I have a Currency class which I persist to my database using NHibernate. Currency class looks like this: public class Currency : Entity { public virtual string Code { get; set; } public virtual string Name { get; set; } public virtual…
Mark Allison
  • 6,838
  • 33
  • 102
  • 151
8
votes
2 answers

Restart failed test case automatically in TestNG/Selenium

I am using Selenium webdriver, in Java with TestNG to run an X amount of test cases. What I would like, is for any test case to automatically restart (either from starting or from point of failure), as soon as it fails. I know TestNG framework has…
MostWanted
  • 571
  • 1
  • 5
  • 12
1 2
3
66 67