10
votes
Accepted
What is the difference between jUnit & TestNG?
TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use.
TestNG is designed to cover all categories of tests:...
10
votes
Accepted
How to test if my application method handles HTTP status 404 of a REST API without actually calling that REST API
Use a mock.
Mock 3rd party API using MockServer or WireMock, if you're in the Java world.
Your test will call getNumUsers() method
which in turn will call mock of your 3rd API
and the mock will ...
7
votes
How to reduce the time of our regression tests - interview question
Starting from your first question:
Your answer did not give the interviewers any indication that you understand the technology challenges behind your automation suite. They were expecting answers ...
6
votes
How to test if my application method handles HTTP status 404 of a REST API without actually calling that REST API
You don't need to add any additional dependency.
Start doing some preparatory refactoring in order to:
Program to an interface instead of a concrete object;
Break the getNumUsers() into two ...
5
votes
What should I learn next as QA
My recommendation would be to become more competent in programming, preferably in Python (excellent language for small admin tasks and generic data fiddling), and learn Linux administration with good ...
5
votes
Accepted
What should I learn next as QA
As a part of testing you should start looking into the NFRs testing like Performance, Load, Security, UX etc. testing. Study about the FRUPS+ . Performance testing too is equally important as other ...
5
votes
How to reduce the time of our regression tests - interview question
How do you reduce the time of your regression suite?
This may depend on what technologies the regression suite is based on. There can be technology/tool specific optimizations, like using faster ...
4
votes
JUnit Assert's message equivalent implementation using Selenium Webdriver's wait method
As it seems to me, the most close equivalent to JUnit assertion messages is withMessage() method introduced in FluentWait class. Below is the example of how I use it:
public class Test {
public ...
4
votes
Accepted
How to write unit test for methods with a large number of parameters?
If refactoring is not an option then try to see this big function as a class of methods and focus on individual parts of this function which themselves are a logical entity, and design parameters ...
4
votes
what is difference between selenium web driver and junit?
Selenium is a tool that remote-controls a browser, You can use it to simulate a user interacting with a web site. for more info go through Selenium
JUnit is a unit testing framework for writing Java ...
4
votes
Accepted
what is difference between selenium web driver and junit?
Selenium WebDriver is a tool using which we can automate any web application. It can open a browser, launch a URL, write on a text box, click buttons, etc. In short, it can simulate user actions.
But ...
3
votes
What should I learn next as QA
From my point of view it makes sense to dig into the next areas:
Performance Testing. There are some good free and open source tools, you can choose one and master it. Don't try to learn the ...
3
votes
What should I learn next as QA
I am currently at the same point. I work for 3 years in QA. I strongly believe that if you have mastered the job you are currently doing in your present position you should consider expanding your ...
3
votes
Accepted
Is this a good idea to test if text messages are exactly what they are?
I think the answer to your question depends on what the exception text string is going to be used for. Is it part of the documented interface for that class? If some other part of the program is ...
3
votes
Change the title of a webpage in JUnit test with Selenium Web Driver
I'm not sure why you would ever want to do that, but one way is to simply execute some javascript.
import org.openqa.selenium.JavascriptExecutor;
((JavascriptExecutor)driver).executeScript("...
3
votes
Unable to locate element as ID changes after refreshing the in Ebay login page
If 'ID' of your webElement changes everytime after refreshing the page in this situation:
First of all look for any other attribute which Is not changing every time In that div node like name, class ...
3
votes
How to write unit test for methods with a large number of parameters?
I can't think of a developer writing a method which takes 25 arguments. This is a terrible design. Practically your method should not take more than 3 arguments.
OK, coming to a solution, in case ...
3
votes
How to write unit test for methods with a large number of parameters?
A good approach would be to use a test Facade for each feature you need to test, this would provide a public API for the testing of that feature only, but supports and hides the full width of the ...
3
votes
How to provide Product Owner with estimates for unit testing?
I would argue that the question will not give any meaningful information and that you should make a stand if you are questioned in your practices as a professional.
I will start by the question ...
3
votes
Accepted
Best strategy to test automatically a web application
There will always be some overlap in different tests, but if you look at the test pyramid the different layers have different goals.
The test pyramid is a way of thinking about different kinds of
...
3
votes
Automation solution for PDF content validation using Java
First of all, you mentioned a few different tags like Python and Java. You need to make it clear what language you want to use. I'd suggest using a language that you already know and/or your ...
2
votes
Is it worth it to learn an automated testing software as a Java web developer?
Automated tests are software. Writing tests is programming. The difference is which libraries you use and what problems you are trying to solve.
But you need to distinguish between the needs of your ...
2
votes
Using Jtidy to parsing HTML
I had the same question/problem.
This is how I solved it:
String validHtml = "some valid html";
InputStream inputStream = new ByteArrayInputStream(validHtml.getBytes(StandardCharsets.UTF_8));
Tidy ...
2
votes
What should I learn next as QA
I think QA is more then just (automated) testing skills and tooling knowledge. Learn how to learn one tool and you can learn em all. I would focus on more general quality concepts and how to introduce ...
2
votes
What is the difference between jUnit & TestNG?
Major difference in TestNG and JUnit test frameworks is their scope.
I suggest to use TestNG as core unit test framework for Java project, because TestNG is more advance in parameterize testing, ...
2
votes
Accepted
How to skip test cases in a JUnit testsuite?
1. You need to import
import org.junit.Ignore;
2. Tag @Ignore is available in JUnit - It will skip your test from executing
@Ignore
@Test
public void your_test_to_skipped() {
---;
---;
}
2
votes
Is throwing custom exceptions by test an anti-pattern?
Ideally I wrap the test step in a error handling mechanism that either throws the error and kills the test or it proceeds to the next step even if it fails. The test log records the failure, but the ...
2
votes
Accepted
Attaching screenshots to JUnit test reports
I haven't tried it but I remember seeing it in a YouTube video I watched years ago. Kohsuke Kawaguchi's talk Jenkins Selenium Meetup: Kohsuke Kawaguchi on how Jenkins + Selenium = Love at around the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
junit × 110selenium-webdriver × 70
java × 50
automated-testing × 33
cucumber × 15
selenium2 × 12
testng × 10
unit-tests × 8
jenkins × 6
test-automation-framework × 5
eclipse × 4
maven × 4
mock × 4
test-management × 2
test-design × 2
appium × 2
javascript × 2
selenium-ide × 2
bdd × 2
integration-testing × 2
cross-browser-testing × 2
assert × 2
jmeter × 1
browser-automation × 1
xpath × 1