(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Bonsoir,
Il ne s'agit pas de votre pom.xml, mais de votre test.java.
Envoyez moi aussi une capture d'écran de vos configurations de run, s'il vous plait (lorsque vous appuyez sur la petite flèche "play" d'éclipse pour lancer le test.ta).
cordialement,
Quentin
Il ne s'agit pas de votre pom.xml, mais de votre test.java.
Envoyez moi aussi une capture d'écran de vos configurations de run, s'il vous plait (lorsque vous appuyez sur la petite flèche "play" d'éclipse pour lancer le test.ta).
cordialement,
Quentin
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Rebonjour Monsieur Quentin,
Je vous redonne mon test.java (C_MONJAVA.java), ci-joint ainsi que la config de lancement (LANCEMENT.jpg) .
Cordialement
Maurice Olivier
Je vous redonne mon test.java (C_MONJAVA.java), ci-joint ainsi que la config de lancement (LANCEMENT.jpg) .
Cordialement
Maurice Olivier
- Pièces jointes
-
- LANCEMENT.jpg (45.74 Kio) Consulté 3733 fois
-
- console.txt
- (68.17 Kio) Téléchargé 140 fois
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
C_MONJAVA.txt pou le java
- Pièces jointes
-
- C_MONJAVA-2.txt
- (3.94 Kio) Téléchargé 136 fois
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Je pense qu'il ne passe pas en PJ, désolé :
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxProfile;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class C_MONJAVA {
private FirefoxBinary binary = new FirefoxBinary(new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"));
private FirefoxProfile profile = new FirefoxProfile();
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
// private String s_IHM_TEXT_EXPECTED = "Informations d'identification fournies non valides";
private String s_IHM_TEXT_EXPECTED = new String("XXXXXX_MESSAGE_D_ERREUR_BIDON_XXXXX");
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver(binary,profile);
baseUrl = "https://CRYPTED";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void Logintest() throws Exception {
System.out.println("@TEST AAAA DEBUT AAAA");
System.out.println("@TEST AAAAA s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
// log.info("XXXX");
driver.get(baseUrl);
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("LAURA");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("bidon$");
driver.findElement(By.id("submitButton")).click();
driver.findElement(By.name("submit")).click();
// WebElement o_we_ELEMENT=driver.findElement(By.className("alert-danger"));
//
// String s_IHM_TEXT_GOT=o_we_ELEMENT.getText();
//
// System.out.println("@TEST AAAAA s_IHM_TEXT_GOT=[" + s_IHM_TEXT_GOT + "]");
//
// assertEquals(s_IHM_TEXT_GOT, s_IHM_TEXT_EXPECTED);
// Assert.assertTrue(o_we_ELEMENT.contains(s_IHM_TEXT_EXPECTED));
}
@After
public void tearDown() throws Exception {
System.out.println("@AFTER XXXXX DEBUT AAAA");
WebElement o_we_ELEMENT=driver.findElement(By.className("alert-danger"));
String s_IHM_TEXT_GOT=o_we_ELEMENT.getText();
System.out.println("@AFTER XXXXX s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
System.out.println("@AFTER AAAAA s_IHM_TEXT_GOT=[" + s_IHM_TEXT_GOT + "]");
if (s_IHM_TEXT_GOT.equals(s_IHM_TEXT_EXPECTED))
{
System.out.println("@AFTER AAAAA EGAL");
}
else
{
System.out.println("@AFTER AAAAA DIFFERENT");
}
assertEquals(s_IHM_TEXT_GOT, s_IHM_TEXT_EXPECTED);
// Assert.assertTrue(o_we_ELEMENT.contains(s_IHM_TEXT_EXPECTED));
//______________________________
driver.quit();
//______________________________
System.out.println("@AFTER AAAAA FIN AAAA");
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxProfile;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class C_MONJAVA {
private FirefoxBinary binary = new FirefoxBinary(new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"));
private FirefoxProfile profile = new FirefoxProfile();
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
// private String s_IHM_TEXT_EXPECTED = "Informations d'identification fournies non valides";
private String s_IHM_TEXT_EXPECTED = new String("XXXXXX_MESSAGE_D_ERREUR_BIDON_XXXXX");
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver(binary,profile);
baseUrl = "https://CRYPTED";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void Logintest() throws Exception {
System.out.println("@TEST AAAA DEBUT AAAA");
System.out.println("@TEST AAAAA s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
// log.info("XXXX");
driver.get(baseUrl);
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("LAURA");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("bidon$");
driver.findElement(By.id("submitButton")).click();
driver.findElement(By.name("submit")).click();
// WebElement o_we_ELEMENT=driver.findElement(By.className("alert-danger"));
//
// String s_IHM_TEXT_GOT=o_we_ELEMENT.getText();
//
// System.out.println("@TEST AAAAA s_IHM_TEXT_GOT=[" + s_IHM_TEXT_GOT + "]");
//
// assertEquals(s_IHM_TEXT_GOT, s_IHM_TEXT_EXPECTED);
// Assert.assertTrue(o_we_ELEMENT.contains(s_IHM_TEXT_EXPECTED));
}
@After
public void tearDown() throws Exception {
System.out.println("@AFTER XXXXX DEBUT AAAA");
WebElement o_we_ELEMENT=driver.findElement(By.className("alert-danger"));
String s_IHM_TEXT_GOT=o_we_ELEMENT.getText();
System.out.println("@AFTER XXXXX s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
System.out.println("@AFTER AAAAA s_IHM_TEXT_GOT=[" + s_IHM_TEXT_GOT + "]");
if (s_IHM_TEXT_GOT.equals(s_IHM_TEXT_EXPECTED))
{
System.out.println("@AFTER AAAAA EGAL");
}
else
{
System.out.println("@AFTER AAAAA DIFFERENT");
}
assertEquals(s_IHM_TEXT_GOT, s_IHM_TEXT_EXPECTED);
// Assert.assertTrue(o_we_ELEMENT.contains(s_IHM_TEXT_EXPECTED));
//______________________________
driver.quit();
//______________________________
System.out.println("@AFTER AAAAA FIN AAAA");
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Bonjour,
Veuillez essayer avec ce script.
Cordialement,
Quentin
[center][color=#ff0000]LE SCRIPT[/color][/center]
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxProfile;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class C_MONJAVA {
private FirefoxBinary binary = new FirefoxBinary(new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"));
private FirefoxProfile profile = new FirefoxProfile();
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
// private String s_IHM_TEXT_EXPECTED = "Informations d'identification fournies non valides";
private String s_IHM_TEXT_EXPECTED = new String("XXXXXX_MESSAGE_D_ERREUR_BIDON_XXXXX");
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver(binary,profile);
baseUrl = "https://CRYPTED";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void Logintest() throws Exception {
System.out.println("@TEST AAAA DEBUT AAAA");
System.out.println("@TEST AAAAA s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
driver.get(baseUrl);
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("LAURA");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("bidon$");
driver.findElement(By.id("submitButton")).click();
driver.findElement(By.name("submit")).click();
WebElement o_we_ELEMENT=driver.findElement(By.className("alert-danger"));
String s_IHM_TEXT_GOT=o_we_ELEMENT.getText();
System.out.println("@AFTER XXXXX s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
System.out.println("@AFTER AAAAA s_IHM_TEXT_GOT=[" + s_IHM_TEXT_GOT + "]");
if (s_IHM_TEXT_GOT.equals(s_IHM_TEXT_EXPECTED))
{
System.out.println("@AFTER AAAAA EGAL");
}
else
{
System.out.println("@AFTER AAAAA DIFFERENT");
}
try{
assertTrue("/n LE MESSAGE D'ERREUR N'EST PAS CELUI ATTENDU /n",s_IHM_TEXT_GOT.equals(s_IHM_TEXT_EXPECTED));
}
catch(AssertionError ex){
System.out.println("/n LE MESSAGE D'ERREUR N'EST PAS CELUI ATTENDU /n");
throw ex;
}
System.out.println("/n LE MESSAGE D'ERREUR EST CONFORME /n");
}
@After
public void tearDown() {
System.out.println("/n fin du test /n");
driver.quit();
}
}
Veuillez essayer avec ce script.
Cordialement,
Quentin
[center][color=#ff0000]LE SCRIPT[/color][/center]
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxProfile;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class C_MONJAVA {
private FirefoxBinary binary = new FirefoxBinary(new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"));
private FirefoxProfile profile = new FirefoxProfile();
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
// private String s_IHM_TEXT_EXPECTED = "Informations d'identification fournies non valides";
private String s_IHM_TEXT_EXPECTED = new String("XXXXXX_MESSAGE_D_ERREUR_BIDON_XXXXX");
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver(binary,profile);
baseUrl = "https://CRYPTED";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void Logintest() throws Exception {
System.out.println("@TEST AAAA DEBUT AAAA");
System.out.println("@TEST AAAAA s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
driver.get(baseUrl);
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("LAURA");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("bidon$");
driver.findElement(By.id("submitButton")).click();
driver.findElement(By.name("submit")).click();
WebElement o_we_ELEMENT=driver.findElement(By.className("alert-danger"));
String s_IHM_TEXT_GOT=o_we_ELEMENT.getText();
System.out.println("@AFTER XXXXX s_IHM_TEXT_EXPECTED=[" + s_IHM_TEXT_EXPECTED + "]");
System.out.println("@AFTER AAAAA s_IHM_TEXT_GOT=[" + s_IHM_TEXT_GOT + "]");
if (s_IHM_TEXT_GOT.equals(s_IHM_TEXT_EXPECTED))
{
System.out.println("@AFTER AAAAA EGAL");
}
else
{
System.out.println("@AFTER AAAAA DIFFERENT");
}
try{
assertTrue("/n LE MESSAGE D'ERREUR N'EST PAS CELUI ATTENDU /n",s_IHM_TEXT_GOT.equals(s_IHM_TEXT_EXPECTED));
}
catch(AssertionError ex){
System.out.println("/n LE MESSAGE D'ERREUR N'EST PAS CELUI ATTENDU /n");
throw ex;
}
System.out.println("/n LE MESSAGE D'ERREUR EST CONFORME /n");
}
@After
public void tearDown() {
System.out.println("/n fin du test /n");
driver.quit();
}
}
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Bonjour Monsieur Quentin,
Merci pour l'aménagement du java code.
Ci-joint la console.
Le squash-ta-report.html, ci-joint donne toujours un success (à tort pour ce que nous voulons vérifier fonctionnellement).
Agrèez mes cordiales salutations
Maurice Olivier
Merci pour l'aménagement du java code.
Ci-joint la console.
Le squash-ta-report.html, ci-joint donne toujours un success (à tort pour ce que nous voulons vérifier fonctionnellement).
Agrèez mes cordiales salutations
Maurice Olivier
- Pièces jointes
-
- console_02.txt
- (78.21 Kio) Téléchargé 128 fois
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Bonjour,
Evoyez-moi un .zip de votre projet maven, je vous prie.
Quentin
Evoyez-moi un .zip de votre projet maven, je vous prie.
Quentin
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Rebonjour Monsieur Quentin,
Ci-joint.
Bonne après-midi.
Maurice Olivier
Ci-joint.
Bonne après-midi.
Maurice Olivier
- Pièces jointes
-
- P_SQUASH_PROJET_PILOTE_EN_TESTS_FONCTIONNELS__LE_BAN_D_ESSAIS.zip
- (54.22 Kio) Téléchargé 144 fois
(SQUASH_TA).Comment tester "Votre login ou mot de passe est invalide !"
Voici un projet inspiré du votre qui appelle la version 1.10.0 du framework Squash TA et utilise une version 3.4 de Selenium.
Pour lancer le build, téléchargez une jdk8 et configurez le build maven dessus.
De plus, vous verrez que le script lance le test sur google chrome, il vous faudra donc télécharger un "ChromeDriver" et le placer dans le répertoire C:\Selenium Drivers. Si vous voulez utiliser Firefox comme navigateur, il vous faudra un geckodriver (depuis Selenium 3).
Bonne soirée et bon courage dans votre projet d'automatisation.
Quentin
Pour lancer le build, téléchargez une jdk8 et configurez le build maven dessus.
De plus, vous verrez que le script lance le test sur google chrome, il vous faudra donc télécharger un "ChromeDriver" et le placer dans le répertoire C:\Selenium Drivers. Si vous voulez utiliser Firefox comme navigateur, il vous faudra un geckodriver (depuis Selenium 3).
Bonne soirée et bon courage dans votre projet d'automatisation.
Quentin
- Pièces jointes
-
- mon.squash.ta.project.zip
- (69.91 Kio) Téléchargé 134 fois