test-suite

Unit Testing Interfaces in Python

拈花ヽ惹草 提交于 2019-12-09 17:43:18
问题 I am currently learning python in preperation for a class over the summer and have gotten started by implementing different types of heaps and priority based data structures. I began to write a unit test suite for the project but ran into difficulties into creating a generic unit test that only tests the interface and is oblivious of the actual implementation. I am wondering if it is possible to do something like this.. suite = HeapTestSuite(BinaryHeap()) suite.run() suite = HeapTestSuite

Running JUnit test suite from inside Eclipse

落爺英雄遲暮 提交于 2019-12-08 09:31:48
问题 Historically, I've always written my unit tests like this: public void WidgetTest { @Test public void test_whatever() { // Given... // When... // Then... } } This allows me to right-click my test file in Eclipse and Run As >> JUnit , and test that 1 particular test, directly from inside Eclipse. Then, when doing a local (Ant-based) build, I configure a <junit> Ant task to run all of my src/test/java tests at once. I'm now looking for an in-between solution. That is, a way to run all of my

Add Test Case to ITestSuiteBase in TFS API

一笑奈何 提交于 2019-12-07 06:30:43
问题 I'm working with the TFS API and have run into a problem with ITestSuiteBase and IRequirementTestSuite. I've mananged to easily create a new test case within a IStaticTestSuite: IStaticTestSuite workingSuite = this.WorkingSuite as IStaticTestSuite; testCase = CreateTestCase(this.TestProject, tci.Title, tci.Description); workingSuite.Entries.Add(testCase); this.Plan.Save(); However, this solution doesn't work for requirements test suites or ITestSuiteBase. The method that I would assume would

Instantiate Python unittest.TestCase with arguments

拈花ヽ惹草 提交于 2019-12-06 18:28:05
问题 I would like to iterate over a list of items, and run an assertion on each of them. One example might be checking whether each number in a list is odd. TestCase : class TestOdd(unittest.TestCase): def runTest(self): """Assert that the item is odd""" self.assertTrue( NUMBER %2==1, "Number should be odd") Test suite : if __name__ == '__main__': suite = unittest.TestSuite() suite.addTest(TestOdd()) # I would like to have: # suite.addTest(TestOdd(1)) # suite.addTest(TestOdd(2)) # suite.addTest

Can I get statistics for test cases steps inside robot framework?

自作多情 提交于 2019-12-05 07:58:52
问题 In order to optimize time of execution, i create some test cases dependent from each other i want to get metrics and statistics not only for each testcase and testsuite. But also i want to generate statistics and metrics for each step. Is that possible ? PS : I'm using team city for continuous integration. Best regards, Emna A. 回答1: Using robot framework api we can get TEST and KEYWORD Metrics Reference: Link API: class robot.result.model.Keyword class robot.result.model.Test Keyword Metrics

Parameterized unit test suites

余生长醉 提交于 2019-12-05 02:45:18
I am trying to set up some parameterized test suites, unfortunately without any luck so far. I have two set of parameters, and I would like to run multiple test cases (they are in different classes) with all possible combinations. I tried to do it with JUnit4, but I am unable to set it up correctly. This would be my basic idea: TestSuite1.class sets up one set of parameters, then it starts TestSuite2.class . TestSuite2.class sets up the second set of parameters, then it starts the actual test(s) that will use both parameters. Meanwhile it seems it is not possible to set up both Suite.class and

test suite inside spring context

淺唱寂寞╮ 提交于 2019-12-05 00:17:48
问题 Is it possible to run test suite with loaded spring context, something like this @RunWith(Suite.class) @SuiteClasses({ Test1.class, Test2.class }) @ContextConfiguration(locations = { "classpath:context.xml" }) <------ public class SuiteTest { } The code above obviously wont work, but is there any way to accomplish such behavior? This is currently how spring context is used in my test suite: @BeforeClass public static void setUp() { final ConfigurableApplicationContext context = loadContext

Instantiate Python unittest.TestCase with arguments

…衆ロ難τιáo~ 提交于 2019-12-04 23:59:11
I would like to iterate over a list of items, and run an assertion on each of them. One example might be checking whether each number in a list is odd. TestCase : class TestOdd(unittest.TestCase): def runTest(self): """Assert that the item is odd""" self.assertTrue( NUMBER %2==1, "Number should be odd") Test suite : if __name__ == '__main__': suite = unittest.TestSuite() suite.addTest(TestOdd()) # I would like to have: # suite.addTest(TestOdd(1)) # suite.addTest(TestOdd(2)) # suite.addTest(TestOdd(3)) # ... unittest.main() How can I instantiate a TestOdd object with an argument - for example,

Unit Testing Interfaces in Python

牧云@^-^@ 提交于 2019-12-04 06:49:28
I am currently learning python in preperation for a class over the summer and have gotten started by implementing different types of heaps and priority based data structures. I began to write a unit test suite for the project but ran into difficulties into creating a generic unit test that only tests the interface and is oblivious of the actual implementation. I am wondering if it is possible to do something like this.. suite = HeapTestSuite(BinaryHeap()) suite.run() suite = HeapTestSuite(BinomialHeap()) suite.run() What I am currently doing just feels... wrong (multiple inheritance? ACK!)..

Can I get statistics for test cases steps inside robot framework?

醉酒当歌 提交于 2019-12-03 20:58:17
In order to optimize time of execution, i create some test cases dependent from each other i want to get metrics and statistics not only for each testcase and testsuite. But also i want to generate statistics and metrics for each step. Is that possible ? PS : I'm using team city for continuous integration. Best regards, Emna A. Using robot framework api we can get TEST and KEYWORD Metrics Reference: Link API: class robot.result.model.Keyword class robot.result.model.Test Keyword Metrics Code: # Keyword Metrics Code: (save following snippet as python file and execute) from robot.api import