JUnit is a unit testing framework for the Java programming language.

learn more… | top users | synonyms

7
votes
4answers
43k views

Webdriver Check if Checkbox is Set and Set it if Not

I am learning Webdriver with JUnit by going through Alan Richardson's Selenium Simplified book and taking translating the exercises/tests from Selenium RC to Webdriver. So far, this has proven to be ...
5
votes
2answers
3k views

How and where to store dynamic result/data using webdriver java

I want to know "How and where to store dynamic (Search results) result/data", I am getting the results and not sure what to do next. Also, after saving these results I want to use this in another ...
5
votes
2answers
1k views

How to manage application data when running multiple tests in parallel?

Our functional test suite is slow I have inherited a functional test suite using Selenium 2 (Webdriver) and Junit. We have around 500 tests written for our Java web application. Running the full ...
5
votes
2answers
234 views

JUnit-friendly framework for production monitoring

My team deploys code to production every week or so. We have a large set of post-deployment validations, e.g.: New log lines are appended to Tomcat log (ssh to machine, tail -f the log) Database ...
4
votes
7answers
30k views

Take screen shots using selenium webdriver

How to take screen shot on both test cases "Positive and Negative" results. NOTE: Currently, iam working in selenium webdriver (junit) and i didnt have an idea about how to code for adding methods to ...
4
votes
5answers
322 views

What should I learn next as QA

I have been working as a software tester for the last 4 years. I have the following skills and day job experience: 1 - Manual Testing of websites & Mobile Applications. 2 - Automation using ...
4
votes
2answers
204 views

What is the difference between jUnit & TestNG?

I want to know difference between Junit & TestNG. Which one is useful for Tester?
4
votes
5answers
17k views

How to make my tests more robust in WebDriver using JUnit (code included)

I'm hoping someone can advise me on some best practices to make my tests more robust. The problem I'm having is that every so often my tests will fail at the point of WebDriver waiting for an ...
4
votes
1answer
633 views

Parameterized JUnit tests with HtmlUnitDriver leading to test termination

I came across an unusual issue with my automation tests while using the HtmlUnitDriver. I have been using the junit parameterized class to iterate over a list of urls to run some of my tests. The test ...
3
votes
9answers
944 views

What are good resources for a manual tester to transition to automation?

Nervously looking at job posts, automation and programming is no longer "good-to-have". It is almost a must. I'm a manual tester looking to start working towards automated testing/test automation. I ...
3
votes
2answers
79 views

Which test execution framework for Java has the highest test coverage?

I found TestNG failing occasionally and when I started to investigate I found it has little test coverage. It looks like the test framework itself is poorly tested. Which other test execution ...
3
votes
1answer
182 views

Handle conflicts in parallel execution of jUnit testruns using the same database

I am actually working on how to manage the execution of many jUnit classes calling the same database, the tests interact using Web-services. If it is possible, it would be a great help if you would ...
3
votes
1answer
44 views

Enforced Folder Structure in Java for Uploaded Files [closed]

I am looking to create a system where a clearly-defined local filesystem folder structure follows a specific pattern. Programmatically or manually violating the pattern should throw an exception. ...
2
votes
2answers
3k views

Selenium WebDriver how to name each screenshot taken after a test based on the test name

I am currently using the following method to take screenshots after each test, and it works fine: @After public void takeScreenshotAtEndOfTest() throws IOException { File scrFile = ((...
2
votes
1answer
2k views

What are the Selenium, JUnit, Ant and JScover and how they are combined?

I am given a javascript function which takes as input some numbers and returns the max, as a part of a project at the university, and I have to test it, using Selenium, JUnit, Ant and JScover. I have ...
2
votes
1answer
273 views

JUnit Status Messages

Given I have the following class (See Parallelized Runner for more information on parallel runs): @RunWith(Parallelized.class) public class TopicTest { String topic; public TopicTest(String ...
2
votes
1answer
333 views

Selenium JUnit DOM Testing - Problem with counting Dynamic rows

I have a DOM structure "div > table id = 't1' > tbody > tr" (count of tr changes on resize) The javascript function changes the number of rows on resizing the browser. I want to count number of rows ...
2
votes
2answers
96 views

Test results that differ from running via command line versus IDE

I have just run a set of automated tests via the command line using Maven as my build tool and JUnit4 as my test execution framework. There was a report of two errors which were recorded in a text ...
2
votes
2answers
2k views

Code Coverage for Web Applications?

Does anyone have any experience using code coverage tools for web applications? I primarily work with Webdriver and JUnit, but I am not sure if we are covering all the possible cases. This may ...
2
votes
2answers
91 views

How to generate test cases for JUnit?

Explanation We are currently using a self-made testing framework/tool, to test services of an client-server application. The framework currently works with own implemented JUnit like assert methods ...
2
votes
3answers
379 views

Selenium opens browser and loads page, then stops

Selenium opens browser and loads page, then stops. I have inherited a selenium project with no internal documentation and I'm a bit stuck on how to get it up and running (I am new to Selenium). We've ...
2
votes
1answer
4k views

How to run multiple browser instance with Webdriver, Java, and Junit/TestNG?

I have a test ready to be executed but it takes a long time to finish. In this test I'm feeding in csv data, so basically the whole test will run 56 times. I was wondering if there's anyway I could ...
2
votes
2answers
112 views

Junit 4 checkbox in jmeter getting cleared when running test

I wrote a junit 4 test case. The test is using selenium web driver. It works fine when running from eclipse. I then copied the exported jar file to jmeter lib/junit folder. The class name and test ...
2
votes
0answers
345 views

How to test an SDK built for Android?

My company has an SDK for the Android platform. The SDK sends information to our servers. I need to be able to intercept, interpret, and analyze what the SDK is sending to these servers in terms of ...
1
vote
2answers
5k views

How to generate testing report in JUNIT in webdriver

I am using Selenium webdriver 2.0 in JUnit framework. I need to generate a report on my tuned both (positive and negative) test cases. NOTE: We have an option to generate report by default in "...
1
vote
3answers
3k views

How to execute parallel junit tests with maven surefire

I'm using selenium webdriver, Junit 4.9, maven for testing. Now I need to parallel tests. I added the plugin below, then tried to run it from IntelliJ IDEA 11, but it was still running sequentially. ...
1
vote
1answer
46 views

How to avoid hidden bugs caused by test doubles?

I just got the Mockito framework for Java to try out mocking with JUnit. Trying it brought me to a basic question that I am sure is obvious but I have had trouble finding any answer for, probably ...
1
vote
1answer
281 views

Using tagged hooks to run tests with different browsers

I've looked at resources like here and here, but these solutions are not working for me. What I want to do: without involving much heavy machinery (unless I have to) and without using a third-party ...
1
vote
2answers
125 views

Assertions and Outputting Specific URLs

Here's what I've done so far. @Test public void test() { String[] list = {}; for (int i=0; i<list.length; i++){ driver.get(baseUrl + "/" + list[i]); boolean ...
1
vote
2answers
22 views

How to handle InvalidElementStateException message

I want to type 'calculator' on google text box so for that i wrote below code, its execute fine but there is 'InvalidElementStateException' message display so please help me how to solve that problem. ...
1
vote
2answers
116 views

I need to run a project build using selenium webdriver/maven/junit with jenkins

I have a selenium webdriver live project build using maven and junit framework. I want to run this using jenkins. I google searched but was able to find information when the project is build using ...
1
vote
2answers
3k views

generating html report from soapui test results when running from maven & jenkins

I have a SOAPUI Project file with number of test suits. I have wrote a maven project to run that project file. I am running that maven project (pom.xml) through jenkins. As you can see in the pom.xml ...
1
vote
1answer
803 views

How can I use Surefire to run parameterized tests in parallel?

I am using jUnit's Parameterized annotation on some Selenium tests to specify the browsers they should run with. I am also using SureFire's new parallel parameter (set to "classes") to try and run ...
0
votes
3answers
4k views

Selenium tests written using Junit are not running in order

I executed some selenium scripts, but they are not running properly. Execution is taking the scripts randomly and start execution. I want to execute the scripts as per script order. Please tell me a ...
0
votes
1answer
271 views

How to compare value of a td of a table with a numeric value using webdriver?

I have to compare a value of a td tag with a numeric value. I have o check whether the value coming in that td is >= some value. The html of td is: <td class="sorting_1">78000</td> I ...
0
votes
2answers
4k views

Selenium session timeout

I have a session timeout problem like this: I am using selenium + webdriver + java(junit) While testing each(tab) test case of particular web page in one programme, i need first test Login button, ...
0
votes
1answer
55 views

Is this a good idea to test if text messages are exactly what they are?

I have been told that testing java exceptions' messages is a good thing, but it looks so much like redundancy that I cannot believe it. Consider following fictional code: public class ...
0
votes
3answers
212 views

Is it worth it to learn an automated testing software as a Java web developer?

I want to learn Selenium web driver (or JUnit), but I'm hesitating on whether to learn it or not because my work is not focused on testing. I do maintain and develop Java web based applications and as ...
0
votes
2answers
749 views

Using Jtidy to parsing HTML

I am using Jtidy I pass an InputSteam and then I tried to validate whether or not the XHTML code in the InputSteam is valid. InputStream s = new ByteArrayInputStream(my_string).getBytes(...
0
votes
1answer
5k views

Calling data from one class to another class - framework for JUnit

Please forgive me as I am still very new to the world of test automation. I have started out by using Selenium WebDriver with JUnit4, predominately on windows OS, although I have modified my scripts ...
0
votes
3answers
4k views

Best approach to use when values are dynamically created?

I'm looking for some advice on how to select a WebElement. When I click a button that creates a new 'page', the given value is dynamic, in that it is totally random and not sequential. I would expect ...
0
votes
1answer
160 views

Change the title of a webpage in JUnit test with Selenium Web Driver

I want to write an automated JUnit test script with Selenium Web Driver to load a Wikipedia page and then change the title of the page loaded. import java.util.regex.Pattern; import java.util....
0
votes
1answer
605 views

Ant compile failed, packages do not exist

I'm trying to compile my maven test project in intellij and everytime i compile, i get this error: Buildfile: /Users/username/Desktop/workFiles/maven/MavenProject/build.xml setClassPath: init: ...
0
votes
2answers
242 views

How to execute Selenium + Junit Tests on Chrome

I have downloaded the Chrome Driver and i am able to execute my tests on Chrome. However Only local connections are allowed for it. How can i execute it globally on any machine without changing ...
0
votes
1answer
67 views

Testing Verify Method Call Without Argument In Test Class

I have a class which takes a message with payload String. The payload is then split and used to create an Entity which is passed to DAOInterface to persist. How can you test the call daoInterface....
0
votes
1answer
346 views

Alerts: How to assert a given paragraph

Using WebDriver and JUnit 4.11. I'm attempting to find an alert and assert the body of the alert paragraph. My code is: @Test public void dNameField(){ WebElement nameField = chrome....
0
votes
4answers
2k views

Using WebDriverWait to verify a performed action versus assertions in JUnit

Can someone tell me if by using the following code is sufficient enough to verify that the actions performed have taken place. So by using a wait command for certain elements to be visible in the DOM, ...
0
votes
2answers
4k views

JUnit ParallelComputer Runs All Test Classes As One

I'm building automation testing for web application by using JUnit 4.9 and Selenium Webdriver. It's time consuming. So I'm trying to experiment with ParallelComputer. I'm wondering how can I get ...
0
votes
1answer
183 views

How to perform Selenium navigation before tests run without using JUnit 4.11+'s setUp or at the start of the test method?

How to perform Selenium navigation before tests run without using JUnit 4.11+'s setUp or at the start of the test method? We've got both navigation and bookmark based Selenium tests. The test code ...
0
votes
0answers
9 views

load application-config.xml (spring+hibernate) file from test case

I am using application-config.xml file in which the hibernate configarations are included. When I run my test case (using Junit with Mockito), I want to call an abstract class HibernateUtil. Here it ...