I am using JUnit as a framework and I am trying to set parallel testing, everywhere I lookedonline I can only find examples for TestNG. I have the Grid up and running and I can test cross platform and cross browser but I need to wait for each test to finish in order for the next to start? I just need a basic example to get me started which I think will be of great help to others like me using JUnit.
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?
122812
Obviously the first tester group would be your own group. But beyond that? It would seem to make sense to have at least more than one group test out your game, as different groups want different things and play differently. Fresh eyes find different bugs, etc. etc.  Are there resources out there to help aspiring game designers without a lot of contacts find people willing and eager to test out their game?  Or is this in essence a "" issue?  To clarify my own situation:  I have the mechanics finished. The setting is still under development, but in accordance with the motto "fail faster" I want to go ahead and test the mechanics (in a different setting for now) to see if they work and are fun or if I need to go back to the drawing board. I have a sort-of group, but I don't know them very well and they don't meet often, and so I'm not excited about the prospect of presenting the mechanics to them right now (as I'm sure there are a dozen issues I've overlooked). Also, I'd like to test the game (including the setting, later) on more than one group, as mentioned above. I've put out some feelers among my current friends and acquaintances, but nobody's really been excited about playtesting or even really giving in-depth feedback, and I don't want to be that person who's always shoving their project in your face. I'm willing to run something online as well. I'm also interested in having others run a game without me present, and giving me their feedback.  Also, I'm looking for something of a guide-type answer that might help someone besides just me.
60003
I've got a few methods that should call System.exit() on certain inputs. Unfortunately, testing these cases causes JUnit to terminate! Putting the method calls in a new Thread doesn't seem to help, since System.exit() terminates the JVM, not just the current thread. Are there any common patterns for dealing with this? For example, can I subsitute a stub for System.exit()?   [EDIT] The class in question is actually a command-line tool which I'm attempting to test inside JUnit. Maybe JUnit is simply not the right tool for the job? Suggestions for complementary regression testing tools are welcome (preferably something that integrates well with JUnit and EclEmma).
122316
I am trying to do this:   Below is the screenshot taken from eclipse  package com.stack.tests;  import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile;  public class PerformanceTesting {        public static void main(String[] args) {             FirefoxProfile profile = new FirefoxProfile();             WebDriver driver = new FirefoxDriver(profile);             driver.quit();         } }   Below is the error code taken while running:  E:\stackoverflow\src\test\java\com\stack\tests&gt;javac -cp selenium-serv er-standalone-2.52.0.jar PerformanceTesting.java  E:\stackoverflow\src\test\java\com\stack\tests&gt;set classpath=%classpat h%;.;  E:\stackoverflow\src\test\java\com\stack\tests&gt;java -cp .;selenium-ser ver-standalone-2.52.0.jar PerformanceTesting Exception in thread "main" java.lang.NoClassDefFoundError: PerformanceTesting (w rong name: com/stack/tests/PerformanceTesting)         at java.lang.ClassLoader.defineClass1(Native Method)         at java.lang.ClassLoader.defineClass(Unknown Source)         at java.security.SecureClassLoader.defineClass(Unknown Source)         at java.net.URLClassLoader.defineClass(Unknown Source)         at java.net.URLClassLoader.access$100(Unknown Source)         at java.net.URLClassLoader$1.run(Unknown Source)         at java.net.URLClassLoader$1.run(Unknown Source)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)   Does somebody know how to fix it?
10972
I have thus far avoided the nightmare that is testing multi-threaded code since it just seems like too much of a minefield.  I'd like to ask how people have gone about testing code that relies on threads for successful execution, or just how people have gone about testing those kinds of issues that only show up when two threads interact in a given manner?  This seems like a really key problem for programmers today, it would be useful to pool our knowledge on this one imho.
52188
I want to learn Selenium WebDriver automation using Java. I have done manual testing before and want to learn automation. I just know the basics of Core Java.   Could you please suggest me the Core topics which one would require to perform test automation using Selenium WebDriver?   What topics on which a tester must concentrate and what topics to ignore in java programming?
107657
I am looking for most universal, up to date, open source, selenium framework for test automation. Or at least a number of frameworks for different languages. I am surprised as how every company and every test automation developer is building his own framework. It feels like  over and over again. Even Dave Haeffner  about how everyone wants to build their own. Yet in the links provided in the video by him, the framework collection seems poor (one framework per language) and, at least for java, out of date (2 years old), only with 6 contributors, and seems to be copyrighted. In test automation community so many things seem to be de facto standard. Why not pull it all together and have a repository, actvively maintained by test automation developers. As for this question to not seem too much opinion based: Please provide links for Java-Selenium-JUnit frameworks you know and use and believe in.
112656
I have a problem with FeedItems in my Test class, it's very weird behaviour Does someone explain to me why this happens?  Callout Class  public with sharing class Callout {  public static void runProccess(Case[] records) {     Database.executeBatch(new CalloutBatch(records), 10); }  public static void send(Case[] records) {     Case[] toUpdate = new Case[]{};       for (case record : records) {         HttpRequest req = new HttpRequest();         req.setEndpoint('callout:test/SOME_URL');         req.setMethod('POST');         req.setHeader('Content-Type', 'application/json');         req.setBody('');         Http http = new Http();         HTTPResponse res = http.send(req);          Map&lt;String, Object&gt; response = (Map&lt;String, Object&gt;) JSON.deserializeUntyped(res.getBody());          toUpdate.add(new Case(Id = (Id) response.get('Id'), Status = (String) response.get('Status')));     }      update toUpdate;  } }   CalloutBatch Class  global with sharing class CalloutBatch implements Database.Batchable&lt;Case&gt;, Database.AllowsCallouts{  private final Case[] records;  global CalloutBatch (Case[] records) {     this.records = records; }  global Iterable&lt;Case&gt; start(Database.BatchableContext BC) {     return records; }  global void execute(Database.BatchableContext BC, Case[] scope) {     Callout.send(scope); }  global void finish(Database.BatchableContext BC) { } }   Test Class  @IsTest  private class CalloutTest { @IsTest static void shouldReaciveData() {     String status = 'Closed';     Case caseRecord = new Case(Type = 'Web', Status = 'New');     insert caseRecord;      //insert new FeedItem(ParentId = caseRecord.Id, Visibility='AllUsers', Type = 'TextPost', Body = '');      System.assertEquals(0, [SELECT Count() FROM Case WHERE Id = :caseRecord.Id AND Status = :status]);      Test.startTest();     Test.setMock(HttpCalloutMock.class, new CalloutTestMock(caseRecord.Id, status));     Callout.runProccess(new Case[]{caseRecord});     Test.stopTest();      System.assertEquals(1, [SELECT Count() FROM Case WHERE Id = :caseRecord.Id AND Status = :status]); } }   Mock Class  public with sharing class CalloutTestMock implements HttpCalloutMock {  private Id recordId; private String status;  public CalloutTestMock(Id recordId, String status) {     this.recordId = recordId;     this.status = status; }  public HTTPResponse respond(HTTPRequest req) {     HttpResponse response = new HttpResponse();      response.setStatusCode(200);     response.setBody('{"Id": "' + recordId + '", "Status": "' + status + '"}');      return response; } }   This code works, but when I uncomment insert FeedItem in Test Class I receive an error message:     System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out   Class.Callout.send: line 23, column 1   Class.CalloutBatch.execute: line 20, column 1   FeedItem doesn't have an impact on this functionality, (I don't have any Process Builders, triggers etc. on FeedItem object)
81682
Is there a way to test an application where you simulate a hundred different clients connecting to a IIS server and asking the same data? At the customer where our project is running they have 400 computers and they often do stress tests with all computers. I on the other hand have only got my laptop... (and a development server).  (In my case the data is asked through a WebORB Gateway).
120241
I'm using data faker and I would like to know how to make my variables available in all steps of my test.  I wanted to leave all elements mapped in the initial step, or be given  WebDriver driver = new ChromeDriver();     //Mapping the elements  WebElement nomeusuario = driver.findElement(By.className("whsOnd zHQkBf"));   My main code is:  public class Criar_Conta_Gmail {  @Given("^que eu esteja na pagina principal do gmail\\.$") public void que_eu_esteja_na_pagina_principal_do_gmail() throws Throwable {     System.setProperty("webdriver.chrome.driver","C:\\Browsers\\chromedriver.exe");     WebDriver driver = new ChromeDriver();     driver.get("https://www.gmail.com");     driver.findElement(By.xpath("//span[contains(text(),'Criar conta')]")).click();     Thread.sleep(2000);     driver.findElement(By.xpath("//div[contains(text(),'Para mim')]")).click();     throw new PendingException();   }  @When("^criar uma nova conta com telefone invalido\\.$") public void criar_uma_nova_conta_com_telefone_invalido() throws Throwable {         WebDriver driver = new ChromeDriver();         //Mapping the elements      WebElement nomeusuario = driver.findElement(By.className("whsOnd zHQkBf"));      // sending data to the application     Faker faker = new Faker();     String Nome = faker.name().firstName();     nomeusuario.sendKeys(Nome);      throw new PendingException(); }  @Then("^o sistema não permite a finalização do cadastro\\.$") public void o_sistema_não_permite_a_finalização_do_cadastro() throws Throwable  {     // Write code here that turns the phrase above into concrete actions     throw new PendingException(); }
67365
How to implement Unit Test at Unity3D.   I wonder if it would be possible to extend the Unity editor to have some sort of testing framework in it.    Is there any guideline to implement it? Any reference like book, blog? Any working example or project?
5058
This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through the resources here and use them to shape more specific questions. To browse all canonical questions and answers, including more unit test resources, navigate to the  tag.  This canonical question is intended to address several classes of common questions by providing a quick summary and links to comprehensive resources:   How do I start writing my first unit test?  How do I unit test this code?  I need help writing this unit test.   Salesforce Stack Exchange looks for detailed, specific questions that the community can help you with, and can't write tests on your behalf. We feel that working with the resources below can help you get started, and we encourage you to make an attempt to write your test and return to SFSE with your specific questions when you encounter challenges you can't resolve.
53191
I want to do an if/else test in SELENIUM IDE. If the checkbox is checked the test should run the IF-condition, whereas otherwise it should go into the ELSE. I tried several commands for the TARGET of the IF, but each time it chose the same way regardless of whether the condition pertained or not. So I need to know how to deal with the notation of SELENIUM IDE in this case. Hope anybody can help me by showing me how I can make the condition dependent on a checkbox..
52661
I know there is a difference between assert and verify in Junit; the assert results in a runtime exception, causing test method execution to abort. To overcome this problem, we can have verify which will make test case fail, but allowing test execution to proceed rather than getting aborted.  I doubt there is any such built in approach in testNG. I do understand that best practices say, there should not be multiple asserts in same test case.  But, in practical world, we do come across scenarios where we need to have multiple checkpoints in one test case and we don't want our test method to abort because of one check point failure (test execution should proceed despite failure).  How can we use a soft assert mechanism, similar to verify, which will not abort test method when there is a checkpoint failure.  Example:  @Test(dataProvider = "getMailUrl") public void testMail(email,subject); Assert.assertFalse(subject.isEmpty);//1st checkpoint Assert.assertNotNull(email); //2nd checkpoint Assert.assertEquals(email, "feedback@yoursite.com"); //3rd checkpoint   Now, I want test execution to proceed, even if the 1st checkpoint (validation of subject being not empty) fails. Definitely we will be not be using assert (hard assert). We will need concept of soft assert similar to verify (facilitated by Junit).   I understand, we have to build a customListener implementing TestNG interfaces or extending existing listeners such as TestListenerAdapter. I am still struggling - how can we do this?
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
122967
For QA workstations preparation (Windows-based PCs) our IT department uses typical batch deployment tools. I'm not at all interested in the details of such process, but IT guys ask me:  What typical set of software you need for everyday manual testing tasks? We could include these in our deployment so that you guys could save more time for testing, not for environment prep &amp; tuning.  Sure thing we do test various range of projects, from web applications to standalone solutions, and each application requires its own set of tools for manual testing, e.g.:  Browsers Virtualization utilities DB clients Screens capturing tools FTP clients XML editors etc.  However, and that's for sure - there's a list of tools every QA MUST have installed on its PC, regardless of project types under testing. My area of experience is mostly standalone / complex web apps, that's why my vision on the task is a bit subjective. So, your suggestions of what are tools / software an average QA specialist can't live without will be highly appreciated. 2 assumptions:  Manual testing is a point of interest. Let's limit the list to not more than 15 (better 10) items.  Thanks in advance!
18288
I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this: import unittest  l = [[&quot;foo&quot;, &quot;a&quot;, &quot;a&quot;,], [&quot;bar&quot;, &quot;a&quot;, &quot;b&quot;], [&quot;lee&quot;, &quot;b&quot;, &quot;b&quot;]]  class TestSequence(unittest.TestCase):     def testsample(self):         for name, a,b in l:             print &quot;test&quot;, name             self.assertEqual(a,b)  if __name__ == '__main__':     unittest.main()  The downside of this is that it handles all data in one test. I would like to generate one test for each item on the fly. Any suggestions?