want to run junit test cases sequentially and parallel also. some test cases are independent so those test cases are need to run sequentially but some test cases are not dependent they have to run parallel.  is this possible through junit ? if yes how it is possible ?
38439
I'm using JUnit 4.4 and Maven and I have a large number of long-running integration tests.  When it comes to parallelizing test suites there are a few solutions that allow me to run each test method in a single test-class in parallel. But all of these require that I change the tests in one way or another.  I really think it would be a much cleaner solution to run X different test classes in X threads in parallel. I have hundreds of tests so I don't really care about threading individual test-classes.  Is there any way to do this?
90445
Is there a way to fall through multiple case statements without stating case value: repeatedly?  I know this works:  switch (value) {    case 1:    case 2:    case 3:       // Do some stuff       break;    case 4:    case 5:    case 6:       // Do some different stuff       break;    default:        // Default stuff       break; }   but I'd like to do something like this:  switch (value) {    case 1,2,3:       // Do something       break;    case 4,5,6:       // Do something       break;    default:       // Do the Default       break; }   Is this syntax I'm thinking of from a different language, or am I missing something?
106072
I'm looking to try and run the same stored procedure multiple times with different parameters but at the same time.   I'm using SQL 2014  The reason for this is that the procedure takes around 7 hours to complete. It actually does the same process many times. So for instance it might build a new database and tables for each branch.   What I want to do is break down the stored procedure so I can run in per branch but then run each query in parallel. I've run tested this by running it in separate query windows and it runs almost 80% quicker.   Can anyone give me a dummies guide into running queries in parallel?
14438
Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load JAR files dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a JAR file as its argument.  Any suggestions for simple code that does this?
47651
I have three questions that I'd like to be clarified.   Is their anyway we could create Custom Metadata in Test Classes? I tried to create on my Test Class but I got an error saying the fields of the metadata could not be writable.  If not, then does that mean we should declare real values in our Custom Metadata and use that instead in our test classes? If (2) is correct, then does this mean we have to create the Custom Metadata in the environment we'll be deploying our code before doing the actual deployment?
29728
In other words, can I do something like  for() {     for {        for {        }     } }   Except N times? In other words, when the method creating the loops is called, it is given some parameter N, and the method would then create N of these loops nested one in another?  Of course, the idea is that there should be an "easy" or "the usual" way of doing it. I already have an idea for a very complicated one.
98527
Can anyone please let me know how the data-driven testing is done using the Postman?  I read some post in the online, it seems to be by using collection we need to run the collections at the time we can able to upload the CSV file and JSON for Data driver.  When I tried to upload the CSV the iteration count is not showing automatically  Can anyone show some simple example to perform this task? It will be helpful for automation testing for web services
83950
I'm confused about the difference or advantage (if any) of running a set of tasks in a .sh script using GNU parallel  E.g. 's answer:  parallel ./pngout -s0 {} R{} ::: *.png   rather than say looping through them putting them in the background &amp;.  E.g. 's answer:  #copied from the link for illustration for stuff in things do ( something   with   stuff ) &amp; done wait # for all the something with stuff   In short are they just syntactically or practically different? And if practically different when should I use each?
86053
Is there any advantage to using the older testMethod keyword to identify test methods or is it better to use the @IsTest annotation?  Does the location of these test methods have any significance? E.g. Either being included within the definition of the class being tested or defined in a separate class.
61619
I'm new to TDD and xUnit so I want to test my method that looks something like:   List&lt;T&gt; DeleteElements&lt;T&gt;(this List&lt;T&gt; a, List&lt;T&gt; b);   Is there any Assert method that I can use ? I think something like this would be nice  List&lt;int&gt; values = new List&lt;int&gt;() { 1, 2, 3 }; List&lt;int&gt; expected = new List&lt;int&gt;() { 1 }; List&lt;int&gt; actual = values.DeleteElements(new List&lt;int&gt;() { 2, 3 });  Assert.Exact(expected, actual);   Is there something like this ?
105415
This is the test method i have writtenfor batch apex ProductUpdate  .Even if i have a single callout to Database.Executebatch()  I am getting the following error.  Please help !  @isTest (seeAllData=true) global class testbatchProductUpdate  {     public static testMethod  void  pBatchUpdate()     {          /** Product to meet the Criteria in test class **/          Product2 p = new Product2();         p.Name = 'Test Product';         p.Effective_Date__c = Date.Today();         //p.CurrencyIsoCode= 'USD';         p.Material_status__c='status';         insert p;          /** Product to meet the Criteria in test class **/           test.startTest();         batchProductUpdate bpu = new batchProductUpdate();         database.Executebatch(bpu);         test.stopTest();     }  }      Error :  System.UnexpectedException: No more than one executeBatch can be called from within a testmethod. Please make sure the iterable   returned from your start method matches the batch size, resulting in   one executeBatch invocation.", Failure Stack Trace: "External entry   point"
68683
I don't want a discussion about when to and not to throw exceptions. I wish to resolve a simple issue. 99% of the time the argument for not throwing exceptions revolves around them being slow while the other side claims (with benchmark test) that the speed is not the issue. I've read numerous blogs, articles, and posts pertaining one side or the other. So which is it?  Some links from the answers: , , .
40089
I need to test a bunch of test classes. The test runs are collecting in a huge list so i do not get an overview anymore. Is there any way to clear this list?    Debug -&gt; Clear seems not to work with this view.    And under Test i can't find any useful option for that:    Any ideas?
99930
Should I learn Python or Java to get into test automation?  I'm new to programming. Please share your thoughts or links to any useful information.
36669
I'm looking for a some sort of management/reporting tool that collects the results of tests, stores them for reporting, then lets users generate reports based on those tests.  We have numerous test running tools that run on a variety of platforms, but all output test results in the JUnit format.  The test are not specific to hardware or platform, but rather generic.  What we would like to do is have an automated (or manual) test run be able to submit it to a central location along with additional information, like platform, OS, hardware configuration and maybe user defined data.  The management/reporting tool would store this data.  Then, a manager would be able to go to the tool and request (or more likely, access a dashboard that developers have setup) an update on the current status.  This could be a list of test results that were run in a particular configuration, or a hardware status, or just the results of specific test(s).  EDIT: I am not looking for software that manages the TESTS.  We already write our own tests in other tools.  I want something that can manage the test RESULTS without having to create the TESTS.  Probably makes my question too specialized...  Any suggestions?
22954
This question is more or less programming language agnostic. However as I'm mostly into Java these days that's where I'll draw my examples from. I'm also thinking about the OOP case, so if you want to test a method you need an instance of that methods class.  A core rule for  is that they should be autonomous, and that can be achieved by isolating a class from its dependencies. There are several ways to do it and it depends on if you inject your dependencies using  (in the Java world we have Spring, EJB3 and other frameworks/platforms which provide injection capabilities) and/or if you mock objects (for Java you have  and ) to separate a class being tested from its dependencies.  If we need to test groups of methods in different classes* and see that they are well integration, we write . And here is my question!   At least in web applications, state is often persisted to a database. We could use the same tools as for unit tests to achieve independence from the database. But in my humble opinion I think that there are cases when not using a database for integration tests is mocking too much (but feel free to disagree; not using a database at all, ever, is also a valid answer as it makes the question irrelevant). When you use a database for integration tests, how do you fill that database with data? I can see two approaches:   Store the database contents for the integration test and load it before starting the test. If it's stored as an SQL dump, a database file, XML or something else would be interesting to know. Create the necessary database structures by API calls. These calls are probably split up into several methods in your test code and each of these methods may fail. It could be seen as your integration test having dependencies on other tests.    How are you making certain that database data needed for tests is there when you need it? And why did you choose the method you choose?  Please provide an answer with a motivation, as it's in the motivation the interesting part lies. Remember that just saying "It's best practice!" isn't a real motivation, it's just re-iterating something you've read or heard from someone. For that case please explain why it's best practice.  *I'm including one method calling other methods in (the same or other) instances of the same class in my definition of unit test, even though it might technically not be correct. Feel free to correct me, but let's keep it as a side issue.
22784
What is the best way to unit test a method that calls into multiple methods, for example:  modify(string value) {     if(value.Length &gt; 5)  replaceit(value);      else changeit(value); }   This pseudo code has a modify method that (currently) calls either replaceit() or changeit(). I have already wrote tests for replaceit and changeit, so writing a new test for modify will be 99% the same set of code.  I need to test it thought because it may change in the future.    So do I copy paste the existing test code?  Move the test code to a common function?  Any other ideas?  I'm not sure of the best practice here.