use of org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorHiddenSection.
/**
* An author make a test with 2 questions and in the expert
* settings of the section, it hides the title. It set the
* access configuration.<br>
* A user search the test, make it, check that the sections
* are not visible, pass the test and check the assessment
* results.
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorHiddenSection(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) 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();
// 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();
// add a multiple choice
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "OkToo").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").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().assertHiddenSection().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("OkToo").answerMultipleChoice("Correct").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(2).assertOnAssessmentTestMaxScore(2);
}
use of org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage in project openolat by klemens.
the class ImsQTI21EditorTest method qti21EditorMultipleChoices_complexConditionalFeedback.
/**
* Test the conditional feedback with 3 conditions based
* on attempts (and an incorrect feedback used as marker),
* on score and on response. It's done with a multiple
* choice with score per answer and a negative min. score.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorMultipleChoices_complexConditionalFeedback(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
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();
qtiEditor.selectNode("Single choice").deleteNode();
// add a single choice: all answers score
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Ok").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
// add negative scores to play with
mcEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("Ok", "3").setScore("Correct", "1").setScore("Faux", "-1").setScore("Falsch", "-1").setMaxScore("4").save();
// set a conditional feedback
mcEditor.selectFeedbacks().setIncorrectFeedback("Incorrect", "Not the right response").addConditionalFeedback(1, "NegativeFirstAttempts", "Negative score").setCondition(1, 1, Variable.attempts, Operator.equals, "1").addCondition(1, 1).setCondition(1, 2, Variable.score, Operator.smaller, "0").addConditionalFeedback(2, "FauxAnswer", "You choose the 'Faux' answer").setCondition(2, 1, Variable.response, Operator.equals, "Faux").addConditionalFeedback(3, "Positive", "Score between 0 and 3").setCondition(3, 1, Variable.score, Operator.biggerEquals, "0").addCondition(3, 1).setCondition(3, 2, Variable.score, Operator.smaller, "3").save();
qtiPage.clickToolbarBack().assertOnAssessmentItem().answerMultipleChoice("Falsch", "Faux").saveAnswer().assertFeedback("Incorrect").assertFeedback("FauxAnswer").assertFeedback("NegativeFirstAttempts").assertNoFeedback("Positive").deselectAnswerMultipleChoice("Faux", "Falsch").answerMultipleChoice("Faux", "Correct").saveAnswer().assertFeedback("Incorrect").assertFeedback("FauxAnswer").assertFeedback("Positive").assertNoFeedback("NegativeFirstAttempts").deselectAnswerMultipleChoice("Faux").answerMultipleChoice("Ok").saveAnswer().assertNoFeedback().endTest();
}
use of org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorMultipleChoices.
/**
* An author make a test with 2 multiple choices, 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 qti21EditorMultipleChoices(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO eric = new UserRestClient(deploymentUrl).createRandomUser("Eric");
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
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "OkToo").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
// change max score
mcEditor.selectScores().setMaxScore("3").save();
// set some feedbacks
mcEditor.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
mcEditor = qtiEditor.addMultipleChoice().setCorrect(0).setAnswer(0, "AlmostRight").addChoice(1).setAnswer(1, "NotRight").addChoice(2).setCorrect(2).setAnswer(2, "RightAnswer").addChoice(3).setAnswer(3, "TheWrongOne").save();
mcEditor.selectScores().setMaxScore("3").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("AlmostRight", "1").setScore("NotRight", "0").setScore("RightAnswer", "2").setScore("TheWrongOne", "0").save();
mcEditor.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().answerMultipleChoice("Falsch").answerMultipleChoice("OkToo").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMultipleChoice("Falsch").answerMultipleChoice("Correct").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMultipleChoice("AlmostRight").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 1 from the second
4);
// a second user search the content package
LoginPage ericLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
ericLoginPage.loginAs(eric.getLogin(), eric.getPassword()).resume();
NavigationPage ericNavBar = new NavigationPage(participantBrowser);
ericNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerMultipleChoice("Correct", "OkToo").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMultipleChoice("AlmostRight", "RightAnswer").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 3 from the second
6);
}
use of org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorMultipleChoices_complexConditionalFeedback.
/**
* Test the conditional feedback with 3 conditions based
* on attempts (and an incorrect feedback used as marker),
* on score and on response. It's done with a multiple
* choice with score per answer and a negative min. score.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorMultipleChoices_complexConditionalFeedback(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
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();
qtiEditor.selectNode("Single choice").deleteNode();
// add a single choice: all answers score
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Ok").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
// add negative scores to play with
mcEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("Ok", "3").setScore("Correct", "1").setScore("Faux", "-1").setScore("Falsch", "-1").setMaxScore("4").save();
// set a conditional feedback
mcEditor.selectFeedbacks().setIncorrectFeedback("Incorrect", "Not the right response").addConditionalFeedback(1, "NegativeFirstAttempts", "Negative score").setCondition(1, 1, Variable.attempts, Operator.equals, "1").addCondition(1, 1).setCondition(1, 2, Variable.score, Operator.smaller, "0").addConditionalFeedback(2, "FauxAnswer", "You choose the 'Faux' answer").setCondition(2, 1, Variable.response, Operator.equals, "Faux").addConditionalFeedback(3, "Positive", "Score between 0 and 3").setCondition(3, 1, Variable.score, Operator.biggerEquals, "0").addCondition(3, 1).setCondition(3, 2, Variable.score, Operator.smaller, "3").save();
qtiPage.clickToolbarBack().assertOnAssessmentItem().answerMultipleChoice("Falsch", "Faux").saveAnswer().assertFeedback("Incorrect").assertFeedback("FauxAnswer").assertFeedback("NegativeFirstAttempts").assertNoFeedback("Positive").deselectAnswerMultipleChoice("Faux", "Falsch").answerMultipleChoice("Faux", "Correct").saveAnswer().assertFeedback("Incorrect").assertFeedback("FauxAnswer").assertFeedback("Positive").assertNoFeedback("NegativeFirstAttempts").deselectAnswerMultipleChoice("Faux").answerMultipleChoice("Ok").saveAnswer().assertNoFeedback().endTest();
}
use of org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage in project OpenOLAT by OpenOLAT.
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);
}
Aggregations