Questions tagged [junit]
JUnit is a unit testing framework for the Java programming language.
109
questions
19
votes
5
answers
137k
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 ...
12
votes
2
answers
3k
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 ...
7
votes
7
answers
39k
views
Take screen shots using selenium webdriver
How to take screen shot on both test cases "Positive and Negative" results?
NOTE: Currently, I am working in selenium webdriver (junit) and I did not have an idea about how to code for adding methods ...
7
votes
3
answers
7k
views
How to test if my application method handles HTTP status 404 of a REST API without actually calling that REST API
I am currently trying to automate some of the testing for my application using JUnit. My application has a method which calls a 3rd party REST API. I need to check if that method is handling HTTP ...
7
votes
2
answers
30k
views
What is the difference between jUnit & TestNG?
I have started Selenium scripting in my one of the project and I want to know the exact difference between Junit & TestNG. Which one is useful for Tester in Selenium?
Any reference link/Site for ...
6
votes
5
answers
3k
views
How to write unit test for methods with a large number of parameters?
I am asking in case I run into this scenario in the future.
Someone in my company wrote multiple methods with 25 parameters. I don't know how/why it got thru code review. I'm just wondering how ...
6
votes
6
answers
27k
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 ...
5
votes
5
answers
594
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 ...
5
votes
9
answers
2k
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 ...
5
votes
2
answers
286
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 ...
5
votes
1
answer
1k
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 ...
4
votes
2
answers
16k
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 ...
4
votes
2
answers
5k
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 ...
4
votes
1
answer
691
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
3
answers
1k
views
How to reduce the time of our regression tests - interview question
I recently attended an interview and they asked me:
How do you reduce the time of your regression suite?
I answered that we trigger only the high level jobs and rest of of our regression we do ...
3
votes
3
answers
10k
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 = ((...
3
votes
4
answers
2k
views
Unable to locate element as ID changes after refreshing the in Ebay login page
Using JUnit I'm attempting to automate the eBay login. I cannot select the email/username field because field changes id on refresh. Any ideas?
input size="40" maxlength="64" name="962970435" id="...
3
votes
3
answers
6k
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.
...
3
votes
1
answer
646
views
Uncertain as how to test complex method
I have a class which handles when a CardView's drag gets started.
I've been looking at tutorials for JUnit and I can't seem to find out how to start testing this method.
public class ...
3
votes
1
answer
9k
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 ...
3
votes
1
answer
6k
views
Unable to run cucumber tests from command line
I know this is the most common question but sorry I am posting this again as I tried all the solutions but couldn't solve the issue,
Problem: I am unable to run my cucumber tests through maven and ...
3
votes
3
answers
890
views
Running Junit test parallely with csv test data
I have a csv test data file with 50+ test data in it. I want my JUnit test to process these 50+ test data in parallel than serially. How can we do that? Is there a framework that can do that?
Junit ...
3
votes
2
answers
3k
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 ...
3
votes
0
answers
1k
views
How to run same test case in different browsers in Cucumber using Java
New to automation and Cucumber.
I have a .feature test case (a simple login function) that I would like to run in multiple browsers in parallel.
I want to store the browser properties in a global ...
3
votes
2
answers
19k
views
How to handle InvalidElementStateException in Selenium?
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. ...
3
votes
1
answer
68
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
2
answers
8k
views
What are 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
2
answers
611
views
JUnit Assert's message equivalent implementation using Selenium Webdriver's wait method
In JUnit's assertions you have an optional parameter which allows you to to display it when the assertion fails, to allow the tester know what actually failed from a human-friendly perspective.
Is ...
2
votes
2
answers
163
views
java.lang.NullPointerException problem in Selenium Test
I'm learning Selenium POM with Junit and ran into a problem.
java.lang.NullPointerException
at MainPage.clickSignIn(MainPage.java:27)
at MainPageTest.signInTest(MainPageTest.java:28)
My class:
...
2
votes
2
answers
218
views
Best strategy to test automatically a web application
I have an application that consist of a web server in Java EE (EJBs and JAX-RS RESTful services) and a client module in Angular that runs in a browser.
The components that I can unit test ...
2
votes
2
answers
147
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
1
answer
2k
views
Attaching screenshots to JUnit test reports
We run our tests on Jenkins using Protractor generating a JUnit XML test report via JUnitXmlReporter from jasmine-reporters.
Is it possible to attach screenshots, with the current state of an ...
2
votes
2
answers
373
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 ...
2
votes
1
answer
2k
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 ...
2
votes
1
answer
405
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
2
answers
10k
views
The plugin specification 'com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:' has a problem:
I am getting this error while trying to generate the extent report for cucumber-java and Junit. I am using cucumber version 6.9.1 and grasshopper adapter6. This is my pom.xml file.
<!-- ...
2
votes
1
answer
94
views
Junit: how to know which structural units are not covered in test coverage?
I am currently working on running junit tests in Evosuite. Whenever I execute a test case, the structural coverage is not 100%, but around 90% or 85%. Is there a better way to know which structural ...
2
votes
2
answers
429
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
3
answers
819
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
0
answers
3k
views
Can't run tests from Cucumber feature.file (cucumber.runtime.CucumberException:)
I can run my tests from my runner class without any problem. Here is my Runner-class:
@RunWith(Cucumber.class)
@CucumberOptions(
format = {"pretty", "html:target/cucumber"},
glue = {"...
2
votes
1
answer
1k
views
Selenium: Isolating Assert Fail in Excel Data Driven Loop
Firstly I would like to point out that I'm a beginner when it comes to selenium so I apologise if this is not presented appropriately.
I would like to incorporate data driven testing into my ...
2
votes
3
answers
12k
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
4
answers
1k
views
Katalon or Java+Junit+Cucumber to automate tests?
We are starting to automate web tests, but we don't know what is the best way to do, what is the best option to start and why?
And what is the best-easy to use for automate Mobile IOS and Android?
1
vote
2
answers
598
views
How to reduce Phantom js test execution time for selenium junit test cases
I am using phatnom js driver for my selenium test cases to overcome the headache of chrome driver.I see it is taking lot of time to execute the test cases.I tried html diver prior to phantom.Since ...
1
vote
3
answers
1k
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 ...
1
vote
1
answer
2k
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 ...
1
vote
1
answer
1k
views
Automation solution for PDF content validation using Java [closed]
I am doing POC on PDF content validation which will basically validate the content of PDF files. But I didn't find any solutions.
Solution which I am looking for:
Read the PDF file from a specific ...
1
vote
1
answer
2k
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....
1
vote
2
answers
3k
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(...
1
vote
2
answers
7k
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 "...