- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请问我的 gradle.build 文件出了什么问题? AM 尝试生成 html 测试报告,但运行 gradle.test 后,我的 reports/test/index.html 有 0 个测试、0 个失败、0 个忽略 -duration,成功也是 -(减号)。我相信我应该看到有多少测试运行的测试通过率达到 100% 成功,因为当我使用 ./gradlew run 或 gradle test(构建成功)时,我的测试运行得非常好。已检查之前的问题,但似乎没有一个出现此错误。请我很困惑。 :(下面是我的 build.gradle 文件
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
mainClassName = 'main.java.Functional.Test_Run'
repositories {
mavenCentral()
}
sourceSets {
selenium
}
test {
reports {
junitXml.enabled = false
html.enabled = true
}
}
jar {
baseName = 'gs-gradle'
version = '0.1.0'
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
dependencies {
seleniumCompile 'junit:junit:4.11'
seleniumCompile 'org.seleniumhq.selenium:selenium-java:2.45.0'
seleniumCompile 'org.seleniumhq.selenium:selenium-server:2.45.0'
compile fileTree(dir: 'libraries', include: '*.jar')
}
task jettyDaemon(type: org.gradle.api.plugins.jetty.JettyRun) {
daemon = true
}
task selenium(type: Test, dependsOn: jettyDaemon) {
testClassesDir = sourceSets.selenium.output.classesDir
classpath = sourceSets.selenium.runtimeClasspath
}
eclipse {
classpath {
plusConfigurations += configurations.seleniumCompile
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
My project structure:
main.java.xyz
main.java.xyzz
sourceSet.java.xyz
sourceSet.java.xyzz
sourceSet.resources.xxx
test.java.xyz
test.java.xyzz
test.resources.xxx
Requested class below:
package main.java.Functional;
import static org.junit.Assert.assertTrue;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import main.java.Functional.Testcase.performAction;
/**
* This class is used for testing all the indo functionalities.
* @author Ola
*/
public class Test_Run {
/**
* Variables to set up driver and browser.
*/
public static AllMethods callMethod;
public static WebDriver driver;
public static String ID;
public static String filePath = "C:\\Users\\Ola\\workspace\\Config.properties";
/**
* Setup method to run chrome browser
* @param args
* @throws Exception
*/
public static void setup(String[] args) throws Exception {
callMethod = new AllMethods();
callMethod.setup();
callMethod.driver.get("http://independent.ie");
// Maximize browser window
callMethod.driver.manage().window().maximize();
// store current url in a string
String site = callMethod.driver.getCurrentUrl();
// print out the URL in the console
System.out.println("The current Url IS: " + site);
// Get the OS on which the driver is running.......
String detectOS = log.DetectOS();
log.log(detectOS);
Thread.sleep(7000);
}
/**
* Main Method to start the browser and run all necessary testcases.
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// specify the Test to Run.........
performAction tc = performAction.acct_Profile;
try {
setup(args);
} catch (Exception e) {
log.log("Error while setting up the driver.");
}
try {
switch (tc) {
case acct_Profile:
verifyAcct_ProfileUpdated();
break;
}
} catch (Exception e) {
log.log("There was an Exception while running the test: "
+ e.getMessage());
}
callMethod.close();
}
/**
* Verifies my profile updated NATIVELY
* @throws Exception
* @author Ola
*/
public static void verifyAcct_ProfileUpdated() throws Exception {
log.header("........ Verify MY ACCOUNT PROFILE section ........");
String finalResponse = callMethod.profileSection(
callMethod.parseConf_File("EMAIL_ADDRESS"),
callMethod.parseConf_File("NATIVE_PASSWORD"),
callMethod.parseConf_File("DISPLAY_NAME"),
callMethod.parseConf_File("FIRST_NAME"),
callMethod.parseConf_File("LAST_NAME"),
callMethod.parseConf_File("ADDRESS_1"),
callMethod.parseConf_File("ADDRESS_2"),
callMethod.parseConf_File("CITY"),
callMethod.parseConf_File("COUNTRY"),
callMethod.parseConf_File("COUNTRY_2"),
callMethod.parseConf_File("COUNTY"),
callMethod.parseConf_File("COUNTY_2"),
callMethod.parseConf_File("POSTCODE"),
callMethod.parseConf_File("TELEPHONE"));
if (finalResponse.contains("DOES NOT Exist")) {
log.log("User DOES NOT Exist in Database.... You will have to Sign Up.");
} else if (finalResponse.contains("FACEBOOK")) {
log.log("User Exist in Database with FACEBOOK Social Account and "
+ "Cannot Sign Up Natively......Open My Acct process terminated!........");
} else if (finalResponse.contains("GOOGLE")) {
log.log("User Exist in Database with GOOGLE Social Account and "
+ "Cannot Sign Up Natively......Open My Acct process terminated!........");
}else if (finalResponse.contains("STILL DOES NOT EXIS")){
log.log("CANNOT continue process as COUNTRY or COUNTY specified STILL DO NOT exist on list, ..pls contact Customer support");
}else if (finalResponse.contains("Disabled state")) {
log.log("Button is in Disabled state.....Profile was "
+ "NOT updated as NO Update was made.....");
} else if (finalResponse.contains("Successfully")) {
log.log("Profile was Successfully updated");
} else if (finalResponse.contains("NOT updated")) {
log.log("Profile was NOT updated.... pls contact Gigya customer service......");
} else if (finalResponse.contains("MY ACCOUNT page")) {
log.log("MY ACCOUNT page Successfully Opened and updated as expected.......");
}
callMethod.close();
}
Gradle test output
ola@ola-VirtualBox:~/workspace/mainsite_automation$ gradle 测试
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
BUILD SUCCESSFUL
Total time: 2.252 secs
./gradlew run output:
ola@ola-VirtualBox:~/workspace/mainsite_automation$ ./gradlew run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Starting ChromeDriver 2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a) on port 30326
Only local connections are allowed.
The current Url IS: http://www.independent.ie/
This driver is running on Linux System...@Current TIME and DATE: 12:22:43 25/04/2016
----------------------------------------------------------------------------------------------------
--........ Verify MY ACCOUNT PROFILE section ........-----------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--Click on My Account page to Open page ........ pls wait-------------------------------------------
----------------------------------------------------------------------------------------------------
-- Sign in to OPEN MY ACCOUNT PAGE ....... pls wait.------------------------------------------------
----------------------------------------------------------------------------------------------------
--......USER SIGN IN NATIVELY..............---------------------------------------------------------
----------------------------------------------------------------------------------------------------
[Step 1] Click the Sign In Link
SIGN IN :Link Exist, ..... and Successfully clicked......
[Step 2] Fill in the SIGN IN_FORM ........ pls wait to complete process....
email:
Element Present WITH empty value...JOE.ARPPEVM.MARK@GMAIL.COM: entered.
password: :
Element Present WITH empty value...QWERTY@123: entered.
[Step 3] Click Sign In Button.... pls wait...
----------------------------------------------------------------------------------------------------
--Check if SIGN IN is Present or Not......----------------------------------------------------------
----------------------------------------------------------------------------------------------------
SIGN IN :Button IS present..performing click action .....pls wait.
SIGN IN :Button clicked...... continue.
--Verify Successfully Sign In or NOT......... pls wait.---------------------------------------------
Verify: MY ACCOUNT element isPresent........pls wait......
MY ACCOUNT element PRESENT.....continue..
User Successfully signed in NATIVELY, Opening MY ACCOUNT page..... pls wait.
MY ACCOUNT :Link Exist, ..... and Successfully clicked......
----------------------------------------------------------------------------------------------------
--Select My Profile Section FROM My Account Page.... -----------------------------------------------
----------------------------------------------------------------------------------------------------
My Profile :Link Exist, ..... and Successfully clicked......
--Looping through all Elements and sendKeys.......pls wait...---------------------------------------
[Step 1]
Element Present WITH empty value...JOE_MARK: entered.
[Step 2]
TextBox field is write-protected..... therefore is in Disabled state.
Text box is disabled..... move to next step
[Step 3]
Element Present WITH empty value...JOE: entered.
[Step 4]
Element Present WITH empty value...ARPPEVM: entered.
[Step 5]
Element Present WITH empty value...10 PIMP RD: entered.
[Step 6]
Element Present WITH empty value...ESTATE CLOSE: entered.
[Step 7]
Element Present WITH empty value...DUBLIN: entered.
[Step 8]
empty country.......
3
Country specified DOES NOT EXIST ......please make another selection
CANNOT continue process as COUNTRY or COUNTY specified STILL DO NOT exist on list, ..pls contact Customer support
BUILD SUCCESSFUL
Total time: 1 mins 45.796 secs
UPDATED CODE BELOW ...... code works and run successfully when run manually
package main.java.Functional;
import static org.junit.Assert.assertTrue;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import main.java.Functional.AllMethodsTestcases.performAction;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* This class is used for testing all the indo functionalities.
*
* @author Ola
*/
public class AllMethodsTest {
/**
* Variables to set up driver and browser.
*/
public static AllMethods callMethod;
public static WebDriver driver;
public static String ID;
public static String filePath = "C:\\Users\\Ola\\workspace\\Config.properties";
/**
* Setup method to run chrome browser
* @param args
* @throws Exception
*/
@Before
public static void setup(String[] args) throws Exception {
callMethod = new AllMethods();
callMethod.setup();
callMethod.driver.get("http://independent.ie");
// Maximize browser window
callMethod.driver.manage().window().maximize();
// store current url in a string
String site = callMethod.driver.getCurrentUrl();
// print out the URL in the console
System.out.println("The current Url IS: " + site);
// Get the OS on which the driver is running.......
String detectOS = log.DetectOS();
log.log(detectOS);
Thread.sleep(7000);
}
/**
* Main Method to start the browser and run all necessary testcases. *
* @param args
* @throws Exception
*/
@Before
public static void main(String[] args) throws Exception {
// specify the Test to Run.........
performAction tc = performAction.acct_Profile;
try {
setup(args);
} catch (Exception e) {
log.log("Error while setting up the driver.");
}
try {
switch (tc) {
case testMouseOverJobs:
testVerifyJobsLink();
break;
case testMouseOverCars:
testVerifyCarsLink();
break;
case testMouseOverDating:
testVerifyDatingLink();
break;
case testMouseOverDeath:
testVerifyDeathNoticesLink();
break;
case testMouseOverFitMag:
testVerifyFitMagLink();
break;
case testMouseOverHotels:
testVerifyHotelsLink();
break;
case click_subscribe:
testVerifySubscribeLink();
break;
case click_SignInNative:
testVerifySignIn_Native();
break;
case click_SignUpNative:
testVerifySignUp_Native();
break;
case searchUser:
testVerifySearchUser();
break;
case deleteUser:
testVerifyDeleteUser();
break;
case click_SignInFB:
testVerifySignInFB();
break;
case click_SignInFB_EditInfo:
testVerifySignInFB_EditInfo();
break;
case click_SignInGoogle:
testVerifySignInGoogle();
break;
case click_MyAcct_SS:
testVerifyClick_MyAcctPage_forS_S_user();
break;
case click_MyAcct:
testVerifyClick_MyAcct();
break;
case acct_Profile:
testVerifyAcct_ProfileUpdated();
break;
case acct_Password:
testVerifyAcct_PasswordChange();
break;
case acct_SocialAccts_FB:
testVerifyAcct_SocialLink_FB();
break;
case acct_SocialAccts_Google:
testVerifyAcct_SocialLink_Google();
break;
}
} catch (Exception e) {
log.log("There was an Exception while running the test: "
+ e.getMessage());
}
tearDown();
}
/**
* "C:\\Users\\Ola\\workspace\\Config.properties"
* @throws Exception
*/
@Test
private static void testVerifyFileExist() throws Exception {
boolean verify =callMethod.FileExist();
if(verify)
{
log.log("File does exist");
}else
{
log.log("File does not exist, .....");
}
tearDown();
}
@Test
private static void testVerifyloadConfig_File() throws Exception {
log.divider("Load Config file path specified");
String response =callMethod.parseConf_File("NATIVE_PASSWORD");
log.log(response);
tearDown();
}
/**
* Verifies JOB link on home page
* @throws Exception
* @author Ola
*/
@Test
public static void testVerifyJobsLink() throws Exception {
log.header("....... Verify JOBS Link.........");
callMethod.hoverAndClickOnce(By.cssSelector(AllMethodsCONSTANTElements.JOBS),
By.cssSelector(AllMethodsCONSTANTElements.IRISHJOBS), "JOBS", "JOBS");
tearDown();
}
/**
* Verifies CARS link on home page
* @throws Exception
* @author Ola
*/
@Test
public static void testVerifyCarsLink() throws Exception {
log.header("....... Verify CARS Link.........");
String[] elementNames = new String[] { AllMethodsCONSTANTElements.CARSIRELAND,
AllMethodsCONSTANTElements.USED_CARS_SEARCH, AllMethodsCONSTANTElements.CAR_DEALERS };
for (String elementName : elementNames) {
log.divider("1st Element ......'CarsIreland.ie'.....");
if (callMethod.elementPresent(By.cssSelector(elementName),
"CARS_IRELAND")) {
callMethod.hoverAndClickMultiple(
By.cssSelector(AllMethodsCONSTANTElements.CARS),
By.cssSelector(AllMethodsCONSTANTElements.CARSIRELAND), "CARS",
"CarsIreland.ie");
Thread.sleep(3000);
log.header2("");
}
log.divider("2nd Element .......'Used Car Search.....'");
log.step("");
if (callMethod.elementPresent(By.cssSelector(elementName),
"USED CAR SEARCH")) {
log.log("Open Used Car Search link.....");
callMethod.hoverAndClickMultiple(
By.cssSelector(AllMethodsCONSTANTElements.CARS),
By.cssSelector(AllMethodsCONSTANTElements.USED_CARS_SEARCH),
"CARS", "USED CAR SEARCH");
Thread.sleep(3000);
log.header2("");
}
log.divider("3rd Element .......'Car Dealers'..........");
log.step("");
if (callMethod.elementPresent(By.cssSelector(elementName),
"CAR DEALERS")) {
log.log("Open Cars Dealers Link........");
callMethod.hoverAndClickMultiple(
By.cssSelector(AllMethodsCONSTANTElements.CARS),
By.cssSelector(AllMethodsCONSTANTElements.CAR_DEALERS), "CARS",
"CAR DEALERS");
break;
}
}
tearDown();
}
/**
* Verifies my profile updated NATIVELY
* @throws Exception
* @author Ola
*/
@Test
public static void testVerifyAcct_ProfileUpdated() throws Exception {
log.header("........ Verify MY ACCOUNT PROFILE section ........");
String finalResponse = callMethod.profileSection(
callMethod.parseConf_File("EMAIL_ADDRESS"),
callMethod.parseConf_File("NATIVE_PASSWORD"),
callMethod.parseConf_File("DISPLAY_NAME"),
callMethod.parseConf_File("FIRST_NAME"),
callMethod.parseConf_File("LAST_NAME"),
callMethod.parseConf_File("ADDRESS_1"),
callMethod.parseConf_File("ADDRESS_2"),
callMethod.parseConf_File("CITY"),
callMethod.parseConf_File("COUNTRY"),
callMethod.parseConf_File("COUNTRY_2"),
callMethod.parseConf_File("COUNTY"),
callMethod.parseConf_File("COUNTY_2"),
callMethod.parseConf_File("POSTCODE"),
callMethod.parseConf_File("TELEPHONE"));
if (finalResponse.contains("DOES NOT Exist")) {
log.log("User DOES NOT Exist in Database.... You will have to Sign Up.");
} else if (finalResponse.contains("FACEBOOK")) {
log.log("User Exist in Database with FACEBOOK Social Account and "
+ "Cannot Sign Up Natively......Open My Acct process terminated!........");
} else if (finalResponse.contains("GOOGLE")) {
log.log("User Exist in Database with GOOGLE Social Account and "
+ "Cannot Sign Up Natively......Open My Acct process terminated!........");
}else if (finalResponse.contains("STILL DOES NOT EXIS")){
log.log("CANNOT continue process as COUNTRY or COUNTY specified STILL DO NOT exist on list, ..pls contact Customer support");
}else if (finalResponse.contains("Disabled state")) {
log.log("Button is in Disabled state.....Profile was "
+ "NOT updated as NO Update was made.....");
} else if (finalResponse.contains("Successfully")) {
log.log("Profile was Successfully updated");
} else if (finalResponse.contains("NOT updated")) {
log.log("Profile was NOT updated.... pls contact Gigya customer service......");
} else if (finalResponse.contains("MY ACCOUNT page")) {
log.log("MY ACCOUNT page Successfully Opened and updated as expected.......");
}
tearDown();
}
@After
public static void tearDown(){
callMethod.close();
}
最佳答案
仅仅因为测试目标被执行并不意味着那里有任何测试。您没有收到测试报告的问题是您的类不是 JUnit 测试。
要启用该类作为 JUnit 测试执行,您需要使用 JUnit 的注释 org.junit.Test
、org.junit.Before
和 org.junit .之后
。也就是说,您需要将您的类重构为这样的内容(不一定完整......):
package main.java.Functional;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
*
*
* This class is used for testing all the indo functionalities.
*
* @author Ola
*/
public class Test_Run {
/**
* Variables to set up driver and browser.
*/
public static AllMethods callMethod;
public static WebDriver driver;
public static String ID;
public static String filePath = "C:\\Users\\Ola\\workspace\\Config.properties";
/**
* Setup method to run chrome browser
*
* @param args
* @throws Exception
*/
@Before
public void setup() throws Exception {
callMethod = new AllMethods();
callMethod.setup();
callMethod.driver.get("http://independent.ie");
// Maximize browser window
callMethod.driver.manage().window().maximize();
// store current url in a string
String site = callMethod.driver.getCurrentUrl();
// print out the URL in the console
System.out.println("The current Url IS: " + site);
// Get the OS on which the driver is running.......
String detectOS = log.DetectOS();
log.log(detectOS);
Thread.sleep(7000);
}
@After
public void tearDown() {
callMethod.close();
}
/**
* Verifies my profile updated NATIVELY
*
* @throws Exception
* @author Ola
*/
@Test
public void verifyAcct_ProfileUpdated() throws Exception {
log.header("........ Verify MY ACCOUNT PROFILE section ........");
String finalResponse = callMethod.profileSection(
callMethod.parseConf_File("EMAIL_ADDRESS"),
callMethod.parseConf_File("NATIVE_PASSWORD"),
callMethod.parseConf_File("DISPLAY_NAME"),
callMethod.parseConf_File("FIRST_NAME"),
callMethod.parseConf_File("LAST_NAME"),
callMethod.parseConf_File("ADDRESS_1"),
callMethod.parseConf_File("ADDRESS_2"),
callMethod.parseConf_File("CITY"),
callMethod.parseConf_File("COUNTRY"),
callMethod.parseConf_File("COUNTRY_2"),
callMethod.parseConf_File("COUNTY"),
callMethod.parseConf_File("COUNTY_2"),
callMethod.parseConf_File("POSTCODE"),
callMethod.parseConf_File("TELEPHONE"));
if (finalResponse.contains("DOES NOT Exist")) {
log.log("User DOES NOT Exist in Database.... You will have to Sign Up.");
} else if (finalResponse.contains("FACEBOOK")) {
log.log("User Exist in Database with FACEBOOK Social Account and "
+ "Cannot Sign Up Natively......Open My Acct process terminated!........");
} else if (finalResponse.contains("GOOGLE")) {
log.log("User Exist in Database with GOOGLE Social Account and "
+ "Cannot Sign Up Natively......Open My Acct process terminated!........");
} else if (finalResponse.contains("STILL DOES NOT EXIS")) {
log.log("CANNOT continue process as COUNTRY or COUNTY specified STILL DO NOT exist on list, ..pls contact Customer support");
} else if (finalResponse.contains("Disabled state")) {
log.log("Button is in Disabled state.....Profile was "
+ "NOT updated as NO Update was made.....");
} else if (finalResponse.contains("Successfully")) {
log.log("Profile was Successfully updated");
} else if (finalResponse.contains("NOT updated")) {
log.log("Profile was NOT updated.... pls contact Gigya customer service......");
} else if (finalResponse.contains("MY ACCOUNT page")) {
log.log("MY ACCOUNT page Successfully Opened and updated as expected.......");
}
callMethod.close();
}
}
总的来说,遵循测试类的通用命名约定是一种很好的风格。也就是说,您的测试类应该命名为 AllMethodsTest
之类的名称,表明它包含类 AllMethods
的测试用例。您的测试方法应命名为 testVerifyAcct_ProfileUpdated
,以便轻松将它们与类中的其他帮助器方法区分开来。
此外,您在测试中没有断言任何内容。您只需将一些内容写入输出或日志文件即可。这样你的测试总是会成功(当然除非有异常(exception))。您应该考虑将预期输出的假设指定为断言,如这个小测试示例所示:
@Test
public void testCanConstructAPersonWithAName() {
String firstName = "Larry";
Person person = new Person(firstName);
// the person's name attribute is expected to be firstName
assertEquals(firstName , person.getName());
}
<小时/>
更新:
基本 Java 项目的结构应如下所示:
关于java - JUNIT测试报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36836238/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!