Search in sources :

Example 41 with QTI21EditorPage

use of org.olat.selenium.page.qti.QTI21EditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorNumericalInput_absolut.

/**
 * An author make a test with 2 questions using numerical input to
 * test the absolute tolerance mode.<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test but
 * on the limit.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorNumericalInput_absolut(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Numerical QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a numerical input: 3.1 - 3.2
    QTI21GapEntriesEditorPage fibEditor = qtiEditor.addNumerical().appendContent("Usefull for circles ").editNumericalInput("3.1416", "pi", ToleranceMode.ABSOLUTE, "3.2", "3.1", 1).saveNumericInput().save();
    // use standard score setting
    // set feedbacks
    fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Out of bounds").save();
    // add a numerical input which represent a rounding issue
    fibEditor = qtiEditor.addNumerical().appendContent("Check rounding issue ").editNumericalInput("14.923", "rounding", ToleranceMode.ABSOLUTE, "14.925", "14.915", 1).saveNumericInput().save();
    // set feedbacks
    fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a numerical input with negative values
    fibEditor = qtiEditor.addNumerical().appendContent("Check rounding issue ").editNumericalInput("-14.923", "negative", ToleranceMode.ABSOLUTE, "-14.921", "-14.931", 1).saveNumericInput().save();
    // set feedbacks
    fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(participantBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // first user make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("3", "pi").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("3.15", "pi").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("14.914", "rounding").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("14.915", "rounding").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("-14.932", "negative").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("-14.920", "negative").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 1 point + 1 point + 0 point
    2);
    // a second user search the content package
    LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    NavigationPage reiNavBar = new NavigationPage(participantBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test with all the correct answers
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("3.2", "pi").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("14.925", "rounding").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("-14.921", "negative").saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(3);
}
Also used : QTI21GapEntriesEditorPage(org.olat.selenium.page.qti.QTI21GapEntriesEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 42 with QTI21EditorPage

use of org.olat.selenium.page.qti.QTI21EditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorHotspot_multipleChoice.

/**
 * An author make a test with 2 hotspots with the multiple choice cardinality,
 * the first with the score set if all answers are correct, the second
 * with scoring per answers.<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorHotspot_multipleChoice(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    String qtiTestTitle = "Hotspot QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add an hotspot: all answers score
    QTI21HotspotEditorPage hotspotEditor = qtiEditor.addHotspot();
    // 2 spots
    URL backgroundImageUrl = JunitTestHelper.class.getResource("file_resources/house.jpg");
    File backgroundImageFile = new File(backgroundImageUrl.toURI());
    hotspotEditor.updloadBackground(backgroundImageFile).resizeCircle().moveCircle(300, 120).addRectangle().moveRectangle(150, 150).setCardinality(Cardinality.MULTIPLE).setCorrect("2.", true).save();
    // change max score
    hotspotEditor.selectScores().setMaxScore("3").save();
    // some feedbacks
    hotspotEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a second hotspot: score per answer
    hotspotEditor = qtiEditor.addHotspot();
    hotspotEditor.updloadBackground(backgroundImageFile).resizeCircle().moveCircle(310, 125).addRectangle().moveRectangle(145, 155).setCardinality(Cardinality.MULTIPLE).setCorrect("2.", true).save();
    // change scoring
    hotspotEditor.selectScores().setMaxScore("3").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("1.", "2").setScore("2.", "1").save();
    hotspotEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(participantBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerHotspot("rect").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerHotspot("circle").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerHotspot("circle").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 2 from the second
    5);
    // a second user search the content package
    LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    NavigationPage reiNavBar = new NavigationPage(participantBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerHotspot("circle").answerHotspot("rect").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerHotspot("circle").answerHotspot("rect").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 3 from the second
    6);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) QTI21HotspotEditorPage(org.olat.selenium.page.qti.QTI21HotspotEditorPage) File(java.io.File) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 43 with QTI21EditorPage

use of org.olat.selenium.page.qti.QTI21EditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorMatchDragAndDrop.

/**
 * An author make a test with 2 match of the drag and drop variety
 * with feedbacks.<br>
 * A first user make the test, check the feedbacks but make an error
 * and score the maximum. A second user answers all the questions
 * correctly.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatchDragAndDrop(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    UserVO chara = new UserRestClient(deploymentUrl).createRandomUser("Chara");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Match DnD QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a match, multiple selection
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatchDragAndDrop();
    matchEditor.setSource(0, "Einstein").setSource(1, "Planck").addRow().setSource(2, "Euler").setTarget(0, "Physicist").setTarget(1, "Mathematician").setMatch(0, 0, true).setMatch(1, 0, true).setMatch(2, 1, true).save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "Euler come from Switzerland").setCorrectSolution("Correct solution", "The correct solution is simple").setCorrectFeedback("Correct feedback", "You are right").setIncorrectFeedback("Incorrect", "Your answer is not exactly correct").save();
    // second match
    matchEditor = qtiEditor.addMatchDragAndDrop().setSingleChoices().setSource(0, "Euler").setSource(1, "Broglie").addRow().setSource(2, "Konrad").setTarget(0, "Mathematics").setTarget(1, "Medicine").addColumn().setTarget(2, "Physics").setMatch(0, 0, true).setMatch(1, 2, true).setMatch(2, 1, true).save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("8").setScore(0, 0, "2.0").setScore(0, 1, "0.0").setScore(0, 2, "0.0").setScore(1, 0, "0.0").setScore(1, 1, "0.0").setScore(1, 2, "3.0").setScore(2, 0, "0.0").setScore(2, 1, "2.0").setScore(2, 2, "0.0").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // close editor
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
    NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
    asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    asukaQtiPage.assertOnAssessmentItem().answerMatchDropSourceToTarget("Einstein", "Physicist").answerMatchDropSourceToTarget("Planck", "Mathematician").answerMatchDropSourceToTarget("Euler", "Mathematician").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatchDropTargetToTarget("Planck", "Physicist").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Physics").answerMatchDropSourceToTarget("Euler", // 2 points
    "Medicine").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Medicine").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(9);
    // a second user search the content package
    LoginPage charaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    charaLoginPage.loginAs(chara.getLogin(), chara.getPassword()).resume();
    NavigationPage charaNavBar = new NavigationPage(participantBrowser);
    charaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).answerMatchDropSourceToTarget("Einstein", "Physicist").answerMatchDropSourceToTarget("Planck", "Physicist").answerMatchDropSourceToTarget("Euler", "Mathematician").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Physics").answerMatchDropSourceToTarget("Euler", // 2 points
    "Mathematics").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Medicine").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 7 from the second
    11);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 44 with QTI21EditorPage

use of org.olat.selenium.page.qti.QTI21EditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorNegativePoints.

/**
 * An author make a test and use the negative points.<br>
 * 3 users search the test, pass the test or not and
 * check their results.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorNegativePoints(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Choices QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // customize the section
    qtiEditor.selectSection().selectExpertOptions().sectionTitle(false).save();
    // edit the default single choice
    qtiEditor.selectItem("Single Choice");
    QTI21SingleChoiceEditorPage scEditor = new QTI21SingleChoiceEditorPage(browser);
    scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").save();
    scEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("2.0").setMinScore("-1.0").setScore("Wrong", "-1").setScore("Correct", "2").setScore("Faux", "-1").save();
    // add a multiple choice
    QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
    mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "Ok").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
    mcEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("2.0").setMinScore("-2").setScore("Correct", "1").setScore("Ok", "1").setScore("Faux", "-2").setScore("Falsch", "-2").save();
    // add an hotspot
    QTI21HotspotEditorPage hotspotEditor = qtiEditor.addHotspot();
    // 2 spots
    URL backgroundImageUrl = JunitTestHelper.class.getResource("file_resources/house.jpg");
    File backgroundImageFile = new File(backgroundImageUrl.toURI());
    hotspotEditor.updloadBackground(backgroundImageFile).resizeCircle().moveCircle(300, 120).addRectangle().moveRectangle(150, 150).setCardinality(Cardinality.SINGLE).save();
    hotspotEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("3.0").setMinScore("-2").setScore("1.", // circle
    "3.0").setScore("2.", // rectangle
    "-2").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(participantBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test with all correct answers
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Ok").answerMultipleChoice("Correct").saveAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(7).assertOnAssessmentTestMaxScore(7);
    // a  second user search the content package
    LoginPage asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
    NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
    asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test with all correct answers
    QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    asukaQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Wrong").saveAnswer().answerMultipleChoice("Falsch").answerMultipleChoice("Faux").saveAnswer().answerHotspot("rect").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// -1 + -4 but never under 0
    0).assertOnAssessmentTestMaxScore(7);
    // a third user search the content package
    LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    NavigationPage reiNavBar = new NavigationPage(participantBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test with some correct answers
    QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    reiQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Faux").saveAnswer().answerMultipleChoice("Ok").answerMultipleChoice("Correct").saveAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// -1 + 2 + 3 points
    4).assertOnAssessmentTestMaxScore(7);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) QTI21SingleChoiceEditorPage(org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage) UserVO(org.olat.user.restapi.UserVO) QTI21MultipleChoiceEditorPage(org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage) NavigationPage(org.olat.selenium.page.NavigationPage) QTI21HotspotEditorPage(org.olat.selenium.page.qti.QTI21HotspotEditorPage) File(java.io.File) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 45 with QTI21EditorPage

use of org.olat.selenium.page.qti.QTI21EditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorSingleChoices.

/**
 * Test different settings in the single choice editor. An author
 * make a test with 2 single choices, one with score all answer correct,
 * the second with score per answer and feedbacks.<br>
 * A second user make the test and check the score at the end of
 * the test.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorSingleChoices(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Choices QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a single choice: all answers score
    QTI21SingleChoiceEditorPage scEditor = qtiEditor.addSingleChoice();
    scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
    // change max score
    scEditor.selectScores().setMaxScore("3").save();
    // set some feedbacks
    scEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // score per answers
    scEditor = qtiEditor.addSingleChoice().setAnswer(0, "AlmostRight").addChoice(1).setAnswer(1, "NotRight").addChoice(2).setCorrect(2).setAnswer(2, "RightAnswer").addChoice(3).setAnswer(3, "TheWrongOne").save();
    scEditor.selectScores().setMaxScore("2").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("Almost", "1").setScore("NotRight", "0").setScore("RightAnswer", "2").setScore("TheWrongOne", "0").save();
    scEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage userLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(ryomouBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerSingleChoiceWithParagraph("Falsch").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerSingleChoiceWithParagraph("Correct").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerSingleChoiceWithParagraph("Almost").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 1 from the second
    4);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) QTI21SingleChoiceEditorPage(org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)46 Test (org.junit.Test)46 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 QTI21Page (org.olat.selenium.page.qti.QTI21Page)46 UserRestClient (org.olat.test.rest.UserRestClient)46 UserVO (org.olat.user.restapi.UserVO)46 LoginPage (org.olat.selenium.page.LoginPage)38 NavigationPage (org.olat.selenium.page.NavigationPage)38 File (java.io.File)10 URL (java.net.URL)10 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 QTI21MultipleChoiceEditorPage (org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage)8 QTI21SingleChoiceEditorPage (org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage)8 QTI21GapEntriesEditorPage (org.olat.selenium.page.qti.QTI21GapEntriesEditorPage)6 QTI21HotspotEditorPage (org.olat.selenium.page.qti.QTI21HotspotEditorPage)6 QTI21LobEditorPage (org.olat.selenium.page.qti.QTI21LobEditorPage)6 QTI21HottextEditorPage (org.olat.selenium.page.qti.QTI21HottextEditorPage)2 QTI21KprimEditorPage (org.olat.selenium.page.qti.QTI21KprimEditorPage)2