Concurrent user scenarios very common when you work for a web application if it is used by multiple users across the globe.There are some challenges when you test this kind of scenarios.
If you want to do a load test for your website then you can go for any commercial tool like Telerik Test Studio, Neo load, Load runner..etc
There are some scenarios like we need to validate a defect(small web UI steps) which required some concurrent users login or need to do a load test of just login UI. In these cases, you can use JWebUnit.
JWebUnit is a Java-based testing framework for web applications. It wraps existing testing frameworks such as HtmlUnit and Selenium with a unified, simple testing interface to allow you to quickly test the correctness of your web applications.
Setup:
1) Download latest version of JWebUnit jars here. One lib folder will be available.
2) Write a java program
3) All above lib folder jars to the classpath.
Sample program:
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.clickElementByXPath;
import static net.sourceforge.jwebunit.junit.JWebUnit.setBaseUrl;
import static net.sourceforge.jwebunit.junit.JWebUnit.setTextField;
import static net.sourceforge.jwebunit.junit.JWebUnit.submit;
import static org.junit.Assert.*;
import org.junit.Test;
public class ExecuteWebUI {
@Test
public void test() {
setBaseUrl("http://xxxxx/router/login");
beginAt("/login.jsp");
setTextField("loginName", "xxxxx");
setTextField("password", "xxxx");
submit();
}
}
Using eclipse:
1) Create a Java Project
2) Copy above downloaded lib folder to this project
3) Add all lib folder jar to project classpath
4) Create a JUnit test case
If you want to do a load test for your website then you can go for any commercial tool like Telerik Test Studio, Neo load, Load runner..etc
There are some scenarios like we need to validate a defect(small web UI steps) which required some concurrent users login or need to do a load test of just login UI. In these cases, you can use JWebUnit.
JWebUnit is a Java-based testing framework for web applications. It wraps existing testing frameworks such as HtmlUnit and Selenium with a unified, simple testing interface to allow you to quickly test the correctness of your web applications.
Setup:
1) Download latest version of JWebUnit jars here. One lib folder will be available.
2) Write a java program
3) All above lib folder jars to the classpath.
Sample program:
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.clickElementByXPath;
import static net.sourceforge.jwebunit.junit.JWebUnit.setBaseUrl;
import static net.sourceforge.jwebunit.junit.JWebUnit.setTextField;
import static net.sourceforge.jwebunit.junit.JWebUnit.submit;
import static org.junit.Assert.*;
import org.junit.Test;
public class ExecuteWebUI {
@Test
public void test() {
setBaseUrl("http://xxxxx/router/login");
beginAt("/login.jsp");
setTextField("loginName", "xxxxx");
setTextField("password", "xxxx");
submit();
}
}
1) Create a Java Project
2) Copy above downloaded lib folder to this project
3) Add all lib folder jar to project classpath
4) Create a JUnit test case
No comments:
Post a Comment