junit

selenium介绍和环境搭建

余生长醉 提交于 2019-12-27 00:16:18
一、简单介绍   1.selenium:Selenium是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。支持的浏览器包括IE、Mozilla Firefox、Chrome等。支持自动录制动作和自动生成,Net、Java、Python等不同语言的测试脚本。Selenium 测试脚本可以在 Windows、Linux 和 Macintosh等多种平台上运行。   2.TestNG:TestNG是一个测试框架,其灵感来自JUnit和NUnit的,但引入了一些新的功能,使其功能更强大,使用更方便。TestNG是一个开源自动化测试框架;TestNG表示下一代。 TestNG是类似于JUnit(特别是JUnit 4),但它不是一个JUnit扩展。它的灵感来源于JUnit。它的目的是优于JUnit的,尤其是当测试集成的类。 TestNG的创造者是Cedric Beust(塞德里克·博伊斯特)   3.maven:我们在开发项目的过程中,会使用一些开源框架、第三方的工具等等,这些都是以jar包的方式被项目所引用,并且有些jar包还会依赖其他的jar包,我们同样需要添加到项目中,所有这些相关的jar包都会作为项目的依赖。通常,一个Java EE项目所依赖的jar包会有很多。然而,这还并非是主要问题,在管理这些jar包过程中

maven 核心 pom 文件

你说的曾经没有我的故事 提交于 2019-12-26 10:59:22
maven 核心 pom 文件 pom 简介 项目配置信息 最小 pom super pom 依赖配置信息 modules properties dependencyManagement pom 简介 pom 代表项目对象模型,它是 maven 中工作的基本组成单位。它是一个 xml 文件,始终保存在项目的基本目录中的 pom.xml 文件中。pom 包含的对象是使用 maven 来构建的,pom.xml 文件包含了项目的各种配置信息,需要特别注意,每个项目都只有一个 pom.xml 文件。 项目配置信息 project:工程的根标签 modelVersion:pom 模型版本,maven 2 和 3 只能为 4.0.0 groupId:这是工程组的标识。它在一个组织或者项目中通常是唯一的。例如,一个银行组织 com.companyname.project-group 拥有所有和银行相关的项目 artifactId:这是工程的标识。它通常是工程的名称 groupId:和 artifactId 一起定义了 artifact 在仓库中的位置 version:这是工程的版本号。在 artifact 的仓库中,它用来区分不同的版本 packaging:定义 maven 项目的打包方式,有 JAR 、WAR、EAR 三种格式 最小 pom < project xmlns = " http:/

JUnit tutorial for learning [closed]

不想你离开。 提交于 2019-12-25 19:07:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . I want to learn JUnit from basic in Java and how to apply in my project. It would be very helpful if anybody can tell from where to start. I have seen some tutorial but i can't understand from it. 回答1: You can write your test code before or after write your source code. You can read about Test-driven development

JUnit tutorial for learning [closed]

牧云@^-^@ 提交于 2019-12-25 19:07:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . I want to learn JUnit from basic in Java and how to apply in my project. It would be very helpful if anybody can tell from where to start. I have seen some tutorial but i can't understand from it. 回答1: You can write your test code before or after write your source code. You can read about Test-driven development

Maven Selenium Plugin - Lock File still present error

╄→гoц情女王★ 提交于 2019-12-25 18:34:04
问题 My Project is using selenium-client-driver 0.9 and selenium based integration test will be executed by maven using maven-selenium-plugin. (There are already many questions in stackoverflow but couldnt find a relavant answer). Selenium test case fails with error Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\Users\nagappan.s\AppData\Local\Temp\customProfileDir23d2b92949d74270915586b2a3f2073a\parent.lock at org

easiest Automated testing tool in Java

社会主义新天地 提交于 2019-12-25 18:20:22
问题 I want to learn quickly like in an few hours an automated testing tools. Does somebody know any automated testing tool which is very easy and how can we do same automation in java. I want to use Junit 回答1: I think you are on the right track, JUnit is definitely your best bet for Java testing automation. You can learn more about JUnit and even build a quick example application here. Other tools to look at: Cactus EasyMock Fit Others that can be viewed here. 回答2: For preparing test dataset,

JUnit not null test

懵懂的女人 提交于 2019-12-25 16:49:36
问题 I'm trying to implement an easy junit test for a method. My intention is to test if the method parameter is not null . So that the test fails if the parameter is null . the method is: /* * @return the db entry object */ getEntry( String user, String grp, int status); My first try to implement the test is public void testGetEntry() { String userId = null; getEntry( userId, "grp1", 3); asserNotNull(userId); } I think thats not the correct way. thx for any help :) 回答1: You can't test that. You

AspectJ - parse definitions failed - NullPointerException

房东的猫 提交于 2019-12-25 12:20:08
问题 Here's MVCE https://github.com/yami12376/AspectJ Add VM arguments to Run/Debug configuration of Junit test , in my case: -javaagent:C:\aspectjWeaver\spring-instrument-3.0.4.jar -javaagent:C:\aspectjWeaver\aspectjweaver-1.6.11.jar In my case i added this in JAVA build path : \target\classes\META-INF from src/main/resources Run Junit test If you delete aop.xml it's still weaving type org.* but on the other hand aop.xml should not weave it beacuse it has: <include within="com.*"/> Why does it

Mocking a static method with generic parameter

天大地大妈咪最大 提交于 2019-12-25 12:03:32
问题 i am trying to mock a static method with sigature public static <T extends Object> T get( String name, Class<T> i ) { return null } and i am using PowerMockito, and below is my expected code PowerMockito.when(ClassName.class, "get", "name", Class.class).thenReturn("Hi"); but its throwing org.powermock.reflect.exceptions.MethodNotFoundException: No method found with name 'get' with parameter types: [ java.lang.String, java.lang.Class ] Can anyone plz give the clue how to mock this using

代码质量之Archunit的使用

南楼画角 提交于 2019-12-25 11:59:32
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 注:开发的编辑器: Intellij Idea,JDK版本是JDK8 Archunit 是什么,官网的英文介绍很好,建议阅读原文,"ArchUnit is a free, simple and extensible library for checking the architecture of your Java code using any plain Java unit test framework. That is, ArchUnit can check dependencies between packages and classes, layers and slices, check for cyclic dependencies and more"。 简单来说,它是代码格式、类之间的依赖关系检查工具。 进入官网 点击右上角的"User Gruide" 之后就可以看到它的英文教程文档。 1.pom.xml中加入依赖 List-1 最重要的是archunit-junit4依赖 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> <