Skip to content

Instantly share code, notes, and snippets.

You are a Senior QA Automation Architect.
Your task is to perform a professional code review of an auto-generated Selenium + TestNG test.
Analyze the code and provide:
- Functional risks
- Test design issues
- Stability problems
- Maintainability issues
// STAGE 5. GENERATE AUTOTESTS
TestGenerator.generate();
System.out.println("Autotests generated.");
package org.demo.ui;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginPage {
private final WebDriver driver;
public LoginPage(WebDriver driver) {
package org.demo.ui;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
public class BaseUiTest {
import model.TestCase;
import model.TestSuite;
public class TestGenerator {
public static void generate() {
TestSuite suite = TestcasesParser.parse("generated/testcases.json");
StringBuilder code = new StringBuilder();
You are a Senior QA engineer.
Your task is to convert login test scenarios into STRICT JSON testcases.
Rules:
CRITICAL
- Return ONLY raw JSON
- No ```
- No comments
- No explanations
// STAGE 3. GENERATE SCENARIOS
String rawScenarios = MistralClient.call(finalPrompt);
FilesUtil.write("generated/scenarios_raw.json", rawScenarios);
String scenarios = extractAssistantContent(rawScenarios);
FilesUtil.write("generated/ai_output.txt", scenarios);
// ================================
// STAGE 4. GENERATE JSON TESTCASES
String jsonPrompt = FilesUtil.read("prompts/02_testcases_json.txt")
package model;
import java.util.List;
public class TestSuite {
public List<TestCase> testcases;
}
package model;
import java.util.List;
public class TestCase {
public String id;
public String title;
public String type;
public List<String> steps;
public String expected;
import com.fasterxml.jackson.databind.ObjectMapper;
import model.TestSuite;
import java.nio.file.Files;
import java.nio.file.Path;
public class TestcasesParser {